using System; using Dapper; using HNWD.Pregrant.Model; using System.Collections.Generic; namespace HNWD.Pregrant.DataAccess { public class WD_RunProfileDataAccess : GenericDataAccess { private WD_RunProfile wd_RunProfile = null; public WD_RunProfileExt ext = new WD_RunProfileExt(); public WD_RunProfileDataAccess(WD_RunProfile wd_RunProfile) { this.wd_RunProfile = wd_RunProfile; } private WD_RunProfileDataAccess() { } private readonly static WD_RunProfileDataAccess wd_RunProfileDataAccess = new WD_RunProfileDataAccess(); private readonly static object lockobj = new object(); public static WD_RunProfileDataAccess GetInstance() { lock (lockobj) { return wd_RunProfileDataAccess; } } //public List Query() //{ // string strSql = " select {0} from [WD_RunProfile] "; // ext.messageDataList = this.Query(strSql, new WD_RunProfile()); // 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 QueryAll() { string strSql = " select {0} from [WD_RunProfile] "; ext.messageDataList = this.Query(strSql, new WD_RunProfile()); 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 QueryByPartID(string partid) { string strSql = " select {0} from [WD_RunProfile] WHERR PARTID = " + partid ; ext.messageDataList = this.Query(strSql, new WD_RunProfile()); 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 UpdateVol() { this.wd_RunProfile.BroadcastVol = string.IsNullOrEmpty(this.wd_RunProfile.BroadcastVol) ? "0" : this.wd_RunProfile.BroadcastVol; int nVol = Convert.ToInt32(this.wd_RunProfile.BroadcastVol); if (nVol >= 0 && nVol <= 100) { string strSql = " update [WD_RunProfile] SET BroadcastVol={0} "; strSql = string.Format(strSql, this.wd_RunProfile.BroadcastVol); this.Execute(strSql, this.wd_RunProfile); } } /// /// 更新LED标识 /// /// 是否无效 public void UpdateLedFlag(string invalid) { string strSql = " update [WD_RunProfile] SET LEDDeviceFlag={0} "; strSql = string.Format(strSql, invalid); this.Execute(strSql, this.wd_RunProfile); } } }