/// <summary> /// 往文档数据表中插入数据 /// </summary> /// <param name="info">新上传的文档数据信息</param> /// <returns></returns> public static Boolean InsertDocumentInfo(TBL_DOCUMENT info) { try { using (LampNetEntities db = new LampNetEntities()) { db.TBL_DOCUMENT.Add(info); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 往设备运维操作表中插入数据 /// </summary> /// <param name="info">用户操作设备产生的信息</param> /// <returns></returns> public static Boolean InsertDeviceprotectInfo(TBL_DEVICEPROTECT info) { try { using (LampNetEntities db = new LampNetEntities()) { db.TBL_DEVICEPROTECT.Add(info); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 往运行状态历史表中插入数据 /// </summary> /// <param name="info">系统产生的信息(本系统模拟)</param> /// <returns></returns> public static Boolean InsertRunnoteInfo(TBL_RUNNOTE info) { try { using (LampNetEntities db = new LampNetEntities()) { db.TBL_RUNNOTE.Add(info); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 往用户信息表中插入数据 /// </summary> /// <param name="info">前端页面输入的信息</param> /// <returns></returns> public static Boolean InsertUserInfo(TBL_USER info) { try { using (LampNetEntities db = new LampNetEntities()) { db.TBL_USER.Add(info); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 往单控信息表中插入数据 /// </summary> /// <param name="info">前端页面输入的信息</param> /// <returns></returns> public static Boolean InsertSigcontrolInfo(TBL_SIGCONTROL info) { try { using (LampNetEntities db = new LampNetEntities()) { db.TBL_SIGCONTROL.Add(info); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_RUNNOTE表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param> /// <param name="whereLambda"> (u=>u.ammeterId == info.ammeterId, info) == true </param> /// 判断有无siteId 或者 有无ammeter /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateRunnoteInfo(Expression <Func <TBL_RUNNOTE, bool> > whereLambda, TBL_RUNNOTE info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_RUNNOTE> dataObject = db.TBL_RUNNOTE.Where(whereLambda) as DbQuery <TBL_RUNNOTE>; TBL_RUNNOTE oldInfo = dataObject.FirstOrDefault(); oldInfo.runnoteAlastatus = info.runnoteAlastatus; oldInfo.runnoteAlatime = info.runnoteAlatime; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_FEEDBACK表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.userId == info.userId, info) == true </param> /// 判断有无userId /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateFeedbackInfo(Expression <Func <TBL_FEEDBACK, bool> > whereLambda, TBL_FEEDBACK info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_FEEDBACK> dataObject = db.TBL_FEEDBACK.Where(whereLambda) as DbQuery <TBL_FEEDBACK>; TBL_FEEDBACK oldInfo = dataObject.FirstOrDefault(); oldInfo.userId = info.userId; oldInfo.feedbackTime = info.feedbackTime; oldInfo.feedbackNote = info.feedbackNote; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_DOCUMENT表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.documentId == info.documentId, info) == true </param> /// 判断有无documentId /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateDocumentInfo(Expression <Func <TBL_DOCUMENT, bool> > whereLambda, TBL_DOCUMENT info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_DOCUMENT> dataObject = db.TBL_DOCUMENT.Where(whereLambda) as DbQuery <TBL_DOCUMENT>; TBL_DOCUMENT oldInfo = dataObject.FirstOrDefault(); oldInfo.documentKind = info.documentKind; oldInfo.documentNote = info.documentNote; oldInfo.documentUrl = info.documentUrl; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_DEVICEPROTECT表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param> /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param> /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param> /// 判断有无 三个参数都要与原数据中的一样才能修改,否则只能作为新数据插入 /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateDeviceprotectInfo(Expression <Func <TBL_DEVICEPROTECT, bool> > whereLambda, TBL_DEVICEPROTECT info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_DEVICEPROTECT> dataObject = db.TBL_DEVICEPROTECT.Where(whereLambda) as DbQuery <TBL_DEVICEPROTECT>; TBL_DEVICEPROTECT oldInfo = dataObject.FirstOrDefault(); oldInfo.deviceprotectKind = info.deviceprotectKind; oldInfo.deviceprotectModule = info.deviceprotectModule; oldInfo.deviceprotectLoginfo = info.deviceprotectLoginfo; oldInfo.deviceprotectOpttime = info.deviceprotectOpttime; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_RUN表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.siteId == info.siteId, info) == true </param> /// 判断有无siteId /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateRunInfo(Expression <Func <TBL_RUN, bool> > whereLambda, TBL_RUN info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_RUN> dataObject = db.TBL_RUN.Where(whereLambda) as DbQuery <TBL_RUN>; TBL_RUN oldInfo = dataObject.FirstOrDefault(); oldInfo.runVolt = info.runVolt; oldInfo.runCurrent = info.runCurrent; oldInfo.runStavalue = info.runStavalue; oldInfo.runFreshtime = info.runFreshtime; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 删除电表信息表中的数据 /// </summary> /// <param name="whereLambda">u => ammeterId == ammeterId</param> /// Notice:删除电表信息需要对应删除的信息有如下: /// 单控TBL_SIGCONTROL、运行状态历史TBL_RUNNOTE、设备运维TBL_DEVICEPROTECT public static Boolean DeleteAmmeterInfo(Expression <Func <TBL_AMMETER, bool> > whereLambda) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_AMMETER> dbDelete = db.TBL_AMMETER.Where(whereLambda) as DbQuery <TBL_AMMETER>; List <TBL_AMMETER> obDelete = dbDelete.ToList(); if (obDelete.Count == 0) { return(true); } db.TBL_AMMETER.RemoveRange(obDelete); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 删除设备运维操作表中的数据 /// </summary> /// <param name="whereLambda">u => userId == userId</param> /// <param name="whereLambda">u => siteId == siteId</param> /// <param name="whereLambda">u => ammeterId == ammeterId</param> public static Boolean DeleteDeviceprotectInfo(Expression <Func <TBL_DEVICEPROTECT, bool> > whereLambda) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_DEVICEPROTECT> dbDelete = db.TBL_DEVICEPROTECT.Where(whereLambda) as DbQuery <TBL_DEVICEPROTECT>; List <TBL_DEVICEPROTECT> obDelete = dbDelete.ToList(); if (obDelete.Count == 0) { return(true); } db.TBL_DEVICEPROTECT.RemoveRange(obDelete); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 删除单控信息表中的数据 /// </summary> /// <param name="whereLambda">u => ammeterId == ammeterId</param> public static Boolean DeleteSigcontrolInfo(Expression <Func <TBL_SIGCONTROL, bool> > whereLambda) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_SIGCONTROL> dbDelete = db.TBL_SIGCONTROL.Where(whereLambda) as DbQuery <TBL_SIGCONTROL>; List <TBL_SIGCONTROL> obDelete = dbDelete.ToList(); if (obDelete.Count == 0) { return(true); } db.TBL_SIGCONTROL.RemoveRange(obDelete); db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_SIGCONTROL表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.ammeterId == info.ammeterId, info) == true </param> /// 判断有无ammeterId /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateSigcontrolInfo(Expression <Func <TBL_SIGCONTROL, bool> > whereLambda, TBL_SIGCONTROL info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_SIGCONTROL> dataObject = db.TBL_SIGCONTROL.Where(whereLambda) as DbQuery <TBL_SIGCONTROL>; TBL_SIGCONTROL oldInfo = dataObject.FirstOrDefault(); oldInfo.ammeterSwistatus = info.ammeterSwistatus; oldInfo.sigcontrolIndtime = info.sigcontrolIndtime; oldInfo.sigcontrolInsstatime = info.sigcontrolInsstatime; oldInfo.sigcontrolInsendtime = info.sigcontrolInsendtime; oldInfo.sigcontrolAlacurup = info.sigcontrolAlacurup; oldInfo.sigcontrolAlacurlow = info.sigcontrolAlacurlow; db.SaveChanges(); return(true); } } catch { return(false); } }
/// <summary> /// 修改TBL_SYSSET表的数据 /// </summary> /// <param name="whereLambda"> (u=>u.syssetId == info.syssetId, info) == true </param> /// 判断有无syssetId /// <param name="info"> info是需要修改的信息 </param> /// <notice></notice> public static Boolean UpdateSyssetInfo(Expression <Func <TBL_SYSSET, bool> > whereLambda, TBL_SYSSET info) { try { using (LampNetEntities db = new LampNetEntities()) { DbQuery <TBL_SYSSET> dataObject = db.TBL_SYSSET.Where(whereLambda) as DbQuery <TBL_SYSSET>; TBL_SYSSET oldInfo = dataObject.FirstOrDefault(); oldInfo.syssetName = info.syssetName; oldInfo.syssetOpevalue = info.syssetOpevalue; oldInfo.syssetClovalue = info.syssetClovalue; oldInfo.syssetAlatime = info.syssetAlatime; oldInfo.syssetAlacurrent = info.syssetAlacurrent; oldInfo.syssetNote = info.syssetNote; db.SaveChanges(); return(true); } } catch { return(false); } }