/// <summary> /// 添加企业安全管理资料 /// </summary> /// <param name="safetyData"></param> public static void AddSafetyData(Model.SafetyData_SafetyData safetyData) { Model.SUBHSSEDB db = Funs.DB; Model.SafetyData_SafetyData newSafetyData = new Model.SafetyData_SafetyData { SafetyDataId = safetyData.SafetyDataId, MenuId = safetyData.MenuId, Code = safetyData.Code, Title = safetyData.Title, Score = safetyData.Score, Digit = safetyData.Digit, SupSafetyDataId = safetyData.SupSafetyDataId, IsEndLever = safetyData.IsEndLever, Remark = safetyData.Remark, CheckType = safetyData.CheckType, CheckTypeValue1 = safetyData.CheckTypeValue1, CheckTypeValue2 = safetyData.CheckTypeValue2, IsCheck = safetyData.IsCheck }; db.SafetyData_SafetyData.InsertOnSubmit(newSafetyData); db.SubmitChanges(); ///更新考核项 if (newSafetyData.IsCheck == true) { UpdateSafetyDataIsCheck(newSafetyData.SupSafetyDataId); } }
/// <summary> /// 修改企业安全管理资料 /// </summary> /// <param name="safetyData"></param> public static void UpdateSafetyData(Model.SafetyData_SafetyData safetyData) { Model.SUBHSSEDB db = Funs.DB; Model.SafetyData_SafetyData newSafetyData = db.SafetyData_SafetyData.FirstOrDefault(e => e.SafetyDataId == safetyData.SafetyDataId); if (newSafetyData != null) { newSafetyData.Code = safetyData.Code; newSafetyData.Title = safetyData.Title; newSafetyData.MenuId = safetyData.MenuId; newSafetyData.Score = safetyData.Score; newSafetyData.Digit = safetyData.Digit; newSafetyData.SupSafetyDataId = safetyData.SupSafetyDataId; newSafetyData.IsEndLever = safetyData.IsEndLever; newSafetyData.Remark = safetyData.Remark; newSafetyData.CheckType = safetyData.CheckType; newSafetyData.CheckTypeValue1 = safetyData.CheckTypeValue1; newSafetyData.CheckTypeValue2 = safetyData.CheckTypeValue2; newSafetyData.IsCheck = safetyData.IsCheck; db.SubmitChanges(); ///更新考核项 if (newSafetyData.IsCheck == true) { UpdateSafetyDataIsCheck(newSafetyData.SupSafetyDataId); } } }
/// <summary> /// 根据主键删除信息 /// </summary> /// <param name="safetyDataId"></param> public static void DeleteSafetyDataByID(string safetyDataId) { Model.SUBHSSEDB db = Funs.DB; Model.SafetyData_SafetyData SafetyData = db.SafetyData_SafetyData.FirstOrDefault(e => e.SafetyDataId == safetyDataId); { ///删除相应的计划总表 BLL.SafetyDataPlanService.DeleteSafetyDataPlanBySafetyDataId(safetyDataId); db.SafetyData_SafetyData.DeleteOnSubmit(SafetyData); db.SubmitChanges(); } }