using System; using System.Data; using System.Data.SqlClient; using System.Collections; using System.Collections.Generic; using AIMSModel; using AIMSObjectQuery; using System.Reflection; using System.Text; namespace AIMSDAL { internal partial class DNotice { public static List NoticeList() { List NoticeList = new List(); string strSql = "SELECT pc.Id, pc.Contents" + "FROM Notice pc"; DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql); for (int i = 0; i < dt.Rows.Count; i++) { Notice Notice = new Notice(); Notice.Id = int.Parse(dt.Rows[i]["ID"].ToString()); Notice.Contents = dt.Rows[i]["Contents"].ToString(); NoticeList.Add(Notice); } return NoticeList; } public static void Add(Notice NoticeObj) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [NoticeTemplate]("); strSql.Append("Contents,OperatorId,OperatorTime"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("'" + NoticeObj.Contents + "',"); strSql.Append("'" + AIMSExtension.PublicMethod.OperatorNo + "',"); strSql.Append("'" + AIMSExtension.PublicMethod.SystemDate() + "'"); strSql.Append(")"); HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString()); } public static DataTable GetOperationList() { string strSql = "select ID,Contents from dbo.NoticeTemplate"; return HelperDB.DbHelperSQL.GetDataTable(strSql); } public static DataTable GetOperation() { string strSql = "SELECT of1.MdrecNo,of1.PatientName FROM V_OperationFront of1 WHERE of1.[State]='手术中'"; return HelperDB.DbHelperSQL.GetDataTable(strSql); } public static void Delete(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete NoticeTemplate "); strSql.Append(" where Id=" + Id + ""); HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString()); } public static void sendout(Notice NoticeObj) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Notice]("); strSql.Append("Contents,SendState,OperatorNo,OperatorName,OperateDate"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("'" + NoticeObj.Contents + "',"); strSql.Append("'" + 1 + "',"); strSql.Append("'" + AIMSExtension.PublicMethod.OperatorNo + "',"); strSql.Append("'" + AIMSExtension.PublicMethod.OperatorName + "',"); strSql.Append("'" + AIMSExtension.PublicMethod.SystemDate() + "'"); strSql.Append(")"); HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString()); } public static List HistoryNoticeData() { List NoticeList = new List(); string strSql = "SELECT Id,Contents, OperatorTime " + " FROM [NoticeTemplate] order by OperatorTime desc "; DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql); for (int i = 0; i < dt.Rows.Count; i++) { Notice Notice = new Notice(); Notice.Id = int.Parse(dt.Rows[i]["Id"].ToString()); Notice.Contents = dt.Rows[i]["Contents"].ToString(); Notice.OperateDate = DateTime.Parse(dt.Rows[i]["OperatorTime"].ToString()); NoticeList.Add(Notice); } return NoticeList; } } }