public bool EditByTypeId(List <SystemFluidConfiguration> recordList, short typeId) { try { using (WanTaiEntities entities = new WanTaiEntities()) { var records = entities.SystemFluidConfigurations.Where(p => p.ItemType == typeId); foreach (SystemFluidConfiguration record in records) { entities.DeleteObject(record); } foreach (SystemFluidConfiguration record in recordList) { record.ItemID = WanTaiObjectService.NewSequentialGuid(); entities.AddToSystemFluidConfigurations(record); } entities.SaveChanges(); return(true); } } catch (Exception e) { string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace; LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "." + MethodBase.GetCurrentMethod(), SessionInfo.ExperimentID); return(false); } }
public bool Create(SystemFluidConfiguration record) { try { using (WanTaiEntities entities = new WanTaiEntities()) { entities.AddToSystemFluidConfigurations(record); entities.SaveChanges(); return(true); } } catch (Exception e) { string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace; LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "." + MethodBase.GetCurrentMethod(), SessionInfo.ExperimentID); return(false); } }