123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using System;
- using Dapper;
- using HNWD.Pregrant.Model;
- using System.Collections.Generic;
- using System.Text;
- namespace HNWD.Pregrant.DataAccess
- {
- public class WD_NurseCfgInfoDataAccess : GenericDataAccess<WD_NurseCfgInfo>
- {
- private WD_NurseCfgInfo wd_NurseCfgInfo = null;
- public WD_NurseCfgInfoExt ext = new WD_NurseCfgInfoExt();
- private readonly static WD_NurseCfgInfoDataAccess wd_NurseCfgInfoDataAccess = new WD_NurseCfgInfoDataAccess(null);
- private readonly static object lockobj = new object();
- public static WD_NurseCfgInfoDataAccess GetInstance()
- {
- lock (lockobj)
- {
- return wd_NurseCfgInfoDataAccess;
- }
- }
- private WD_NurseCfgInfoDataAccess(WD_NurseCfgInfo wd_NurseCfgInfo)
- {
- this.wd_NurseCfgInfo = wd_NurseCfgInfo;
- }
- public List<WD_NurseCfgInfo> Query()
- {
- string strSql = " select {0} from [WD_NurseCfgInfo] where ID = '" + this.wd_NurseCfgInfo.ID + "'";
- ext.messageDataList = this.Query(strSql, new WD_NurseCfgInfo());
- ext.messageDataList.ForEach(f => f.bSuccess = this.bSuccess);
- ext.messageDataList.ForEach(f => f.Code = this.Code);
- ext.messageDataList.ForEach(f => f.Message = this.Message);
- ext.messageDataList.ForEach(f => f.Rows = this.Rows);
- ext.bSuccess = this.bSuccess;
- ext.Code = this.Code;
- ext.Message = this.Message;
- ext.Rows = this.Rows;
- return ext.messageDataList;
- }
- public List<WD_NurseCfgInfo> QueryAll()
- {
- string strSql = " select {0} from [WD_NurseCfgInfo] ";
- ext.messageDataList = this.Query(strSql, new WD_NurseCfgInfo());
- ext.messageDataList.ForEach(f => f.bSuccess = this.bSuccess);
- ext.messageDataList.ForEach(f => f.Code = this.Code);
- ext.messageDataList.ForEach(f => f.Message = this.Message);
- ext.messageDataList.ForEach(f => f.Rows = this.Rows);
- ext.bSuccess = this.bSuccess;
- ext.Code = this.Code;
- ext.Message = this.Message;
- ext.Rows = this.Rows;
- return ext.messageDataList;
- }
- public void Business(List<WD_NurseCfgInfo> il, List<WD_NurseCfgInfo> ul, List<WD_NurseCfgInfo> dl)
- {
-
- string strSql_i = " Insert into WD_NurseCfgInfo([NURSECFG_ID],[NURSECFG_VALUE],[NURSECFG_HIS_VALUE],[NURSECFG_NAME],[NURSECFG_COLOR],[NURSECFG_CONTENT],[NURSECFG_DATETIME]) VALUES ('{0}' , '{1}', '{2}', '{3}', '{4}' , '{5}' , '{6}' ) ";
- string strSql_u = " Update WD_NurseCfgInfo set NURSECFG_ID = '{0}' , NURSECFG_VALUE = '{1}' , NURSECFG_HIS_VALUE = '{2}' , NURSECFG_NAME = '{3}' , NURSECFG_COLOR = '{4}' , NURSECFG_CONTENT = '{5}' , NURSECFG_DATETIME = '{6}' where ID = '{7}' ";
- string strSql_d = " delete WD_NurseCfgInfo where ID = '{0}' ";
- StringBuilder sb_i = new StringBuilder();
- foreach (WD_NurseCfgInfo wd in il)
- {
- sb_i.AppendFormat(strSql_i, wd.NURSECFG_ID, wd.NURSECFG_VALUE, wd.NURSECFG_HIS_VALUE, wd.NURSECFG_NAME, wd.NURSECFG_COLOR, wd.NURSECFG_CONTENT, wd.NURSECFG_DATETIME);
- }
- StringBuilder sb_u = new StringBuilder();
- foreach (WD_NurseCfgInfo wd in ul)
- {
- sb_u.AppendFormat(strSql_u, wd.NURSECFG_ID, wd.NURSECFG_VALUE, wd.NURSECFG_HIS_VALUE, wd.NURSECFG_NAME, wd.NURSECFG_COLOR, wd.NURSECFG_CONTENT, wd.NURSECFG_DATETIME , wd.ID);
- }
- StringBuilder sb_d = new StringBuilder();
- foreach (WD_NurseCfgInfo wd in dl)
- {
- sb_d.AppendFormat(strSql_d, wd.ID);
- }
- this.Execute(sb_i.ToString(), sb_u.ToString(), sb_d.ToString());
- }
- }
- }
|