/// <summary> /// 根据主键删除应急演练开展情况季报表 /// </summary> /// <param name="drillConductedQuarterlyReportId"></param> public static void DeleteDrillConductedQuarterlyReportById(string drillConductedQuarterlyReportId) { Model.SUBHSSEDB db = Funs.DB; Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport = db.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId); if (drillConductedQuarterlyReport != null) { db.Information_DrillConductedQuarterlyReport.DeleteOnSubmit(drillConductedQuarterlyReport); db.SubmitChanges(); } }
/// <summary> /// 修改应急演练开展情况季报表 /// </summary> /// <param name="drillConductedQuarterlyReport"></param> public static void UpdateDrillConductedQuarterlyReport(Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport) { Model.SUBHSSEDB db = Funs.DB; Model.Information_DrillConductedQuarterlyReport newDrillConductedQuarterlyReport = db.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == drillConductedQuarterlyReport.DrillConductedQuarterlyReportId); if (newDrillConductedQuarterlyReport != null) { newDrillConductedQuarterlyReport.UnitId = drillConductedQuarterlyReport.UnitId; newDrillConductedQuarterlyReport.ReportDate = drillConductedQuarterlyReport.ReportDate; newDrillConductedQuarterlyReport.YearId = drillConductedQuarterlyReport.YearId; newDrillConductedQuarterlyReport.Quarter = drillConductedQuarterlyReport.Quarter; newDrillConductedQuarterlyReport.UpState = drillConductedQuarterlyReport.UpState; newDrillConductedQuarterlyReport.HandleState = drillConductedQuarterlyReport.HandleState; newDrillConductedQuarterlyReport.HandleMan = drillConductedQuarterlyReport.HandleMan; db.SubmitChanges(); } }
/// <summary> /// 添加应急演练开展情况季报表 /// </summary> /// <param name="drillConductedQuarterlyReport"></param> public static void AddDrillConductedQuarterlyReport(Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport) { Model.SUBHSSEDB db = Funs.DB; Model.Information_DrillConductedQuarterlyReport newDrillConductedQuarterlyReport = new Model.Information_DrillConductedQuarterlyReport { DrillConductedQuarterlyReportId = drillConductedQuarterlyReport.DrillConductedQuarterlyReportId, UnitId = drillConductedQuarterlyReport.UnitId, ReportDate = drillConductedQuarterlyReport.ReportDate, YearId = drillConductedQuarterlyReport.YearId, Quarter = drillConductedQuarterlyReport.Quarter, CompileMan = drillConductedQuarterlyReport.CompileMan, UpState = drillConductedQuarterlyReport.UpState, HandleState = drillConductedQuarterlyReport.HandleState, HandleMan = drillConductedQuarterlyReport.HandleMan }; db.Information_DrillConductedQuarterlyReport.InsertOnSubmit(newDrillConductedQuarterlyReport); db.SubmitChanges(); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { if (errorInfos.Count <= 0) { List <Model.View_Information_DrillConductedQuarterlyReportItem> report = new List <Model.View_Information_DrillConductedQuarterlyReportItem>(); if (Session["reports"] != null) { report = Session["reports"] as List <Model.View_Information_DrillConductedQuarterlyReportItem>; } int a = report.Count(); for (int i = 0; i < a; i++) { string drillConductedQuarterlyReportId = string.Empty; //判断应急演练开展情况季报是否存在 var isExist = BLL.DrillConductedQuarterlyReportService.GetDrillConductedQuarterlyReportByUnitIdAndYearAndQuarters(report[i].UnitId, Convert.ToInt32(report[i].YearId), Convert.ToInt32(report[i].Quarter)); if (isExist != null) { drillConductedQuarterlyReportId = isExist.DrillConductedQuarterlyReportId; } else { drillConductedQuarterlyReportId = SQLHelper.GetNewID(typeof(Model.Information_DrillConductedQuarterlyReport)); Model.Information_DrillConductedQuarterlyReport newReport = new Model.Information_DrillConductedQuarterlyReport { DrillConductedQuarterlyReportId = drillConductedQuarterlyReportId, UnitId = report[i].UnitId, YearId = report[i].YearId, Quarter = report[i].Quarter, CompileMan = this.CurrUser.UserName, ReportDate = DateTime.Now }; newReport.CompileMan = this.CurrUser.UserName; newReport.UpState = BLL.Const.UpState_2; newReport.HandleMan = this.CurrUser.UserId; newReport.HandleState = BLL.Const.HandleState_1; BLL.DrillConductedQuarterlyReportService.AddDrillConductedQuarterlyReport(newReport); } Model.Information_DrillConductedQuarterlyReportItem newReportItem = new Model.Information_DrillConductedQuarterlyReportItem { DrillConductedQuarterlyReportItemId = report[i].DrillConductedQuarterlyReportItemId, DrillConductedQuarterlyReportId = drillConductedQuarterlyReportId, IndustryType = report[i].IndustryType, TotalConductCount = report[i].TotalConductCount, TotalPeopleCount = report[i].TotalPeopleCount, TotalInvestment = report[i].TotalInvestment, HQConductCount = report[i].HQConductCount, HQPeopleCount = report[i].HQPeopleCount, HQInvestment = report[i].HQInvestment, BasicConductCount = report[i].BasicConductCount, BasicPeopleCount = report[i].BasicPeopleCount, BasicInvestment = report[i].BasicInvestment, ComprehensivePractice = report[i].ComprehensivePractice, CPScene = report[i].CPScene, CPDesktop = report[i].CPDesktop, SpecialDrill = report[i].SpecialDrill, SDScene = report[i].SDScene, SDDesktop = report[i].SDDesktop, SortIndex = i }; BLL.DrillConductedQuarterlyReportItemService.AddDrillConductedQuarterlyReportItem(newReportItem); } string rootPath = Server.MapPath("~/"); string initFullPath = rootPath + initPath; string filePath = initFullPath + this.hdFileName.Text; if (filePath != string.Empty && System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath);//删除上传的XLS文件 } ShowNotify("导入成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { ShowNotify("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning); } }