/// <summary> /// 修改试题信息 /// </summary> /// <param name="TrainingItem"></param> public static void UpdateTestTrainingItem(Model.Training_TestTrainingItem TestTrainingItem) { Model.SUBHSSEDB db = Funs.DB; Model.Training_TestTrainingItem newTestTrainingItem = db.Training_TestTrainingItem.FirstOrDefault(e => e.TrainingItemId == TestTrainingItem.TrainingItemId); if (newTestTrainingItem != null) { newTestTrainingItem.TrainingItemCode = TestTrainingItem.TrainingItemCode; newTestTrainingItem.TrainingItemName = TestTrainingItem.TrainingItemName; newTestTrainingItem.Abstracts = TestTrainingItem.Abstracts; newTestTrainingItem.AttachUrl = TestTrainingItem.AttachUrl; newTestTrainingItem.VersionNum = TestTrainingItem.VersionNum; newTestTrainingItem.TestType = TestTrainingItem.TestType; newTestTrainingItem.WorkPostIds = TestTrainingItem.WorkPostIds; newTestTrainingItem.WorkPostNames = TestTrainingItem.WorkPostNames; newTestTrainingItem.AItem = TestTrainingItem.AItem; newTestTrainingItem.BItem = TestTrainingItem.BItem; newTestTrainingItem.CItem = TestTrainingItem.CItem; newTestTrainingItem.DItem = TestTrainingItem.DItem; newTestTrainingItem.EItem = TestTrainingItem.EItem; newTestTrainingItem.AnswerItems = TestTrainingItem.AnswerItems; db.SubmitChanges(); } }
/// <summary> /// 修改特种设备作业人员资质 /// </summary> /// <param name="EquipmentPersonQuality"></param> public static void UpdateEquipmentPersonQuality(Model.QualityAudit_EquipmentPersonQuality EquipmentPersonQuality) { Model.SUBHSSEDB db = Funs.DB; Model.QualityAudit_EquipmentPersonQuality newEquipmentPersonQuality = db.QualityAudit_EquipmentPersonQuality.FirstOrDefault(e => e.EquipmentPersonQualityId == EquipmentPersonQuality.EquipmentPersonQualityId); if (newEquipmentPersonQuality != null) { newEquipmentPersonQuality.CertificateId = EquipmentPersonQuality.CertificateId; newEquipmentPersonQuality.CertificateNo = EquipmentPersonQuality.CertificateNo; newEquipmentPersonQuality.CertificateName = EquipmentPersonQuality.CertificateName; newEquipmentPersonQuality.Grade = EquipmentPersonQuality.Grade; newEquipmentPersonQuality.SendUnit = EquipmentPersonQuality.SendUnit; newEquipmentPersonQuality.SendDate = EquipmentPersonQuality.SendDate; newEquipmentPersonQuality.LimitDate = EquipmentPersonQuality.LimitDate; newEquipmentPersonQuality.LateCheckDate = EquipmentPersonQuality.LateCheckDate; newEquipmentPersonQuality.ApprovalPerson = EquipmentPersonQuality.ApprovalPerson; newEquipmentPersonQuality.Remark = EquipmentPersonQuality.Remark; newEquipmentPersonQuality.CompileMan = EquipmentPersonQuality.CompileMan; newEquipmentPersonQuality.CompileDate = EquipmentPersonQuality.CompileDate; newEquipmentPersonQuality.AuditDate = EquipmentPersonQuality.AuditDate; newEquipmentPersonQuality.AuditorId = EquipmentPersonQuality.AuditorId; db.SubmitChanges(); } }
/// <summary> /// 添加管理人员资质 /// </summary> /// <param name="ManagePersonQuality"></param> public static void AddManagePersonQuality(Model.QualityAudit_ManagePersonQuality ManagePersonQuality) { Model.SUBHSSEDB db = Funs.DB; Model.QualityAudit_ManagePersonQuality newManagePersonQuality = new Model.QualityAudit_ManagePersonQuality { ManagePersonQualityId = ManagePersonQuality.ManagePersonQualityId, PersonId = ManagePersonQuality.PersonId, CertificateNo = ManagePersonQuality.CertificateNo, CertificateName = ManagePersonQuality.CertificateName, Grade = ManagePersonQuality.Grade, SendUnit = ManagePersonQuality.SendUnit, SendDate = ManagePersonQuality.SendDate, LimitDate = ManagePersonQuality.LimitDate, LateCheckDate = ManagePersonQuality.LateCheckDate, ApprovalPerson = ManagePersonQuality.ApprovalPerson, Remark = ManagePersonQuality.Remark, CompileMan = ManagePersonQuality.CompileMan, CompileDate = ManagePersonQuality.CompileDate, AuditDate = ManagePersonQuality.AuditDate }; db.QualityAudit_ManagePersonQuality.InsertOnSubmit(newManagePersonQuality); db.SubmitChanges(); }
/// <summary> /// 项目菜单编码模板信息 /// </summary> /// <param name="codeTemplateRule"></param> public static void AddProjectData_CodeTemplateRule(Model.ProjectData_CodeTemplateRule codeTemplateRule) { Model.SUBHSSEDB db = Funs.DB; Model.ProjectData_CodeTemplateRule newCodeTemplateRule = new Model.ProjectData_CodeTemplateRule { CodeTemplateRuleId = SQLHelper.GetNewID(typeof(Model.ProjectData_CodeTemplateRule)), MenuId = codeTemplateRule.MenuId, ProjectId = codeTemplateRule.ProjectId, Template = codeTemplateRule.Template, Symbol = codeTemplateRule.Symbol, IsProjectCode = codeTemplateRule.IsProjectCode, Prefix = codeTemplateRule.Prefix, IsUnitCode = codeTemplateRule.IsUnitCode, Digit = codeTemplateRule.Digit, OwerSymbol = codeTemplateRule.OwerSymbol, OwerIsProjectCode = codeTemplateRule.OwerIsProjectCode, OwerPrefix = codeTemplateRule.OwerPrefix, OwerIsUnitCode = codeTemplateRule.OwerIsUnitCode, OwerDigit = codeTemplateRule.OwerDigit }; db.ProjectData_CodeTemplateRule.InsertOnSubmit(newCodeTemplateRule); db.SubmitChanges(); }
/// <summary> /// 修改安全专项检查 /// </summary> /// <param name="checkSpecial"></param> public static void UpdateCheckSpecial(Model.Check_CheckSpecial checkSpecial) { Model.SUBHSSEDB db = Funs.DB; Model.Check_CheckSpecial newCheckSpecial = db.Check_CheckSpecial.FirstOrDefault(e => e.CheckSpecialId == checkSpecial.CheckSpecialId); if (newCheckSpecial != null) { newCheckSpecial.CheckSpecialCode = checkSpecial.CheckSpecialCode; //newCheckSpecial.ProjectId = checkSpecial.ProjectId; newCheckSpecial.CheckPerson = checkSpecial.CheckPerson; newCheckSpecial.CheckTime = checkSpecial.CheckTime; newCheckSpecial.ScanUrl = checkSpecial.ScanUrl; newCheckSpecial.DaySummary = checkSpecial.DaySummary; newCheckSpecial.PartInUnits = checkSpecial.PartInUnits; newCheckSpecial.PartInPersons = checkSpecial.PartInPersons; newCheckSpecial.PartInPersonIds = checkSpecial.PartInPersonIds; newCheckSpecial.PartInPersonNames = checkSpecial.PartInPersonNames; newCheckSpecial.CheckAreas = checkSpecial.CheckAreas; newCheckSpecial.States = checkSpecial.States; newCheckSpecial.CheckType = checkSpecial.CheckType; newCheckSpecial.CheckItemSetId = checkSpecial.CheckItemSetId; db.SubmitChanges(); } }
/// <summary> /// 修改安全监督检查整改 /// </summary> /// <param name="UpCheckReport"></param> public static void UpdateUpCheckReport(Model.Supervise_UpCheckReport UpCheckReport) { Model.SUBHSSEDB db = Funs.DB; Model.Supervise_UpCheckReport newUpCheckReport = db.Supervise_UpCheckReport.FirstOrDefault(e => e.UpCheckReportId == UpCheckReport.UpCheckReportId); if (newUpCheckReport != null) { newUpCheckReport.UnitId = UpCheckReport.UnitId; newUpCheckReport.CheckStartTime = UpCheckReport.CheckStartTime; newUpCheckReport.CheckEndTime = UpCheckReport.CheckEndTime; newUpCheckReport.Values1 = UpCheckReport.Values1; newUpCheckReport.Values2 = UpCheckReport.Values2; newUpCheckReport.Values3 = UpCheckReport.Values3; newUpCheckReport.Values4 = UpCheckReport.Values4; newUpCheckReport.Values5 = UpCheckReport.Values5; newUpCheckReport.Values6 = UpCheckReport.Values6; newUpCheckReport.Values7 = UpCheckReport.Values7; newUpCheckReport.CompileDate = UpCheckReport.CompileDate; newUpCheckReport.AuditDate = UpCheckReport.AuditDate; newUpCheckReport.UpState = UpCheckReport.UpState; newUpCheckReport.UpDateTime = UpCheckReport.UpDateTime; db.SubmitChanges(); } }
/// <summary> /// 添加法律法规 /// </summary> /// <param name="lawRegulationList"></param> public static void AddLawRegulationList(Model.Law_LawRegulationList lawRegulationList) { Model.SUBHSSEDB db = Funs.DB; Model.Law_LawRegulationList newLawRegulationList = new Model.Law_LawRegulationList { LawRegulationId = lawRegulationList.LawRegulationId, LawRegulationCode = lawRegulationList.LawRegulationCode, LawRegulationName = lawRegulationList.LawRegulationName, ApprovalDate = lawRegulationList.ApprovalDate, EffectiveDate = lawRegulationList.EffectiveDate, Description = lawRegulationList.Description, AttachUrl = lawRegulationList.AttachUrl, LawsRegulationsTypeId = lawRegulationList.LawsRegulationsTypeId, CompileMan = lawRegulationList.CompileMan, CompileDate = lawRegulationList.CompileDate, UnitId = lawRegulationList.UnitId, IsPass = lawRegulationList.IsPass, UpState = lawRegulationList.UpState, IsBuild = false }; db.Law_LawRegulationList.InsertOnSubmit(newLawRegulationList); db.SubmitChanges(); }
/// <summary> /// 添加气瓶出场报批 /// </summary> /// <param name="gasCylinderOut"></param> public static void AddGasCylinderOut(Model.InApproveManager_GasCylinderOut gasCylinderOut) { Model.SUBHSSEDB db = Funs.DB; Model.InApproveManager_GasCylinderOut newGasCylinderOut = new Model.InApproveManager_GasCylinderOut { GasCylinderOutId = gasCylinderOut.GasCylinderOutId, ProjectId = gasCylinderOut.ProjectId, GasCylinderOutCode = gasCylinderOut.GasCylinderOutCode, UnitId = gasCylinderOut.UnitId, OutDate = gasCylinderOut.OutDate, OutTime = gasCylinderOut.OutTime, DriverName = gasCylinderOut.DriverName, DriverNum = gasCylinderOut.DriverNum, CarNum = gasCylinderOut.CarNum, LeaderName = gasCylinderOut.LeaderName, States = gasCylinderOut.States, CompileMan = gasCylinderOut.CompileMan, CompileDate = gasCylinderOut.CompileDate }; db.InApproveManager_GasCylinderOut.InsertOnSubmit(newGasCylinderOut); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GasCylinderOutMenuId, gasCylinderOut.ProjectId, null, gasCylinderOut.GasCylinderOutId, gasCylinderOut.CompileDate); }
/// <summary> /// 根据主键删除处罚通知单 /// </summary> /// <param name="punishNoticeId"></param> public static void DeletePunishNoticeById(string punishNoticeId) { Model.SUBHSSEDB db = Funs.DB; Model.Check_PunishNotice punishNotice = db.Check_PunishNotice.FirstOrDefault(e => e.PunishNoticeId == punishNoticeId); if (punishNotice != null) { CodeRecordsService.DeleteCodeRecordsByDataId(punishNoticeId); UploadFileService.DeleteFile(Funs.RootPath, punishNotice.AttachUrl); ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == punishNotice.PunishNoticeId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(punishNotice.ProjectId, item.OperaterId, item.OperaterTime, "211", "处罚通知单", Const.BtnDelete, 1); } ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(punishNotice.PunishNoticeId); } db.Check_PunishNotice.DeleteOnSubmit(punishNotice); db.SubmitChanges(); } }
/// <summary> /// 增加危险源辨识与评价清单信息 /// </summary> /// <param name="hazardList">危险源辨识与评价清单实体</param> public static void AddHazardList(Model.Hazard_HazardList hazardList) { Model.SUBHSSEDB db = Funs.DB; Model.Hazard_HazardList newHazardList = new Model.Hazard_HazardList { HazardListId = hazardList.HazardListId, HazardListCode = hazardList.HazardListCode, ProjectId = hazardList.ProjectId, VersionNo = hazardList.VersionNo, CompileMan = hazardList.CompileMan, CompileDate = hazardList.CompileDate, States = hazardList.States, WorkStage = hazardList.WorkStage, Contents = hazardList.Contents, WorkAreaName = hazardList.WorkAreaName, IdentificationDate = hazardList.IdentificationDate, ControllingPerson = hazardList.ControllingPerson }; Funs.DB.Hazard_HazardList.InsertOnSubmit(newHazardList); Funs.DB.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectHazardListMenuId, hazardList.ProjectId, null, hazardList.HazardListId, hazardList.CompileDate); }
/// <summary> /// 根据主键删除施工机具、安全设施检查验收 /// </summary> /// <param name="equipmentSafetyListId"></param> public static void DeleteEquipmentSafetyListById(string equipmentSafetyListId) { Model.SUBHSSEDB db = Funs.DB; Model.License_EquipmentSafetyList equipmentSafetyList = db.License_EquipmentSafetyList.FirstOrDefault(e => e.EquipmentSafetyListId == equipmentSafetyListId); if (equipmentSafetyList != null) { BLL.CodeRecordsService.DeleteCodeRecordsByDataId(equipmentSafetyListId); //删除编号 BLL.CommonService.DeleteAttachFileById(equipmentSafetyListId); //删除附件 ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == equipmentSafetyList.EquipmentSafetyListId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(equipmentSafetyList.ProjectId, item.OperaterId, item.OperaterTime, "24", equipmentSafetyList.EquipmentSafetyListName, Const.BtnDelete, 1); } ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(equipmentSafetyList.EquipmentSafetyListId); } db.License_EquipmentSafetyList.DeleteOnSubmit(equipmentSafetyList); db.SubmitChanges(); } }
/// <summary> /// 根据月报告主键获取年度累计实际支出 /// </summary> /// <param name="unitId">单位主键</param> /// <param name="monthReportId">月报告主键</param> /// <returns></returns> //public static decimal? GetSumYearRealCostByMonthReportId(string monthReportId, string unitId) //{ // return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId && x.UnitId == unitId select x.YearRealCost).FirstOrDefault(); //} /// <summary> /// 根据月报告主键获取总累计实际支出 /// </summary> /// <param name="unitId">单位主键</param> /// <param name="monthReportId">月报告主键</param> /// <returns></returns> //public static decimal? GetSumTotalRealCostByMonthReportId(string monthReportId, string unitId) //{ // return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId && x.UnitId == unitId select x.TotalRealCost).FirstOrDefault(); //} /// <summary> /// 增加月报告HSE技术措施费用信息 /// </summary> /// <param name="hseCost">月报告HSE技术措施费用实体</param> public static void AddHseCost(Model.Manager_HseCostB hseCost) { Model.SUBHSSEDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_HseCostB)); Model.Manager_HseCostB newHseCost = new Model.Manager_HseCostB { HseCostId = newKeyID, MonthReportId = hseCost.MonthReportId, UnitId = hseCost.UnitId, PlanCostA = hseCost.PlanCostA, PlanCostB = hseCost.PlanCostB, RealCostA = hseCost.RealCostA, ProjectRealCostA = hseCost.ProjectRealCostA, RealCostB = hseCost.RealCostB, ProjectRealCostB = hseCost.ProjectRealCostB, RealCostAB = hseCost.RealCostAB, ProjectRealCostAB = hseCost.ProjectRealCostAB }; db.Manager_HseCostB.InsertOnSubmit(newHseCost); db.SubmitChanges(); }
/// <summary> /// 根据TestRecordId 提交试卷 /// </summary> /// <param name="testRecordId"></param> public static decimal getSubmitTestRecord(Model.Training_TestRecord testRecord) { decimal getCode = 0; using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecord.TestRecordId); /////试卷 if (getTestRecord.TestStartTime.HasValue) { getTestRecord.TestEndTime = DateTime.Now; var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId); if (getRItem.Count() > 0) { getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore); } db.SubmitChanges(); getCode = getTestRecord.TestScores ?? 0; } } return(getCode); }
/// <summary> /// 添加安全费用管理 /// </summary> /// <param name="hsseCostManage"></param> public static void AddHSSECostManage(Model.CostGoods_HSSECostManage hsseCostManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage { HSSECostManageId = hsseCostManage.HSSECostManageId, ProjectId = hsseCostManage.ProjectId, Month = hsseCostManage.Month, Code = hsseCostManage.Code, ReportDate = hsseCostManage.ReportDate, MainIncome = hsseCostManage.MainIncome, Remark1 = hsseCostManage.Remark1, ConstructionIncome = hsseCostManage.ConstructionIncome, Remark2 = hsseCostManage.Remark2, SafetyCosts = hsseCostManage.SafetyCosts, Remark3 = hsseCostManage.Remark3, CompileDate = hsseCostManage.CompileDate, CompileManId = hsseCostManage.CompileManId, }; db.CostGoods_HSSECostManage.InsertOnSubmit(newHSSECostManage); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectHSSECostManageMenuId, hsseCostManage.ProjectId, null, hsseCostManage.HSSECostManageId, hsseCostManage.Month); }
/// <summary> /// 修改安全季节性/节假日检查 /// </summary> /// <param name="checkHoliday"></param> public static void UpdateCheckHoliday(Model.Check_CheckHoliday checkHoliday) { Model.SUBHSSEDB db = Funs.DB; Model.Check_CheckHoliday newCheckHoliday = db.Check_CheckHoliday.FirstOrDefault(e => e.CheckHolidayId == checkHoliday.CheckHolidayId); if (newCheckHoliday != null) { newCheckHoliday.Area = checkHoliday.Area; newCheckHoliday.CheckTime = checkHoliday.CheckTime; newCheckHoliday.ThisUnitId = checkHoliday.ThisUnitId; newCheckHoliday.MainUnitPerson = checkHoliday.MainUnitPerson; newCheckHoliday.SubUnits = checkHoliday.SubUnits; newCheckHoliday.SubUnitPerson = checkHoliday.SubUnitPerson; newCheckHoliday.PartInPersonNames = checkHoliday.PartInPersonNames; newCheckHoliday.MainUnitDeputy = checkHoliday.MainUnitDeputy; newCheckHoliday.SubUnitDeputy = checkHoliday.SubUnitDeputy; newCheckHoliday.MainUnitDeputyDate = checkHoliday.MainUnitDeputyDate; newCheckHoliday.SubUnitDeputyDate = checkHoliday.SubUnitDeputyDate; newCheckHoliday.AttachUrl = checkHoliday.AttachUrl; newCheckHoliday.IsCompleted = checkHoliday.IsCompleted; newCheckHoliday.States = checkHoliday.States; db.SubmitChanges(); } }
/// <summary> /// 修改监督评价报告 /// </summary> /// <param name="subUnitCheckRectify"></param> public static void UpdateSubUnitCheckRectify(Model.Supervise_SubUnitCheckRectify subUnitCheckRectify) { Model.SUBHSSEDB db = Funs.DB; Model.Supervise_SubUnitCheckRectify newSubUnitCheckRectify = db.Supervise_SubUnitCheckRectify.FirstOrDefault(e => e.SubUnitCheckRectifyId == subUnitCheckRectify.SubUnitCheckRectifyId); if (newSubUnitCheckRectify != null) { newSubUnitCheckRectify.UnitId = subUnitCheckRectify.UnitId; newSubUnitCheckRectify.CheckRectType = subUnitCheckRectify.CheckRectType; newSubUnitCheckRectify.Values1 = subUnitCheckRectify.Values1; newSubUnitCheckRectify.Values2 = subUnitCheckRectify.Values2; newSubUnitCheckRectify.Values3 = subUnitCheckRectify.Values3; newSubUnitCheckRectify.Values4 = subUnitCheckRectify.Values4; newSubUnitCheckRectify.Values5 = subUnitCheckRectify.Values5; newSubUnitCheckRectify.Values6 = subUnitCheckRectify.Values6; newSubUnitCheckRectify.Values7 = subUnitCheckRectify.Values7; newSubUnitCheckRectify.Values8 = subUnitCheckRectify.Values8; newSubUnitCheckRectify.AttachUrl = subUnitCheckRectify.AttachUrl; newSubUnitCheckRectify.UpDateTime = subUnitCheckRectify.UpDateTime; newSubUnitCheckRectify.UpState = subUnitCheckRectify.UpState; newSubUnitCheckRectify.CheckEndDate = subUnitCheckRectify.CheckEndDate; db.SubmitChanges(); } }
/// <summary> /// 增加图片信息 /// </summary> /// <param name="personQuality">图片实体</param> public static void AddNotice(Model.InformationProject_Notice Notice) { Model.SUBHSSEDB db = Funs.DB; Model.InformationProject_Notice newNotice = new Model.InformationProject_Notice { NoticeId = Notice.NoticeId, NoticeCode = Notice.NoticeCode, ProjectId = Notice.ProjectId, NoticeTitle = Notice.NoticeTitle, MainContent = Notice.MainContent, CompileMan = Notice.CompileMan, CompileDate = Notice.CompileDate, IsRelease = Notice.IsRelease, ReleaseDate = Notice.ReleaseDate, States = Notice.States, AccessProjectId = Notice.AccessProjectId, AccessProjectText = Notice.AccessProjectText }; db.InformationProject_Notice.InsertOnSubmit(newNotice); db.SubmitChanges(); if (!string.IsNullOrEmpty(Notice.ProjectId)) { if (Notice.NoticeCode == BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectNoticeMenuId, Notice.ProjectId, null)) { ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectNoticeMenuId, Notice.ProjectId, null, Notice.NoticeId, Notice.CompileDate); } } else { if (Notice.NoticeCode == BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ServerNoticeMenuId, Notice.ProjectId, null)) { BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ServerNoticeMenuId, Notice.ProjectId, null, Notice.NoticeId, Notice.CompileDate); } } }
/// <summary> /// 修改百万工时安全统计月报表明细表 /// </summary> /// <param name="MillionsMonthlyReportItem">百万工时安全统计月报表明细表实体</param> public static void UpdateMillionsMonthlyReportItem(Model.Information_MillionsMonthlyReportItem MillionsMonthlyReportItem) { Model.SUBHSSEDB db = Funs.DB; Model.Information_MillionsMonthlyReportItem newMillionsMonthlyReportItem = db.Information_MillionsMonthlyReportItem.FirstOrDefault(e => e.MillionsMonthlyReportItemId == MillionsMonthlyReportItem.MillionsMonthlyReportItemId); newMillionsMonthlyReportItem.SortIndex = MillionsMonthlyReportItem.SortIndex; newMillionsMonthlyReportItem.Affiliation = MillionsMonthlyReportItem.Affiliation; newMillionsMonthlyReportItem.Name = MillionsMonthlyReportItem.Name; newMillionsMonthlyReportItem.PostPersonNum = MillionsMonthlyReportItem.PostPersonNum; newMillionsMonthlyReportItem.SnapPersonNum = MillionsMonthlyReportItem.SnapPersonNum; newMillionsMonthlyReportItem.ContractorNum = MillionsMonthlyReportItem.ContractorNum; newMillionsMonthlyReportItem.SumPersonNum = MillionsMonthlyReportItem.SumPersonNum; newMillionsMonthlyReportItem.TotalWorkNum = MillionsMonthlyReportItem.TotalWorkNum; newMillionsMonthlyReportItem.SeriousInjuriesNum = MillionsMonthlyReportItem.SeriousInjuriesNum; newMillionsMonthlyReportItem.SeriousInjuriesPersonNum = MillionsMonthlyReportItem.SeriousInjuriesPersonNum; newMillionsMonthlyReportItem.SeriousInjuriesLossHour = MillionsMonthlyReportItem.SeriousInjuriesLossHour; newMillionsMonthlyReportItem.MinorAccidentNum = MillionsMonthlyReportItem.MinorAccidentNum; newMillionsMonthlyReportItem.MinorAccidentPersonNum = MillionsMonthlyReportItem.MinorAccidentPersonNum; newMillionsMonthlyReportItem.MinorAccidentLossHour = MillionsMonthlyReportItem.MinorAccidentLossHour; newMillionsMonthlyReportItem.OtherAccidentNum = MillionsMonthlyReportItem.OtherAccidentNum; newMillionsMonthlyReportItem.OtherAccidentPersonNum = MillionsMonthlyReportItem.OtherAccidentPersonNum; newMillionsMonthlyReportItem.OtherAccidentLossHour = MillionsMonthlyReportItem.OtherAccidentLossHour; newMillionsMonthlyReportItem.RestrictedWorkPersonNum = MillionsMonthlyReportItem.RestrictedWorkPersonNum; newMillionsMonthlyReportItem.RestrictedWorkLossHour = MillionsMonthlyReportItem.RestrictedWorkLossHour; newMillionsMonthlyReportItem.MedicalTreatmentPersonNum = MillionsMonthlyReportItem.MedicalTreatmentPersonNum; newMillionsMonthlyReportItem.MedicalTreatmentLossHour = MillionsMonthlyReportItem.MedicalTreatmentLossHour; newMillionsMonthlyReportItem.FireNum = MillionsMonthlyReportItem.FireNum; newMillionsMonthlyReportItem.ExplosionNum = MillionsMonthlyReportItem.ExplosionNum; newMillionsMonthlyReportItem.TrafficNum = MillionsMonthlyReportItem.TrafficNum; newMillionsMonthlyReportItem.EquipmentNum = MillionsMonthlyReportItem.EquipmentNum; newMillionsMonthlyReportItem.QualityNum = MillionsMonthlyReportItem.QualityNum; newMillionsMonthlyReportItem.OtherNum = MillionsMonthlyReportItem.OtherNum; newMillionsMonthlyReportItem.FirstAidDressingsNum = MillionsMonthlyReportItem.FirstAidDressingsNum; newMillionsMonthlyReportItem.AttemptedEventNum = MillionsMonthlyReportItem.AttemptedEventNum; newMillionsMonthlyReportItem.LossDayNum = MillionsMonthlyReportItem.LossDayNum; db.SubmitChanges(); }
/// <summary> /// 增加职工伤亡事故原因分析报表 /// </summary> /// <param name="AccidentCauseReport">职工伤亡事故原因分析报表实体</param> public static void AddAccidentCauseReport(Model.Information_AccidentCauseReport AccidentCauseReport) { Model.SUBHSSEDB db = Funs.DB; Model.Information_AccidentCauseReport newAccidentCauseReport = new Model.Information_AccidentCauseReport { AccidentCauseReportId = AccidentCauseReport.AccidentCauseReportId, AccidentCauseReportCode = AccidentCauseReport.AccidentCauseReportCode, Year = AccidentCauseReport.Year, Month = AccidentCauseReport.Month, UnitId = AccidentCauseReport.UnitId, DeathAccident = AccidentCauseReport.DeathAccident, DeathToll = AccidentCauseReport.DeathToll, InjuredAccident = AccidentCauseReport.InjuredAccident, InjuredToll = AccidentCauseReport.InjuredToll, MinorWoundAccident = AccidentCauseReport.MinorWoundAccident, MinorWoundToll = AccidentCauseReport.MinorWoundToll, AverageTotalHours = AccidentCauseReport.AverageTotalHours, AverageManHours = AccidentCauseReport.AverageManHours, TotalLossMan = AccidentCauseReport.TotalLossMan, LastMonthLossHoursTotal = AccidentCauseReport.LastMonthLossHoursTotal, KnockOffTotal = AccidentCauseReport.KnockOffTotal, DirectLoss = AccidentCauseReport.DirectLoss, IndirectLosses = AccidentCauseReport.IndirectLosses, TotalLoss = AccidentCauseReport.TotalLoss, TotalLossTime = AccidentCauseReport.TotalLossTime, FillCompanyPersonCharge = AccidentCauseReport.FillCompanyPersonCharge, TabPeople = AccidentCauseReport.TabPeople, FillingDate = AccidentCauseReport.FillingDate, AuditPerson = AccidentCauseReport.AuditPerson, UpState = AccidentCauseReport.UpState, HandleState = AccidentCauseReport.HandleState, HandleMan = AccidentCauseReport.HandleMan }; db.Information_AccidentCauseReport.InsertOnSubmit(newAccidentCauseReport); db.SubmitChanges(); }
/// <summary> /// 添加安全隐患通知单 /// </summary> /// <param name="rectifyNotice"></param> public static void AddRectifyNotice(Model.Check_RectifyNotice rectifyNotice) { Model.SUBHSSEDB db = Funs.DB; Model.Check_RectifyNotice newRectifyNotice = new Model.Check_RectifyNotice { RectifyNoticeId = rectifyNotice.RectifyNoticeId, RectifyNoticeCode = rectifyNotice.RectifyNoticeCode, ProjectId = rectifyNotice.ProjectId, UnitId = rectifyNotice.UnitId, CheckArea = rectifyNotice.CheckArea, CheckedTime = rectifyNotice.CheckedTime, WrongContent = rectifyNotice.WrongContent, SignPerson = rectifyNotice.SignPerson, RectifyLimit = rectifyNotice.RectifyLimit, CompleteStatus = rectifyNotice.CompleteStatus, DutyPerson = rectifyNotice.DutyPerson, CompleteDate = rectifyNotice.CompleteDate, IsRectify = rectifyNotice.IsRectify, CheckPerson = rectifyNotice.CheckPerson, AttachUrl1 = rectifyNotice.AttachUrl1, AttachUrl2 = rectifyNotice.AttachUrl2, AttachUrl3 = rectifyNotice.AttachUrl3, ChangeContent = rectifyNotice.ChangeContent, HSEManager = rectifyNotice.HSEManager, ChangeDate = rectifyNotice.ChangeDate, CheckDate = rectifyNotice.CheckDate, CheckStation = rectifyNotice.CheckStation, States = rectifyNotice.States, CompileMan = rectifyNotice.CompileMan, RectifyType = rectifyNotice.RectifyType, RectifyState = rectifyNotice.RectifyState }; db.Check_RectifyNotice.InsertOnSubmit(newRectifyNotice); db.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectRectifyNoticeMenuId, rectifyNotice.ProjectId, null, rectifyNotice.RectifyNoticeId, rectifyNotice.CheckedTime); }
/// <summary> /// 添加安全费用管理 /// </summary> /// <param name="costManage"></param> public static void AddCostManage(Model.CostGoods_CostManage costManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_CostManage newCostManage = new Model.CostGoods_CostManage { CostManageId = costManage.CostManageId, ProjectId = costManage.ProjectId, CostManageCode = costManage.CostManageCode, CostManageName = costManage.CostManageName, UnitId = costManage.UnitId, ContractNum = costManage.ContractNum, CostManageDate = costManage.CostManageDate, Opinion = costManage.Opinion, SubCN = costManage.SubCN, SubHSE = costManage.SubHSE, SubProject = costManage.SubProject, States = costManage.States, CompileMan = costManage.CompileMan, CompileDate = costManage.CompileDate }; db.CostGoods_CostManage.InsertOnSubmit(newCostManage); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectCostManageMenuId, costManage.ProjectId, null, costManage.CostManageId, costManage.CompileDate); }
/// <summary> /// 修改安全危险观察登记 /// </summary> /// <param name="registration"></param> public static void UpdateRegistration(Model.Hazard_Registration registration) { Model.SUBHSSEDB db = Funs.DB; Model.Hazard_Registration newRegistration = db.Hazard_Registration.FirstOrDefault(e => e.RegistrationId == registration.RegistrationId); if (newRegistration != null) { newRegistration.WorkAreaId = registration.WorkAreaId; newRegistration.ProblemDescription = registration.ProblemDescription; newRegistration.ProblemTypes = registration.ProblemTypes; newRegistration.TakeSteps = registration.TakeSteps; newRegistration.ResponsibilityUnitId = registration.ResponsibilityUnitId; newRegistration.ResponsibilityManId = registration.ResponsibilityManId; newRegistration.RectificationPeriod = registration.RectificationPeriod; newRegistration.CheckTime = registration.CheckTime; newRegistration.ImageUrl = registration.ImageUrl; newRegistration.RectificationImageUrl = registration.RectificationImageUrl; newRegistration.States = registration.States; newRegistration.RectificationTime = registration.RectificationTime; newRegistration.State = registration.State; newRegistration.HazardCode = registration.HazardCode; newRegistration.DefectsType = registration.DefectsType; newRegistration.MayLeadAccidents = registration.MayLeadAccidents; newRegistration.IsEffective = registration.IsEffective; newRegistration.RectificationRemark = registration.RectificationRemark; newRegistration.ConfirmMan = registration.ConfirmMan; newRegistration.ConfirmDate = registration.ConfirmDate; newRegistration.HandleIdea = registration.HandleIdea; db.SubmitChanges(); if (string.IsNullOrEmpty(BLL.CodeRecordsService.ReturnCodeByDataId(registration.RegistrationId))) { ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.HazardRegisterMenuId, registration.ProjectId, null, registration.RegistrationId, registration.CheckTime); } } }
/// <summary> /// 更新没有结束时间且超时的考试记录 /// </summary> public static int UpdateTestEndTimeNull(string testRecordId) { int icount = 0; using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { var testRecord = from x in db.Training_TestRecord where !x.TestEndTime.HasValue && x.TestStartTime.HasValue && x.TestStartTime.Value.AddMinutes(x.Duration) < DateTime.Now && x.TestRecordId == testRecordId select x; if (testRecord.Count() > 0) { foreach (var item in testRecord) { item.TestEndTime = item.TestStartTime.Value.AddMinutes(item.Duration); item.TestScores = db.Training_TestRecordItem.Where(x => x.TestRecordId == item.TestRecordId).Sum(x => x.SubjectScore) ?? 0; db.SubmitChanges(); icount++; } } } return(icount); }
///// <summary> ///// 根据菜单id获取企业安全管理资料 ///// </summary> ///// <param name="appraise"></param> ///// <returns></returns> //public static Model.SafetyDataE_SafetyDataE GetSafetyDataEByMenuId(string menuid) //{ // return Funs.DB.SafetyDataE_SafetyDataE.FirstOrDefault(x => x.MenuId == menuid && x.IsCheck == true); //} /// <summary> /// 添加企业安全管理资料 /// </summary> /// <param name="SafetyDataE"></param> public static void AddSafetyDataE(Model.SafetyDataE_SafetyDataE SafetyDataE) { Model.SUBHSSEDB db = Funs.DB; Model.SafetyDataE_SafetyDataE newSafetyDataE = new Model.SafetyDataE_SafetyDataE { SafetyDataEId = SafetyDataE.SafetyDataEId, Code = SafetyDataE.Code, Title = SafetyDataE.Title, Score = SafetyDataE.Score, Digit = SafetyDataE.Digit, SupSafetyDataEId = SafetyDataE.SupSafetyDataEId, IsEndLever = SafetyDataE.IsEndLever, Remark = SafetyDataE.Remark, IsCheck = SafetyDataE.IsCheck }; db.SafetyDataE_SafetyDataE.InsertOnSubmit(newSafetyDataE); db.SubmitChanges(); ///更新考核项 if (newSafetyDataE.IsCheck == true) { UpdateSafetyDataEIsCheck(newSafetyDataE.SupSafetyDataEId); } }
/// <summary> /// 根据主键删除专题例会 /// </summary> /// <param name="specialMeetingId"></param> public static void DeleteSpecialMeetingById(string specialMeetingId) { Model.SUBHSSEDB db = Funs.DB; Model.Meeting_SpecialMeeting spcialMeeting = db.Meeting_SpecialMeeting.FirstOrDefault(e => e.SpecialMeetingId == specialMeetingId); if (spcialMeeting != null) { ///删除编码表记录 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(specialMeetingId); BLL.CommonService.DeleteAttachFileById(specialMeetingId);//删除附件 ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == spcialMeeting.SpecialMeetingId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(spcialMeeting.ProjectId, item.OperaterId, item.OperaterTime, "28", "专题会议", Const.BtnDelete, 1); } ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(spcialMeeting.SpecialMeetingId); } db.Meeting_SpecialMeeting.DeleteOnSubmit(spcialMeeting); db.SubmitChanges(); } }
/// <summary> /// 修改人员信息 /// </summary> /// <param name="user">人员实体</param> public static void UpdateUser(Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; Model.Sys_User newUser = db.Sys_User.FirstOrDefault(e => e.UserId == user.UserId); if (newUser != null) { newUser.Account = user.Account; newUser.UserName = user.UserName; newUser.UserCode = user.UserCode; if (!string.IsNullOrEmpty(user.Password)) { newUser.Password = user.Password; } newUser.IdentityCard = user.IdentityCard; newUser.UnitId = user.UnitId; newUser.RoleId = user.RoleId; newUser.IsPost = user.IsPost; newUser.IsOffice = user.IsOffice; newUser.Telephone = user.Telephone; newUser.SignatureUrl = user.SignatureUrl; newUser.DepartId = user.DepartId; db.SubmitChanges(); } }
/// <summary> /// 修改安全开工前检查 /// </summary> /// <param name="checkWork"></param> public static void UpdateCheckWork(Model.Check_CheckWork checkWork) { Model.SUBHSSEDB db = Funs.DB; Model.Check_CheckWork newCheckWork = db.Check_CheckWork.FirstOrDefault(e => e.CheckWorkId == checkWork.CheckWorkId); if (newCheckWork != null) { newCheckWork.Area = checkWork.Area; newCheckWork.CheckTime = checkWork.CheckTime; newCheckWork.ThisUnitId = checkWork.ThisUnitId; newCheckWork.MainUnitPerson = checkWork.MainUnitPerson; newCheckWork.SubUnits = checkWork.SubUnits; newCheckWork.SubUnitPerson = checkWork.SubUnitPerson; newCheckWork.PartInPersonNames = checkWork.PartInPersonNames; newCheckWork.MainUnitDeputy = checkWork.MainUnitDeputy; newCheckWork.SubUnitDeputy = checkWork.SubUnitDeputy; newCheckWork.MainUnitDeputyDate = checkWork.MainUnitDeputyDate; newCheckWork.SubUnitDeputyDate = checkWork.SubUnitDeputyDate; newCheckWork.AttachUrl = checkWork.AttachUrl; newCheckWork.IsCompleted = checkWork.IsCompleted; newCheckWork.States = checkWork.States; newCheckWork.IsAgree = checkWork.IsAgree; db.SubmitChanges(); } }
/// <summary> /// 添加普通货物出场报批 /// </summary> /// <param name="goodsOut"></param> public static void AddGoodsOut(Model.InApproveManager_GoodsOut goodsOut) { Model.SUBHSSEDB db = Funs.DB; Model.InApproveManager_GoodsOut newGoodsOut = new Model.InApproveManager_GoodsOut { GoodsOutId = goodsOut.GoodsOutId, ProjectId = goodsOut.ProjectId, GoodsOutCode = goodsOut.GoodsOutCode, UnitId = goodsOut.UnitId, OutDate = goodsOut.OutDate, OutTime = goodsOut.OutTime, CarNum = goodsOut.CarNum, CarModel = goodsOut.CarModel, StartPlace = goodsOut.StartPlace, EndPlace = goodsOut.EndPlace, States = goodsOut.States, CompileMan = goodsOut.CompileMan, CompileDate = goodsOut.CompileDate }; db.InApproveManager_GoodsOut.InsertOnSubmit(newGoodsOut); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GoodsOutMenuId, goodsOut.ProjectId, null, goodsOut.GoodsOutId, goodsOut.CompileDate); }
/// <summary> /// 修改综合检查明细信息 /// </summary> /// <param name="CheckColligationDetail"></param> public static void UpdateCheckColligationDetail(Model.Check_CheckColligationDetail CheckColligationDetail) { Model.SUBHSSEDB db = Funs.DB; var newCheckColligationDetail = db.Check_CheckColligationDetail.FirstOrDefault(x => x.CheckColligationDetailId == CheckColligationDetail.CheckColligationDetailId); if (newCheckColligationDetail != null) { newCheckColligationDetail.Unqualified = CheckColligationDetail.Unqualified; newCheckColligationDetail.CheckArea = CheckColligationDetail.CheckArea; newCheckColligationDetail.UnitId = CheckColligationDetail.UnitId; newCheckColligationDetail.HandleStep = CheckColligationDetail.HandleStep; newCheckColligationDetail.CompleteStatus = CheckColligationDetail.CompleteStatus; newCheckColligationDetail.RectifyNoticeId = CheckColligationDetail.RectifyNoticeId; newCheckColligationDetail.LimitedDate = CheckColligationDetail.LimitedDate; newCheckColligationDetail.CompletedDate = CheckColligationDetail.CompletedDate; newCheckColligationDetail.Suggestions = CheckColligationDetail.Suggestions; newCheckColligationDetail.WorkArea = CheckColligationDetail.WorkArea; newCheckColligationDetail.CheckContent = CheckColligationDetail.CheckContent; newCheckColligationDetail.HiddenDangerType = CheckColligationDetail.HiddenDangerType; newCheckColligationDetail.HiddenDangerLevel = CheckColligationDetail.HiddenDangerLevel; newCheckColligationDetail.PersonId = CheckColligationDetail.PersonId; db.SubmitChanges(); } }
/// <summary> /// 根据PlanId、PersonId将人员加入培训任务 /// </summary> /// <param name="planId">培训计划ID</param> /// <param name="personId">人员ID</param> /// <returns></returns> public static void getTrainingTaskByPlanIdPersonId(string planId, string personId) { using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { var plan = db.Training_Plan.FirstOrDefault(e => e.PlanId == planId); Model.Training_Task newTask = new Model.Training_Task { TaskId = SQLHelper.GetNewID(), PlanId = planId, UserId = personId, TaskDate = DateTime.Now, States = "0", }; if (plan != null) { newTask.ProjectId = plan.ProjectId; db.Training_Task.InsertOnSubmit(newTask); db.SubmitChanges(); ////生成培训任务下培训明细 GetDataService.CreateTrainingTaskItemByTaskId(newTask.TaskId); } } }