123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using Dapper;
- using HNWD.Pregrant.Model;
- using System.Collections.Generic;
- namespace HNWD.Pregrant.DataAccess
- {
- public class WD_RunProfileDataAccess : GenericDataAccess<WD_RunProfile>
- {
- 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<WD_RunProfile> 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<WD_RunProfile> 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<WD_RunProfile> 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);
- }
- }
- /// <summary>
- /// 更新LED标识
- /// </summary>
- /// <param name="invalid">是否无效</param>
- public void UpdateLedFlag(string invalid)
- {
- string strSql = " update [WD_RunProfile] SET LEDDeviceFlag={0} ";
- strSql = string.Format(strSql, invalid);
- this.Execute(strSql, this.wd_RunProfile);
- }
- }
- }
|