using BLL; using System; using System.Linq; using System.Web; namespace FineUIPro.Web.ZHGL.Information { public partial class WorkSummaryReport : PageBase { #region 定义变量 /// /// 主键 /// public string WorkSummaryReportId { get { return (string)ViewState["WorkSummaryReportId"]; } set { ViewState["WorkSummaryReportId"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.drpYear.DataTextField = "ConstText"; drpYear.DataValueField = "ConstValue"; drpYear.DataSource = BLL.ConstValue.drpConstItemList(ConstValue.Group_0008); drpYear.DataBind(); this.drpUnit.DataTextField = "UnitName"; drpUnit.DataValueField = "UnitId"; drpUnit.DataSource = BLL.UnitService.GetThisUnitDropDownList(); drpUnit.DataBind(); this.drpUnit.Readonly = true; drpYear.SelectedValue = System.DateTime.Now.Year.ToString(); GetValue(); } } #endregion #region 清空Label /// /// 清空文本框 /// private void SetEmpty() { this.SimpleForm1.Title = string.Empty; lblUnitName.Text = string.Empty; lblYearId.Text = string.Empty; lblResponsiblePerson.Text = string.Empty; lblResponsiblePersonTel.Text = string.Empty; lblContactPerson.Text = string.Empty; lblContactPersonTel.Text = string.Empty; this.lblReportDate.Text = string.Empty; this.txtValue.Text = HttpUtility.HtmlDecode("无数据"); this.SimpleForm1.Title = "安全管理工作总结报告"; } #endregion #region 获取记录值 private void GetValue() { this.SetEmpty(); int year = Funs.GetNewIntOrZero(drpYear.SelectedValue); Model.Information_WorkSummaryReport workSummaryReport = Funs.DB.Information_WorkSummaryReport.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.YearId == year); if (workSummaryReport != null) { string upState = string.Empty; if (workSummaryReport.UpState == BLL.Const.UpState_3) { upState = "(已上报)"; } else { upState = "(未上报)"; } this.SimpleForm1.Title = "安全管理工作总结报告" + upState; if (!string.IsNullOrEmpty(workSummaryReport.UnitId)) { this.lblUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(workSummaryReport.UnitId); } this.lblYearId.Text = workSummaryReport.YearId.ToString(); this.GetTxetValue(workSummaryReport); } else { SetEmpty(); } this.GetButtonPower(); } /// /// 得到值 /// /// private void GetTxetValue(Model.Information_WorkSummaryReport workSummaryReport) { this.WorkSummaryReportId = workSummaryReport.WorkSummaryReportId; var unit = BLL.UnitService.GetUnitByUnitId(workSummaryReport.UnitId); string unitTypeName = string.Empty; if (unit != null) { var unitType = BLL.UnitTypeService.GetUnitTypeById(unit.UnitTypeId); if (unitType != null) { unitTypeName = unitType.UnitTypeName; } } else { return; } this.lblResponsiblePerson.Text = workSummaryReport.ResponsiblePerson; this.lblResponsiblePersonTel.Text = workSummaryReport.ResponsiblePersonTel; this.lblContactPerson.Text = workSummaryReport.ContactPerson; this.lblContactPersonTel.Text = workSummaryReport.ContactPersonTel; this.lblReportDate.Text = workSummaryReport.ReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", workSummaryReport.ReportDate) : ""; string textvalue = string.Empty; textvalue = " 一、管理绩效\r\n\r\n" + " 1.安全人工时:" + workSummaryReport.SafeLaborTime + "\r\n\r\n" + " 2.安全目标及完成情况(按责任书相应内容进行总结):\r\n" + workSummaryReport.SafetyObjectives + "\r\n\r\n" + " 3.安全事故情况:\r\n" + workSummaryReport.AccidentSituation + "\r\n\r\n" + " 4.获奖情况:\r\n" + workSummaryReport.Awards + "\r\n\r\n" + " 二、主要工作及亮点\r\n\r\n" + " 1.安全生产重点工作开展情况:\r\n" + workSummaryReport.WorkDevelopment + "\r\n\r\n" + " 2.人员培训情况:\r\n" + workSummaryReport.PersonnelTraining + "\r\n\r\n" + " 3.组织开展安全监督检查、隐患排查治理情况:\r\n" + workSummaryReport.GovernanceSituation + "\r\n\r\n" + " 4.安全月、职业健康宣传周等其他管理活动情况:\r\n" + workSummaryReport.ManagementActivity + "\r\n\r\n" + " 5.主要工作经验及亮点:\r\n" + workSummaryReport.WorkExperience + "\r\n\r\n" + " 三、主要问题及应对措施\r\n\r\n" + " " + workSummaryReport.Countermeasures + "\r\n\r\n" + " 四、下一年度工作计划打算\r\n\r\n" + " " + workSummaryReport.NextYearWorkPlan + "\r\n\r\n" + " 五、对集团公司的工作建议\r\n\r\n" + " " + workSummaryReport.JobSuggestion + "\r\n\r\n"; this.txtValue.Text = textvalue; } #endregion #region 增加、修改、删除、审核、审批、上报 /// /// 增加按钮 /// /// /// protected void btnNew_Click(object sender, EventArgs e) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkSummaryReportEdit.aspx?UnitId={0}&&Year={1}", this.CurrUser.UnitId, this.drpYear.SelectedValue, "编辑 - "))); } /// /// 弹出编辑框 /// private void ShowEdit() { Model.Information_WorkSummaryReport report = BLL.WorkSummaryReportService.GetWorkSummaryReportByUnitIdAndYear(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue)); if (report == null) { Alert.ShowInTop("所选时间无报表记录!", MessageBoxIcon.Warning); return; } PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkSummaryReportEdit.aspx?WorkSummaryReportId={0}", report.WorkSummaryReportId, "编辑 - "))); } /// /// 编辑 /// /// /// protected void btnEdit_Click(object sender, EventArgs e) { ShowEdit(); } /// /// 审核 /// /// /// //protected void btnAudit1_Click(object sender, EventArgs e) //{ // ShowEdit(); //} /// /// 审批 /// /// /// //protected void btnAudit2_Click(object sender, EventArgs e) //{ // ShowEdit(); //} /// /// 上报 /// /// /// protected void btnUpdata_Click(object sender, EventArgs e) { ShowEdit(); } /// /// 删除 /// /// /// protected void btnDelete_Click(object sender, EventArgs e) { Model.Information_WorkSummaryReport report = BLL.WorkSummaryReportService.GetWorkSummaryReportByUnitIdAndYear(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue)); if (report != null) { BLL.LogService.AddSys_Log(this.CurrUser, this.lblYearId.Text, report.WorkSummaryReportId, BLL.Const.WorkSummaryReportMenuId, BLL.Const.BtnDelete); //BLL.ProjectDataFlowSetService.DeleteFlowSetByDataId(report.WorkSummaryReportId); BLL.WorkSummaryReportService.DeleteWorkSummaryReportById(report.WorkSummaryReportId); SetEmpty(); this.btnNew.Hidden = false; ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success); } else { ShowNotify("所选时间无报表记录!", MessageBoxIcon.Warning); } } #endregion #region 关闭弹出窗口 /// /// 关闭编辑弹出窗口 /// /// /// protected void Window1_Close(object sender, WindowCloseEventArgs e) { GetValue(); } #endregion #region 获取按钮权限 /// /// 获取按钮权限 /// /// /// private void GetButtonPower() { var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WorkSummaryReportMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnAdd)) { this.btnNew.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnModify)) { this.btnEdit.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnDelete)) { this.btnDelete.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnSaveUp)) { this.btnUpdata.Hidden = false; } //if (buttonList.Contains(BLL.Const.BtnIn)) //{ // this.btnImport.Hidden = false; //} //if (buttonList.Contains(BLL.Const.BtnPrint)) //{ // this.btnPrint.Hidden = false; //} int year = Funs.GetNewIntOrZero(drpYear.SelectedValue); //int quarter = Funs.GetNewIntOrZero(drpQuarter.SelectedValue); var report = BLL.WorkSummaryReportService.GetWorkSummaryReportByUnitIdAndYear(this.drpUnit.SelectedValue, year); //this.btnAudit1.Hidden = true; //this.btnAudit2.Hidden = true; //this.btnUpdata.Hidden = true; if (report != null) { this.btnNew.Hidden = true; } } } #endregion #region 单位下拉框联动事件 /// /// 单位下拉框联动事件 /// /// /// protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e) { GetValue(); } #endregion #region 上一年度、下一年度 /// /// 上一年度 /// /// /// protected void BtnBulletLeft_Click(object sender, EventArgs e) { int y = Convert.ToInt32(drpYear.SelectedValue)- 1; drpYear.SelectedValue = y.ToString(); GetValue(); } /// /// 下一年度 /// /// /// protected void BtnBulletRight_Click(object sender, EventArgs e) { int y = Convert.ToInt32(drpYear.SelectedValue) + 1; drpYear.SelectedValue = y.ToString(); GetValue(); } #endregion #region 查看未上报的项目 /// /// 查看未上报的项目 /// /// /// protected void btnView_Click(object sender, EventArgs e) { string info = string.Empty; int date = Convert.ToInt32(this.drpYear.SelectedValue); var projects = (from x in Funs.DB.Base_Project where (x.ProjectState == BLL.Const.ProjectState_1 || x.ProjectState == null) && x.ProjectAttribute == "GONGCHENG" && x.StartDate.Value.Year <= date select x).ToList(); foreach (var item in projects) { var report = Funs.DB.InformationProject_WorkSummaryReport.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.YearId == date); if (report == null) { info += item.ProjectCode + ":" + item.ProjectName + ",未填写报表;
"; } } if (!string.IsNullOrEmpty(info)) { Alert.ShowInTop(info + "项目报表未上报。", MessageBoxIcon.Warning); } else { ShowNotify("项目报表已上报", MessageBoxIcon.Success); } } #endregion } }