using System; using System.Data; using System.Data.SqlClient; using System.Collections; using System.Collections.Generic; using AIMSModel; using AIMSObjectQuery; using HelperDB; namespace AIMSDAL { internal partial class DEvents { public static DataTable GetCommonlyEvents() { string strSql = "select top 35 e.* from [Events] e where e.IsValid=1 and Name<>'入室' and Name<>'出室' and Name<>'手术开始' and Name<>'手术结束' and Name<>'麻醉开始' and Name<>'麻醉结束' Order By UseRate desc"; return DBHelper.GetDataTable(strSql); } public static DataTable GetEventsByIds(string ids) { if (ids != null && ids.Length > 0) { string sql = string.Format("select * from Events where Id in({0}) order by charindex(','+rtrim(cast(id as varchar(10)))+',',',{0},')", ids);//IsValid=1 and return DBHelper.GetDataTable(sql); } else { string sql = string.Format("select * from Events where 1<>1 "); return DBHelper.GetDataTable(sql); } } public static DataTable SelectIdNameCode(string str) { string sql = string.Empty; if (str == "") { sql = string.Format("select Id,HelpCode,Name from Events where IsValid=1 and Name<>'入室' and Name<>'出室' and Name<>'手术开始' and Name<>'手术结束' and Name<>'麻醉开始' and Name<>'麻醉结束' Order By UseRate desc"); } else { sql = string.Format("SELECT Top 28 e.Id,e.Name FROM Events e WHERE (Lower(Name) like '%{0}%' OR Lower(HelpCode) like '%{0}%') and (IsValid=1 and Name<>'入室' and Name<>'出室' and Name<>'手术开始' and Name<>'手术结束' and Name<>'麻醉开始' and Name<>'麻醉结束' ) Order By UseRate desc", str); } try { return DBHelper.GetDataTable(sql); } catch (SqlException ex) { throw new Exception(ex.Message); } } } }