/// <summary>
 /// 根据主键删除安全生产数据季报
 /// </summary>
 /// <param name="safetyQuarterlyReportId"></param>
 public static void DeleteSafetyQuarterlyReportById(string safetyQuarterlyReportId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_SafetyQuarterlyReport safetyQuarterlyReport = db.Information_SafetyQuarterlyReport.FirstOrDefault(e => e.SafetyQuarterlyReportId == safetyQuarterlyReportId);
     if (safetyQuarterlyReport != null)
     {
         if (!string.IsNullOrEmpty(safetyQuarterlyReport.FullTimeManAttachUrl))
         {
             BLL.UploadFileService.DeleteFile(Funs.RootPath, safetyQuarterlyReport.FullTimeManAttachUrl);
         }
         if (!string.IsNullOrEmpty(safetyQuarterlyReport.PMManAttachUrl))
         {
             BLL.UploadFileService.DeleteFile(Funs.RootPath, safetyQuarterlyReport.PMManAttachUrl);
         }
         db.Information_SafetyQuarterlyReport.DeleteOnSubmit(safetyQuarterlyReport);
         db.SubmitChanges();
     }
 }
 /// <summary>
 /// 增加安全生产数据季报
 /// </summary>
 /// <param name="safetyQuarterlyReport"></param>
 public static void AddSafetyQuarterlyReport(Model.Information_SafetyQuarterlyReport safetyQuarterlyReport)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_SafetyQuarterlyReport newSafetyQuarterlyReport = new Model.Information_SafetyQuarterlyReport
     {
         SafetyQuarterlyReportId = safetyQuarterlyReport.SafetyQuarterlyReportId,
         UnitId                        = safetyQuarterlyReport.UnitId,
         YearId                        = safetyQuarterlyReport.YearId,
         FillingDate                   = DateTime.Now,
         Quarters                      = safetyQuarterlyReport.Quarters,
         TotalInWorkHours              = safetyQuarterlyReport.TotalInWorkHours,
         TotalInWorkHoursRemark        = safetyQuarterlyReport.TotalInWorkHoursRemark,
         TotalOutWorkHours             = safetyQuarterlyReport.TotalOutWorkHours,
         TotalOutWorkHoursRemark       = safetyQuarterlyReport.TotalOutWorkHoursRemark,
         WorkHoursLossRate             = safetyQuarterlyReport.WorkHoursLossRate,
         WorkHoursLossRateRemark       = safetyQuarterlyReport.WorkHoursLossRateRemark,
         WorkHoursAccuracy             = safetyQuarterlyReport.WorkHoursAccuracy,
         WorkHoursAccuracyRemark       = safetyQuarterlyReport.WorkHoursAccuracyRemark,
         MainBusinessIncome            = safetyQuarterlyReport.MainBusinessIncome,
         MainBusinessIncomeRemark      = safetyQuarterlyReport.MainBusinessIncomeRemark,
         ConstructionRevenue           = safetyQuarterlyReport.ConstructionRevenue,
         ConstructionRevenueRemark     = safetyQuarterlyReport.ConstructionRevenueRemark,
         UnitTimeIncome                = safetyQuarterlyReport.UnitTimeIncome,
         UnitTimeIncomeRemark          = safetyQuarterlyReport.UnitTimeIncomeRemark,
         BillionsOutputMortality       = safetyQuarterlyReport.BillionsOutputMortality,
         BillionsOutputMortalityRemark = safetyQuarterlyReport.BillionsOutputMortalityRemark,
         MajorFireAccident             = safetyQuarterlyReport.MajorFireAccident,
         MajorFireAccidentRemark       = safetyQuarterlyReport.MajorFireAccidentRemark,
         MajorEquipAccident            = safetyQuarterlyReport.MajorEquipAccident,
         MajorEquipAccidentRemark      = safetyQuarterlyReport.MajorEquipAccidentRemark,
         AccidentFrequency             = safetyQuarterlyReport.AccidentFrequency,
         AccidentFrequencyRemark       = safetyQuarterlyReport.AccidentFrequencyRemark,
         SeriousInjuryAccident         = safetyQuarterlyReport.SeriousInjuryAccident,
         SeriousInjuryAccidentRemark   = safetyQuarterlyReport.SeriousInjuryAccidentRemark,
         FireAccident                  = safetyQuarterlyReport.FireAccident,
         FireAccidentRemark            = safetyQuarterlyReport.FireAccidentRemark,
         EquipmentAccident             = safetyQuarterlyReport.EquipmentAccident,
         EquipmentAccidentRemark       = safetyQuarterlyReport.EquipmentAccidentRemark,
         PoisoningAndInjuries          = safetyQuarterlyReport.PoisoningAndInjuries,
         PoisoningAndInjuriesRemark    = safetyQuarterlyReport.PoisoningAndInjuriesRemark,
         ProductionSafetyInTotal       = safetyQuarterlyReport.ProductionSafetyInTotal,
         ProductionSafetyInTotalRemark = safetyQuarterlyReport.ProductionSafetyInTotalRemark,
         ProtectionInput               = safetyQuarterlyReport.ProtectionInput,
         ProtectionInputRemark         = safetyQuarterlyReport.ProtectionInputRemark,
         LaboAndHealthIn               = safetyQuarterlyReport.LaboAndHealthIn,
         LaborAndHealthInRemark        = safetyQuarterlyReport.LaborAndHealthInRemark,
         TechnologyProgressIn          = safetyQuarterlyReport.TechnologyProgressIn,
         TechnologyProgressInRemark    = safetyQuarterlyReport.TechnologyProgressInRemark,
         EducationTrainIn              = safetyQuarterlyReport.EducationTrainIn,
         EducationTrainInRemark        = safetyQuarterlyReport.EducationTrainInRemark,
         ProjectCostRate               = safetyQuarterlyReport.ProjectCostRate,
         ProjectCostRateRemark         = safetyQuarterlyReport.ProjectCostRateRemark,
         ProductionInput               = safetyQuarterlyReport.ProductionInput,
         ProductionInputRemark         = safetyQuarterlyReport.ProductionInputRemark,
         Revenue                       = safetyQuarterlyReport.Revenue,
         RevenueRemark                 = safetyQuarterlyReport.RevenueRemark,
         FullTimeMan                   = safetyQuarterlyReport.FullTimeMan,
         FullTimeManRemark             = safetyQuarterlyReport.FullTimeManRemark,
         FullTimeManAttachUrl          = safetyQuarterlyReport.FullTimeManAttachUrl,
         PMMan                          = safetyQuarterlyReport.PMMan,
         PMManRemark                    = safetyQuarterlyReport.PMManRemark,
         PMManAttachUrl                 = safetyQuarterlyReport.PMManAttachUrl,
         CorporateDirectorEdu           = safetyQuarterlyReport.CorporateDirectorEdu,
         CorporateDirectorEduRemark     = safetyQuarterlyReport.CorporateDirectorEduRemark,
         ProjectLeaderEdu               = safetyQuarterlyReport.ProjectLeaderEdu,
         ProjectLeaderEduRemark         = safetyQuarterlyReport.ProjectLeaderEduRemark,
         FullTimeEdu                    = safetyQuarterlyReport.FullTimeEdu,
         FullTimeEduRemark              = safetyQuarterlyReport.FullTimeEduRemark,
         ThreeKidsEduRate               = safetyQuarterlyReport.ThreeKidsEduRate,
         ThreeKidsEduRateRemark         = safetyQuarterlyReport.ThreeKidsEduRateRemark,
         UplinReportRate                = safetyQuarterlyReport.UplinReportRate,
         UplinReportRateRemark          = safetyQuarterlyReport.UplinReportRateRemark,
         Remarks                        = safetyQuarterlyReport.Remarks,
         CompileMan                     = safetyQuarterlyReport.CompileMan,
         UpState                        = safetyQuarterlyReport.UpState,
         HandleState                    = safetyQuarterlyReport.HandleState,
         HandleMan                      = safetyQuarterlyReport.HandleMan,
         KeyEquipmentTotal              = safetyQuarterlyReport.KeyEquipmentTotal,
         KeyEquipmentTotalRemark        = safetyQuarterlyReport.KeyEquipmentTotalRemark,
         KeyEquipmentReportCount        = safetyQuarterlyReport.KeyEquipmentReportCount,
         KeyEquipmentReportCountRemark  = safetyQuarterlyReport.KeyEquipmentReportCountRemark,
         ChemicalAreaProjectCount       = safetyQuarterlyReport.ChemicalAreaProjectCount,
         ChemicalAreaProjectCountRemark = safetyQuarterlyReport.ChemicalAreaProjectCountRemark,
         HarmfulMediumCoverCount        = safetyQuarterlyReport.HarmfulMediumCoverCount,
         HarmfulMediumCoverCountRemark  = safetyQuarterlyReport.HarmfulMediumCoverCountRemark,
         HarmfulMediumCoverRate         = safetyQuarterlyReport.HarmfulMediumCoverRate,
         HarmfulMediumCoverRateRemark   = safetyQuarterlyReport.HarmfulMediumCoverRateRemark
     };
     db.Information_SafetyQuarterlyReport.InsertOnSubmit(newSafetyQuarterlyReport);
     db.SubmitChanges();
 }
 /// <summary>
 /// 保存导入数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (errorInfos.Count <= 0)
     {
         if (Session["safetyQuarterlyReports"] != null)
         {
             safetyQuarterlyReports = Session["safetyQuarterlyReports"] as List <Model.Information_SafetyQuarterlyReport>;
         }
         int b = safetyQuarterlyReports.Count();
         int c = b;
         for (int i = 0; i < c; i++)
         {
             Model.Information_SafetyQuarterlyReport report = new Model.Information_SafetyQuarterlyReport
             {
                 UnitId                        = safetyQuarterlyReports[i].UnitId,
                 YearId                        = safetyQuarterlyReports[i].YearId,
                 Quarters                      = safetyQuarterlyReports[i].Quarters,
                 TotalInWorkHours              = safetyQuarterlyReports[i].TotalInWorkHours,
                 TotalInWorkHoursRemark        = safetyQuarterlyReports[i].TotalInWorkHoursRemark,
                 TotalOutWorkHours             = safetyQuarterlyReports[i].TotalOutWorkHours,
                 TotalOutWorkHoursRemark       = safetyQuarterlyReports[i].TotalOutWorkHoursRemark,
                 WorkHoursLossRate             = safetyQuarterlyReports[i].WorkHoursLossRate,
                 WorkHoursLossRateRemark       = safetyQuarterlyReports[i].WorkHoursLossRateRemark,
                 WorkHoursAccuracy             = safetyQuarterlyReports[i].WorkHoursAccuracy,
                 WorkHoursAccuracyRemark       = safetyQuarterlyReports[i].WorkHoursAccuracyRemark,
                 MainBusinessIncome            = safetyQuarterlyReports[i].MainBusinessIncome,
                 MainBusinessIncomeRemark      = safetyQuarterlyReports[i].MainBusinessIncomeRemark,
                 ConstructionRevenue           = safetyQuarterlyReports[i].ConstructionRevenue,
                 ConstructionRevenueRemark     = safetyQuarterlyReports[i].ConstructionRevenueRemark,
                 UnitTimeIncome                = safetyQuarterlyReports[i].UnitTimeIncome,
                 UnitTimeIncomeRemark          = safetyQuarterlyReports[i].UnitTimeIncomeRemark,
                 BillionsOutputMortality       = safetyQuarterlyReports[i].BillionsOutputMortality,
                 BillionsOutputMortalityRemark = safetyQuarterlyReports[i].BillionsOutputMortalityRemark,
                 MajorFireAccident             = safetyQuarterlyReports[i].MajorFireAccident,
                 MajorFireAccidentRemark       = safetyQuarterlyReports[i].MajorFireAccidentRemark,
                 MajorEquipAccident            = safetyQuarterlyReports[i].MajorEquipAccident,
                 MajorEquipAccidentRemark      = safetyQuarterlyReports[i].MajorEquipAccidentRemark,
                 AccidentFrequency             = safetyQuarterlyReports[i].AccidentFrequency,
                 AccidentFrequencyRemark       = safetyQuarterlyReports[i].AccidentFrequencyRemark,
                 SeriousInjuryAccident         = safetyQuarterlyReports[i].SeriousInjuryAccident,
                 SeriousInjuryAccidentRemark   = safetyQuarterlyReports[i].SeriousInjuryAccidentRemark,
                 FireAccident                  = safetyQuarterlyReports[i].FireAccident,
                 FireAccidentRemark            = safetyQuarterlyReports[i].FireAccidentRemark,
                 EquipmentAccident             = safetyQuarterlyReports[i].EquipmentAccident,
                 EquipmentAccidentRemark       = safetyQuarterlyReports[i].EquipmentAccidentRemark,
                 PoisoningAndInjuries          = safetyQuarterlyReports[i].PoisoningAndInjuries,
                 PoisoningAndInjuriesRemark    = safetyQuarterlyReports[i].PoisoningAndInjuriesRemark,
                 ProductionSafetyInTotal       = safetyQuarterlyReports[i].ProductionSafetyInTotal,
                 ProductionSafetyInTotalRemark = safetyQuarterlyReports[i].ProductionSafetyInTotalRemark,
                 ProtectionInput               = safetyQuarterlyReports[i].ProtectionInput,
                 ProtectionInputRemark         = safetyQuarterlyReports[i].ProtectionInputRemark,
                 LaboAndHealthIn               = safetyQuarterlyReports[i].LaboAndHealthIn,
                 LaborAndHealthInRemark        = safetyQuarterlyReports[i].LaborAndHealthInRemark,
                 TechnologyProgressIn          = safetyQuarterlyReports[i].TechnologyProgressIn,
                 TechnologyProgressInRemark    = safetyQuarterlyReports[i].TechnologyProgressInRemark,
                 EducationTrainIn              = safetyQuarterlyReports[i].EducationTrainIn,
                 EducationTrainInRemark        = safetyQuarterlyReports[i].EducationTrainInRemark,
                 ProjectCostRate               = safetyQuarterlyReports[i].ProjectCostRate,
                 ProjectCostRateRemark         = safetyQuarterlyReports[i].ProjectCostRateRemark,
                 ProductionInput               = safetyQuarterlyReports[i].ProductionInput,
                 ProductionInputRemark         = safetyQuarterlyReports[i].ProductionInputRemark,
                 Revenue                       = safetyQuarterlyReports[i].Revenue,
                 RevenueRemark                 = safetyQuarterlyReports[i].RevenueRemark,
                 FullTimeMan                   = safetyQuarterlyReports[i].FullTimeMan,
                 FullTimeManRemark             = safetyQuarterlyReports[i].FullTimeManRemark,
                 PMMan                          = safetyQuarterlyReports[i].PMMan,
                 PMManRemark                    = safetyQuarterlyReports[i].PMManRemark,
                 CorporateDirectorEdu           = safetyQuarterlyReports[i].CorporateDirectorEdu,
                 CorporateDirectorEduRemark     = safetyQuarterlyReports[i].CorporateDirectorEduRemark,
                 ProjectLeaderEdu               = safetyQuarterlyReports[i].ProjectLeaderEdu,
                 ProjectLeaderEduRemark         = safetyQuarterlyReports[i].ProjectLeaderEduRemark,
                 FullTimeEdu                    = safetyQuarterlyReports[i].FullTimeEdu,
                 FullTimeEduRemark              = safetyQuarterlyReports[i].FullTimeEduRemark,
                 ThreeKidsEduRate               = safetyQuarterlyReports[i].ThreeKidsEduRate,
                 ThreeKidsEduRateRemark         = safetyQuarterlyReports[i].ThreeKidsEduRateRemark,
                 UplinReportRate                = safetyQuarterlyReports[i].UplinReportRate,
                 UplinReportRateRemark          = safetyQuarterlyReports[i].UplinReportRateRemark,
                 Remarks                        = safetyQuarterlyReports[i].Remarks,
                 KeyEquipmentTotal              = safetyQuarterlyReports[i].KeyEquipmentTotal,
                 KeyEquipmentTotalRemark        = safetyQuarterlyReports[i].KeyEquipmentTotalRemark,
                 KeyEquipmentReportCount        = safetyQuarterlyReports[i].KeyEquipmentReportCount,
                 KeyEquipmentReportCountRemark  = safetyQuarterlyReports[i].KeyEquipmentReportCountRemark,
                 ChemicalAreaProjectCount       = safetyQuarterlyReports[i].ChemicalAreaProjectCount,
                 ChemicalAreaProjectCountRemark = safetyQuarterlyReports[i].ChemicalAreaProjectCountRemark,
                 HarmfulMediumCoverCount        = safetyQuarterlyReports[i].HarmfulMediumCoverCount,
                 HarmfulMediumCoverCountRemark  = safetyQuarterlyReports[i].HarmfulMediumCoverCountRemark,
                 HarmfulMediumCoverRate         = safetyQuarterlyReports[i].HarmfulMediumCoverRate,
                 HarmfulMediumCoverRateRemark   = safetyQuarterlyReports[i].HarmfulMediumCoverRateRemark,
                 CompileMan                     = this.CurrUser.UserName,
                 UpState                        = BLL.Const.UpState_2,
                 HandleMan                      = this.CurrUser.UserId,
                 HandleState                    = BLL.Const.HandleState_1
             };
             BLL.SafetyQuarterlyReportService.AddSafetyQuarterlyReport(safetyQuarterlyReports[i]);
         }
         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);
     }
 }
 /// <summary>
 /// 修改安全生产数据季报
 /// </summary>
 /// <param name="safetyQuarterlyReport"></param>
 public static void UpdateSafetyQuarterlyReport(Model.Information_SafetyQuarterlyReport safetyQuarterlyReport)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Information_SafetyQuarterlyReport newSafetyQuarterlyReport = db.Information_SafetyQuarterlyReport.FirstOrDefault(e => e.SafetyQuarterlyReportId == safetyQuarterlyReport.SafetyQuarterlyReportId);
     if (newSafetyQuarterlyReport != null)
     {
         newSafetyQuarterlyReport.UnitId                        = safetyQuarterlyReport.UnitId;
         newSafetyQuarterlyReport.YearId                        = safetyQuarterlyReport.YearId;
         newSafetyQuarterlyReport.Quarters                      = safetyQuarterlyReport.Quarters;
         newSafetyQuarterlyReport.TotalInWorkHours              = safetyQuarterlyReport.TotalInWorkHours;
         newSafetyQuarterlyReport.TotalInWorkHoursRemark        = safetyQuarterlyReport.TotalInWorkHoursRemark;
         newSafetyQuarterlyReport.TotalOutWorkHours             = safetyQuarterlyReport.TotalOutWorkHours;
         newSafetyQuarterlyReport.TotalOutWorkHoursRemark       = safetyQuarterlyReport.TotalOutWorkHoursRemark;
         newSafetyQuarterlyReport.WorkHoursLossRate             = safetyQuarterlyReport.WorkHoursLossRate;
         newSafetyQuarterlyReport.WorkHoursLossRateRemark       = safetyQuarterlyReport.WorkHoursLossRateRemark;
         newSafetyQuarterlyReport.WorkHoursAccuracy             = safetyQuarterlyReport.WorkHoursAccuracy;
         newSafetyQuarterlyReport.WorkHoursAccuracyRemark       = safetyQuarterlyReport.WorkHoursAccuracyRemark;
         newSafetyQuarterlyReport.MainBusinessIncome            = safetyQuarterlyReport.MainBusinessIncome;
         newSafetyQuarterlyReport.MainBusinessIncomeRemark      = safetyQuarterlyReport.MainBusinessIncomeRemark;
         newSafetyQuarterlyReport.ConstructionRevenue           = safetyQuarterlyReport.ConstructionRevenue;
         newSafetyQuarterlyReport.ConstructionRevenueRemark     = safetyQuarterlyReport.ConstructionRevenueRemark;
         newSafetyQuarterlyReport.UnitTimeIncome                = safetyQuarterlyReport.UnitTimeIncome;
         newSafetyQuarterlyReport.UnitTimeIncomeRemark          = safetyQuarterlyReport.UnitTimeIncomeRemark;
         newSafetyQuarterlyReport.BillionsOutputMortality       = safetyQuarterlyReport.BillionsOutputMortality;
         newSafetyQuarterlyReport.BillionsOutputMortalityRemark = safetyQuarterlyReport.BillionsOutputMortalityRemark;
         newSafetyQuarterlyReport.MajorFireAccident             = safetyQuarterlyReport.MajorFireAccident;
         newSafetyQuarterlyReport.MajorFireAccidentRemark       = safetyQuarterlyReport.MajorFireAccidentRemark;
         newSafetyQuarterlyReport.MajorEquipAccident            = safetyQuarterlyReport.MajorEquipAccident;
         newSafetyQuarterlyReport.MajorEquipAccidentRemark      = safetyQuarterlyReport.MajorEquipAccidentRemark;
         newSafetyQuarterlyReport.AccidentFrequency             = safetyQuarterlyReport.AccidentFrequency;
         newSafetyQuarterlyReport.AccidentFrequencyRemark       = safetyQuarterlyReport.AccidentFrequencyRemark;
         newSafetyQuarterlyReport.SeriousInjuryAccident         = safetyQuarterlyReport.SeriousInjuryAccident;
         newSafetyQuarterlyReport.SeriousInjuryAccidentRemark   = safetyQuarterlyReport.SeriousInjuryAccidentRemark;
         newSafetyQuarterlyReport.FireAccident                  = safetyQuarterlyReport.FireAccident;
         newSafetyQuarterlyReport.FireAccidentRemark            = safetyQuarterlyReport.FireAccidentRemark;
         newSafetyQuarterlyReport.EquipmentAccident             = safetyQuarterlyReport.EquipmentAccident;
         newSafetyQuarterlyReport.EquipmentAccidentRemark       = safetyQuarterlyReport.EquipmentAccidentRemark;
         newSafetyQuarterlyReport.PoisoningAndInjuries          = safetyQuarterlyReport.PoisoningAndInjuries;
         newSafetyQuarterlyReport.PoisoningAndInjuriesRemark    = safetyQuarterlyReport.PoisoningAndInjuriesRemark;
         newSafetyQuarterlyReport.ProductionSafetyInTotal       = safetyQuarterlyReport.ProductionSafetyInTotal;
         newSafetyQuarterlyReport.ProductionSafetyInTotalRemark = safetyQuarterlyReport.ProductionSafetyInTotalRemark;
         newSafetyQuarterlyReport.ProtectionInput               = safetyQuarterlyReport.ProtectionInput;
         newSafetyQuarterlyReport.ProtectionInputRemark         = safetyQuarterlyReport.ProtectionInputRemark;
         newSafetyQuarterlyReport.LaboAndHealthIn               = safetyQuarterlyReport.LaboAndHealthIn;
         newSafetyQuarterlyReport.LaborAndHealthInRemark        = safetyQuarterlyReport.LaborAndHealthInRemark;
         newSafetyQuarterlyReport.TechnologyProgressIn          = safetyQuarterlyReport.TechnologyProgressIn;
         newSafetyQuarterlyReport.TechnologyProgressInRemark    = safetyQuarterlyReport.TechnologyProgressInRemark;
         newSafetyQuarterlyReport.EducationTrainIn              = safetyQuarterlyReport.EducationTrainIn;
         newSafetyQuarterlyReport.EducationTrainInRemark        = safetyQuarterlyReport.EducationTrainInRemark;
         newSafetyQuarterlyReport.ProjectCostRate               = safetyQuarterlyReport.ProjectCostRate;
         newSafetyQuarterlyReport.ProjectCostRateRemark         = safetyQuarterlyReport.ProjectCostRateRemark;
         newSafetyQuarterlyReport.ProductionInput               = safetyQuarterlyReport.ProductionInput;
         newSafetyQuarterlyReport.ProductionInputRemark         = safetyQuarterlyReport.ProductionInputRemark;
         newSafetyQuarterlyReport.Revenue                       = safetyQuarterlyReport.Revenue;
         newSafetyQuarterlyReport.RevenueRemark                 = safetyQuarterlyReport.RevenueRemark;
         newSafetyQuarterlyReport.FullTimeMan                   = safetyQuarterlyReport.FullTimeMan;
         newSafetyQuarterlyReport.FullTimeManRemark             = safetyQuarterlyReport.FullTimeManRemark;
         newSafetyQuarterlyReport.FullTimeManAttachUrl          = safetyQuarterlyReport.FullTimeManAttachUrl;
         newSafetyQuarterlyReport.PMMan                          = safetyQuarterlyReport.PMMan;
         newSafetyQuarterlyReport.PMManRemark                    = safetyQuarterlyReport.PMManRemark;
         newSafetyQuarterlyReport.PMManAttachUrl                 = safetyQuarterlyReport.PMManAttachUrl;
         newSafetyQuarterlyReport.CorporateDirectorEdu           = safetyQuarterlyReport.CorporateDirectorEdu;
         newSafetyQuarterlyReport.CorporateDirectorEduRemark     = safetyQuarterlyReport.CorporateDirectorEduRemark;
         newSafetyQuarterlyReport.ProjectLeaderEdu               = safetyQuarterlyReport.ProjectLeaderEdu;
         newSafetyQuarterlyReport.ProjectLeaderEduRemark         = safetyQuarterlyReport.ProjectLeaderEduRemark;
         newSafetyQuarterlyReport.FullTimeEdu                    = safetyQuarterlyReport.FullTimeEdu;
         newSafetyQuarterlyReport.FullTimeEduRemark              = safetyQuarterlyReport.FullTimeEduRemark;
         newSafetyQuarterlyReport.ThreeKidsEduRate               = safetyQuarterlyReport.ThreeKidsEduRate;
         newSafetyQuarterlyReport.ThreeKidsEduRateRemark         = safetyQuarterlyReport.ThreeKidsEduRateRemark;
         newSafetyQuarterlyReport.UplinReportRate                = safetyQuarterlyReport.UplinReportRate;
         newSafetyQuarterlyReport.UplinReportRateRemark          = safetyQuarterlyReport.UplinReportRateRemark;
         newSafetyQuarterlyReport.Remarks                        = safetyQuarterlyReport.Remarks;
         newSafetyQuarterlyReport.UpState                        = safetyQuarterlyReport.UpState;
         newSafetyQuarterlyReport.HandleState                    = safetyQuarterlyReport.HandleState;
         newSafetyQuarterlyReport.HandleMan                      = safetyQuarterlyReport.HandleMan;
         newSafetyQuarterlyReport.KeyEquipmentTotal              = safetyQuarterlyReport.KeyEquipmentTotal;
         newSafetyQuarterlyReport.KeyEquipmentTotalRemark        = safetyQuarterlyReport.KeyEquipmentTotalRemark;
         newSafetyQuarterlyReport.KeyEquipmentReportCount        = safetyQuarterlyReport.KeyEquipmentReportCount;
         newSafetyQuarterlyReport.KeyEquipmentReportCountRemark  = safetyQuarterlyReport.KeyEquipmentReportCountRemark;
         newSafetyQuarterlyReport.ChemicalAreaProjectCount       = safetyQuarterlyReport.ChemicalAreaProjectCount;
         newSafetyQuarterlyReport.ChemicalAreaProjectCountRemark = safetyQuarterlyReport.ChemicalAreaProjectCountRemark;
         newSafetyQuarterlyReport.HarmfulMediumCoverCount        = safetyQuarterlyReport.HarmfulMediumCoverCount;
         newSafetyQuarterlyReport.HarmfulMediumCoverCountRemark  = safetyQuarterlyReport.HarmfulMediumCoverCountRemark;
         newSafetyQuarterlyReport.HarmfulMediumCoverRate         = safetyQuarterlyReport.HarmfulMediumCoverRate;
         newSafetyQuarterlyReport.HarmfulMediumCoverRateRemark   = safetyQuarterlyReport.HarmfulMediumCoverRateRemark;
         db.SubmitChanges();
     }
 }
Example #5
0
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集列数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds, int Cols)
        {
            int ic, ir;

            safetyQuarterlyReports.Clear();
            ic = pds.Columns.Count;
            if (ic < Cols)
            {
                ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
            }

            ir = pds.Rows.Count;
            if (pds != null && ir > 0)
            {
                var units = from x in Funs.DB.Base_Unit select x;

                for (int i = 0; i < ir; i++)
                {
                    Model.Information_SafetyQuarterlyReport safetyQuarterlyReport = new Model.Information_SafetyQuarterlyReport();
                    string row1  = pds.Rows[i][0].ToString().Trim();
                    string row2  = pds.Rows[i][1].ToString().Trim();
                    string row3  = pds.Rows[i][2].ToString().Trim();
                    string row4  = pds.Rows[i][3].ToString().Trim();
                    string row5  = pds.Rows[i][4].ToString().Trim();
                    string row6  = pds.Rows[i][5].ToString().Trim();
                    string row7  = pds.Rows[i][6].ToString().Trim();
                    string row8  = pds.Rows[i][7].ToString().Trim();
                    string row9  = pds.Rows[i][8].ToString().Trim();
                    string row10 = pds.Rows[i][9].ToString().Trim();
                    string row11 = pds.Rows[i][10].ToString().Trim();
                    string row12 = pds.Rows[i][11].ToString().Trim();
                    string row13 = pds.Rows[i][12].ToString().Trim();
                    string row14 = pds.Rows[i][13].ToString().Trim();
                    string row15 = pds.Rows[i][14].ToString().Trim();
                    string row16 = pds.Rows[i][15].ToString().Trim();
                    string row17 = pds.Rows[i][16].ToString().Trim();
                    string row18 = pds.Rows[i][17].ToString().Trim();
                    string row19 = pds.Rows[i][18].ToString().Trim();
                    string row20 = pds.Rows[i][19].ToString().Trim();
                    string row21 = pds.Rows[i][20].ToString().Trim();
                    string row22 = pds.Rows[i][21].ToString().Trim();
                    string row23 = pds.Rows[i][22].ToString().Trim();
                    string row24 = pds.Rows[i][23].ToString().Trim();
                    string row25 = pds.Rows[i][24].ToString().Trim();
                    string row26 = pds.Rows[i][25].ToString().Trim();
                    string row27 = pds.Rows[i][26].ToString().Trim();
                    string row28 = pds.Rows[i][27].ToString().Trim();
                    string row29 = pds.Rows[i][28].ToString().Trim();
                    string row30 = pds.Rows[i][29].ToString().Trim();
                    string row31 = pds.Rows[i][30].ToString().Trim();
                    string row32 = pds.Rows[i][31].ToString().Trim();
                    string row33 = pds.Rows[i][32].ToString().Trim();
                    string row34 = pds.Rows[i][33].ToString().Trim();
                    string row35 = pds.Rows[i][34].ToString().Trim();
                    string row36 = pds.Rows[i][35].ToString().Trim();
                    string row37 = pds.Rows[i][36].ToString().Trim();
                    string row38 = pds.Rows[i][37].ToString().Trim();
                    string row39 = pds.Rows[i][38].ToString().Trim();
                    string row40 = pds.Rows[i][39].ToString().Trim();
                    string row41 = pds.Rows[i][40].ToString().Trim();
                    string row42 = pds.Rows[i][41].ToString().Trim();
                    string row43 = pds.Rows[i][42].ToString().Trim();
                    string row44 = pds.Rows[i][43].ToString().Trim();
                    string row45 = pds.Rows[i][44].ToString().Trim();
                    string row46 = pds.Rows[i][45].ToString().Trim();
                    string row47 = pds.Rows[i][46].ToString().Trim();
                    string row48 = pds.Rows[i][47].ToString().Trim();
                    string row49 = pds.Rows[i][48].ToString().Trim();
                    string row50 = pds.Rows[i][49].ToString().Trim();
                    string row51 = pds.Rows[i][50].ToString().Trim();
                    string row52 = pds.Rows[i][51].ToString().Trim();
                    string row53 = pds.Rows[i][52].ToString().Trim();
                    string row54 = pds.Rows[i][53].ToString().Trim();
                    string row55 = pds.Rows[i][54].ToString().Trim();
                    string row56 = pds.Rows[i][55].ToString().Trim();
                    string row57 = pds.Rows[i][56].ToString().Trim();
                    string row58 = pds.Rows[i][57].ToString().Trim();
                    string row59 = pds.Rows[i][58].ToString().Trim();
                    string row60 = pds.Rows[i][59].ToString().Trim();
                    string row61 = pds.Rows[i][60].ToString().Trim();
                    string row62 = pds.Rows[i][61].ToString().Trim();
                    string row63 = pds.Rows[i][62].ToString().Trim();
                    string row64 = pds.Rows[i][63].ToString().Trim();
                    string row65 = pds.Rows[i][64].ToString().Trim();
                    string row66 = pds.Rows[i][65].ToString().Trim();
                    string row67 = pds.Rows[i][66].ToString().Trim();
                    string row68 = pds.Rows[i][67].ToString().Trim();
                    string row69 = pds.Rows[i][68].ToString().Trim();
                    string row70 = pds.Rows[i][69].ToString().Trim();
                    string row71 = pds.Rows[i][70].ToString().Trim();
                    string row72 = pds.Rows[i][71].ToString().Trim();
                    string row73 = pds.Rows[i][72].ToString().Trim();
                    string row74 = pds.Rows[i][73].ToString().Trim();

                    if (!string.IsNullOrEmpty(row1))
                    {
                        safetyQuarterlyReport.UnitId = units.Where(x => x.UnitName == row1.Trim()).FirstOrDefault().UnitId;
                    }
                    if (!string.IsNullOrEmpty(row2))
                    {
                        safetyQuarterlyReport.YearId = Convert.ToInt32(row2);
                    }
                    if (!string.IsNullOrEmpty(row3))
                    {
                        safetyQuarterlyReport.Quarters = Convert.ToInt32(row3);
                    }
                    if (!string.IsNullOrEmpty(row4))
                    {
                        safetyQuarterlyReport.TotalInWorkHours = Convert.ToInt32(row4);
                    }
                    safetyQuarterlyReport.TotalInWorkHoursRemark = row5;
                    if (!string.IsNullOrEmpty(row6))
                    {
                        safetyQuarterlyReport.TotalOutWorkHours = Convert.ToInt32(row6);
                    }
                    safetyQuarterlyReport.TotalOutWorkHoursRemark = row7;
                    if (!string.IsNullOrEmpty(row8))
                    {
                        safetyQuarterlyReport.WorkHoursLossRate = Convert.ToDecimal(row8);
                    }
                    safetyQuarterlyReport.WorkHoursLossRateRemark = row9;
                    if (!string.IsNullOrEmpty(row10))
                    {
                        safetyQuarterlyReport.WorkHoursAccuracy = Convert.ToDecimal(row10);
                    }
                    safetyQuarterlyReport.WorkHoursAccuracyRemark = row11;
                    if (!string.IsNullOrEmpty(row12))
                    {
                        safetyQuarterlyReport.MainBusinessIncome = Convert.ToDecimal(row12);
                    }
                    safetyQuarterlyReport.MainBusinessIncomeRemark = row13;
                    if (!string.IsNullOrEmpty(row14))
                    {
                        safetyQuarterlyReport.ConstructionRevenue = Convert.ToDecimal(row14);
                    }
                    safetyQuarterlyReport.ConstructionRevenueRemark = row15;
                    if (!string.IsNullOrEmpty(row16))
                    {
                        safetyQuarterlyReport.UnitTimeIncome = Convert.ToDecimal(row16);
                    }
                    safetyQuarterlyReport.UnitTimeIncomeRemark = row17;
                    if (!string.IsNullOrEmpty(row18))
                    {
                        safetyQuarterlyReport.BillionsOutputMortality = Convert.ToDecimal(row18);
                    }
                    safetyQuarterlyReport.BillionsOutputMortalityRemark = row19;
                    if (!string.IsNullOrEmpty(row20))
                    {
                        safetyQuarterlyReport.MajorFireAccident = Convert.ToInt32(row20);
                    }
                    safetyQuarterlyReport.MajorFireAccidentRemark = row21;
                    if (!string.IsNullOrEmpty(row22))
                    {
                        safetyQuarterlyReport.MajorEquipAccident = Convert.ToInt32(row22);
                    }
                    safetyQuarterlyReport.MajorEquipAccidentRemark = row23;
                    if (!string.IsNullOrEmpty(row24))
                    {
                        safetyQuarterlyReport.AccidentFrequency = Convert.ToDecimal(row24);
                    }
                    safetyQuarterlyReport.AccidentFrequencyRemark = row25;
                    if (!string.IsNullOrEmpty(row26))
                    {
                        safetyQuarterlyReport.SeriousInjuryAccident = Convert.ToInt32(row26);
                    }
                    safetyQuarterlyReport.SeriousInjuryAccidentRemark = row27;
                    if (!string.IsNullOrEmpty(row28))
                    {
                        safetyQuarterlyReport.FireAccident = Convert.ToInt32(row28);
                    }
                    safetyQuarterlyReport.FireAccidentRemark = row29;
                    if (!string.IsNullOrEmpty(row30))
                    {
                        safetyQuarterlyReport.EquipmentAccident = Convert.ToInt32(row30);
                    }
                    safetyQuarterlyReport.EquipmentAccidentRemark = row31;
                    if (!string.IsNullOrEmpty(row32))
                    {
                        safetyQuarterlyReport.PoisoningAndInjuries = Convert.ToInt32(row32);
                    }
                    safetyQuarterlyReport.PoisoningAndInjuriesRemark = row33;
                    if (!string.IsNullOrEmpty(row34))
                    {
                        safetyQuarterlyReport.ProductionSafetyInTotal = Convert.ToInt32(row34);
                    }
                    safetyQuarterlyReport.ProductionSafetyInTotalRemark = row35;
                    if (!string.IsNullOrEmpty(row36))
                    {
                        safetyQuarterlyReport.ProtectionInput = Convert.ToDecimal(row36);
                    }
                    safetyQuarterlyReport.ProtectionInputRemark = row37;
                    if (!string.IsNullOrEmpty(row38))
                    {
                        safetyQuarterlyReport.LaboAndHealthIn = Convert.ToDecimal(row38);
                    }
                    safetyQuarterlyReport.LaborAndHealthInRemark = row39;
                    if (!string.IsNullOrEmpty(row40))
                    {
                        safetyQuarterlyReport.TechnologyProgressIn = Convert.ToDecimal(row40);
                    }
                    safetyQuarterlyReport.TechnologyProgressInRemark = row41;
                    if (!string.IsNullOrEmpty(row42))
                    {
                        safetyQuarterlyReport.EducationTrainIn = Convert.ToDecimal(row42);
                    }
                    safetyQuarterlyReport.EducationTrainInRemark = row43;
                    if (!string.IsNullOrEmpty(row44))
                    {
                        safetyQuarterlyReport.ProjectCostRate = Convert.ToDecimal(row44);
                    }
                    safetyQuarterlyReport.ProjectCostRateRemark = row45;
                    if (!string.IsNullOrEmpty(row46))
                    {
                        safetyQuarterlyReport.ProductionInput = Convert.ToDecimal(row46);
                    }
                    safetyQuarterlyReport.ProductionInputRemark = row47;
                    if (!string.IsNullOrEmpty(row48))
                    {
                        safetyQuarterlyReport.Revenue = Convert.ToDecimal(row48);
                    }
                    safetyQuarterlyReport.RevenueRemark = row49;
                    if (!string.IsNullOrEmpty(row50))
                    {
                        safetyQuarterlyReport.FullTimeMan = Convert.ToInt32(row50);
                    }
                    safetyQuarterlyReport.FullTimeManRemark = row51;
                    if (!string.IsNullOrEmpty(row52))
                    {
                        safetyQuarterlyReport.PMMan = Convert.ToInt32(row52);
                    }
                    safetyQuarterlyReport.PMManRemark = row53;
                    if (!string.IsNullOrEmpty(row54))
                    {
                        safetyQuarterlyReport.CorporateDirectorEdu = Convert.ToInt32(row54);
                    }
                    safetyQuarterlyReport.CorporateDirectorEduRemark = row55;
                    if (!string.IsNullOrEmpty(row56))
                    {
                        safetyQuarterlyReport.ProjectLeaderEdu = Convert.ToInt32(row56);
                    }
                    safetyQuarterlyReport.ProjectLeaderEduRemark = row57;
                    if (!string.IsNullOrEmpty(row58))
                    {
                        safetyQuarterlyReport.FullTimeEdu = Convert.ToInt32(row58);
                    }
                    safetyQuarterlyReport.FullTimeEduRemark = row59;
                    if (!string.IsNullOrEmpty(row60))
                    {
                        safetyQuarterlyReport.ThreeKidsEduRate = Convert.ToDecimal(row60);
                    }
                    safetyQuarterlyReport.ThreeKidsEduRateRemark = row61;
                    if (!string.IsNullOrEmpty(row62))
                    {
                        safetyQuarterlyReport.UplinReportRate = Convert.ToDecimal(row62);
                    }
                    safetyQuarterlyReport.UplinReportRateRemark = row63;
                    if (!string.IsNullOrEmpty(row64))
                    {
                        safetyQuarterlyReport.KeyEquipmentTotal = Convert.ToInt32(row64);
                    }
                    safetyQuarterlyReport.KeyEquipmentTotalRemark = row65;
                    if (!string.IsNullOrEmpty(row66))
                    {
                        safetyQuarterlyReport.KeyEquipmentReportCount = Convert.ToInt32(row66);
                    }
                    safetyQuarterlyReport.KeyEquipmentReportCountRemark = row67;
                    if (!string.IsNullOrEmpty(row68))
                    {
                        safetyQuarterlyReport.ChemicalAreaProjectCount = Convert.ToInt32(row68);
                    }
                    safetyQuarterlyReport.ChemicalAreaProjectCountRemark = row69;
                    if (!string.IsNullOrEmpty(row70))
                    {
                        safetyQuarterlyReport.HarmfulMediumCoverCount = Convert.ToInt32(row70);
                    }
                    safetyQuarterlyReport.HarmfulMediumCoverCountRemark = row71;
                    if (!string.IsNullOrEmpty(row72))
                    {
                        safetyQuarterlyReport.HarmfulMediumCoverRate = Convert.ToDecimal(row72);
                    }
                    safetyQuarterlyReport.HarmfulMediumCoverRateRemark = row73;
                    safetyQuarterlyReport.Remarks = row74;

                    if (safetyQuarterlyReports.Where(e => e.SafetyQuarterlyReportId == safetyQuarterlyReport.SafetyQuarterlyReportId).FirstOrDefault() == null)
                    {
                        safetyQuarterlyReport.SafetyQuarterlyReportId = SQLHelper.GetNewID(typeof(Model.Information_SafetyQuarterlyReport));
                        safetyQuarterlyReport.CompileMan  = this.CurrUser.UserName;
                        safetyQuarterlyReport.UpState     = BLL.Const.UpState_2;
                        safetyQuarterlyReport.HandleMan   = this.CurrUser.UserId;
                        safetyQuarterlyReport.HandleState = BLL.Const.HandleState_1;
                        safetyQuarterlyReports.Add(safetyQuarterlyReport); //增加安全生产数据季报表
                    }
                }
                Session["safetyQuarterlyReports"] = safetyQuarterlyReports;
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
            }
            return(true);
        }