/// <summary>
 /// 添加应急演练开展情况季报明细信息
 /// </summary>
 /// <param name="drillConductedQuarterlyReportItem"></param>
 public static void AddDrillConductedQuarterlyReportItem(Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_DrillConductedQuarterlyReportItem newDrillConductedQuarterlyReportItem = new Model.Information_DrillConductedQuarterlyReportItem
     {
         DrillConductedQuarterlyReportItemId = drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportItemId,
         DrillConductedQuarterlyReportId     = drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportId,
         IndustryType          = drillConductedQuarterlyReportItem.IndustryType,
         TotalConductCount     = drillConductedQuarterlyReportItem.TotalConductCount,
         TotalPeopleCount      = drillConductedQuarterlyReportItem.TotalPeopleCount,
         TotalInvestment       = drillConductedQuarterlyReportItem.TotalInvestment,
         HQConductCount        = drillConductedQuarterlyReportItem.HQConductCount,
         HQPeopleCount         = drillConductedQuarterlyReportItem.HQPeopleCount,
         HQInvestment          = drillConductedQuarterlyReportItem.HQInvestment,
         BasicConductCount     = drillConductedQuarterlyReportItem.BasicConductCount,
         BasicPeopleCount      = drillConductedQuarterlyReportItem.BasicPeopleCount,
         BasicInvestment       = drillConductedQuarterlyReportItem.BasicInvestment,
         ComprehensivePractice = drillConductedQuarterlyReportItem.ComprehensivePractice,
         CPScene      = drillConductedQuarterlyReportItem.CPScene,
         CPDesktop    = drillConductedQuarterlyReportItem.CPDesktop,
         SpecialDrill = drillConductedQuarterlyReportItem.SpecialDrill,
         SDScene      = drillConductedQuarterlyReportItem.SDScene,
         SDDesktop    = drillConductedQuarterlyReportItem.SDDesktop,
         SortIndex    = drillConductedQuarterlyReportItem.SortIndex
     };
     db.Information_DrillConductedQuarterlyReportItem.InsertOnSubmit(newDrillConductedQuarterlyReportItem);
     db.SubmitChanges();
 }
 /// <summary>
 /// 修改应急演练开展情况季报明细信息
 /// </summary>
 /// <param name="drillConductedQuarterlyReportItem"></param>
 public static void UpdateDrillConductedQuarterlyReportItem(Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_DrillConductedQuarterlyReportItem newDrillConductedQuarterlyReportItem = db.Information_DrillConductedQuarterlyReportItem.FirstOrDefault(e => e.DrillConductedQuarterlyReportItemId == drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportItemId);
     if (newDrillConductedQuarterlyReportItem != null)
     {
         newDrillConductedQuarterlyReportItem.IndustryType          = drillConductedQuarterlyReportItem.IndustryType;
         newDrillConductedQuarterlyReportItem.TotalConductCount     = drillConductedQuarterlyReportItem.TotalConductCount;
         newDrillConductedQuarterlyReportItem.TotalPeopleCount      = drillConductedQuarterlyReportItem.TotalPeopleCount;
         newDrillConductedQuarterlyReportItem.TotalInvestment       = drillConductedQuarterlyReportItem.TotalInvestment;
         newDrillConductedQuarterlyReportItem.HQConductCount        = drillConductedQuarterlyReportItem.HQConductCount;
         newDrillConductedQuarterlyReportItem.HQPeopleCount         = drillConductedQuarterlyReportItem.HQPeopleCount;
         newDrillConductedQuarterlyReportItem.HQInvestment          = drillConductedQuarterlyReportItem.HQInvestment;
         newDrillConductedQuarterlyReportItem.BasicConductCount     = drillConductedQuarterlyReportItem.BasicConductCount;
         newDrillConductedQuarterlyReportItem.BasicPeopleCount      = drillConductedQuarterlyReportItem.BasicPeopleCount;
         newDrillConductedQuarterlyReportItem.BasicInvestment       = drillConductedQuarterlyReportItem.BasicInvestment;
         newDrillConductedQuarterlyReportItem.ComprehensivePractice = drillConductedQuarterlyReportItem.ComprehensivePractice;
         newDrillConductedQuarterlyReportItem.CPScene      = drillConductedQuarterlyReportItem.CPScene;
         newDrillConductedQuarterlyReportItem.CPDesktop    = drillConductedQuarterlyReportItem.CPDesktop;
         newDrillConductedQuarterlyReportItem.SpecialDrill = drillConductedQuarterlyReportItem.SpecialDrill;
         newDrillConductedQuarterlyReportItem.SDScene      = drillConductedQuarterlyReportItem.SDScene;
         newDrillConductedQuarterlyReportItem.SDDesktop    = drillConductedQuarterlyReportItem.SDDesktop;
         newDrillConductedQuarterlyReportItem.SortIndex    = drillConductedQuarterlyReportItem.SortIndex;
         db.SubmitChanges();
     }
 }
 /// <summary>
 /// 根据主键删除应急演练开展情况季报明细信息
 /// </summary>
 /// <param name="drillConductedQuarterlyReportItemId"></param>
 public static void DeleteDrillConductedQuarterlyReportItemById(string drillConductedQuarterlyReportItemId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem = db.Information_DrillConductedQuarterlyReportItem.FirstOrDefault(e => e.DrillConductedQuarterlyReportItemId == drillConductedQuarterlyReportItemId);
     if (drillConductedQuarterlyReportItem != null)
     {
         db.Information_DrillConductedQuarterlyReportItem.DeleteOnSubmit(drillConductedQuarterlyReportItem);
         db.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
        /// <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);
            }
        }