public BaseTran <sis> GetSomesisList(string kks) { BaseTran <sis> recv = new BaseTran <sis>(); try { string path = "api/rt/sis?kks=" + kks; string url = BaseUri + path; recv = GetEntityList <sis>(url); if (recv.data == null) { recv.data = new List <sis>(); } foreach (sis item in recv.data) { DevInfo DevInfo = bll.DevInfos.DbSet.Where(p => p.KKS == item.kks).FirstOrDefault(); if (DevInfo == null) { continue; } DevInstantData did = bll.DevInstantDatas.DbSet.Where(p => p.Id == item.kks).FirstOrDefault(); if (did == null) { did = new DevInstantData(); did.Id = item.kks; did.Value = item.value; did.DateTime = DateTime.Now; did.DateTimeStamp = TimeConvert.DateTimeToTimeStamp(did.DateTime); bll.DevInstantDatas.Add(did); } else { DevInstantDataHistory didh = did.RemoveToHistory(); did.Value = item.value; did.DateTime = DateTime.Now; did.DateTimeStamp = TimeConvert.DateTimeToTimeStamp(did.DateTime); bll.DevInstantDatas.Edit(did); bll.DevInstantDataHistorys.Add(didh); } } } catch (Exception ex) { string messgae = ex.Message; } return(recv); }
public DevInstantDataHistory RemoveToHistory() { DevInstantDataHistory history = new DevInstantDataHistory(); history.KKS = this.Id; history.Name = this.Name; history.Value = this.Value; history.DateTime = this.DateTime; history.DateTimeStamp = this.DateTimeStamp; return(history); }