364 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			364 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using System;
 | 
						|
using System.Linq;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.ZHGL.Information
 | 
						|
{
 | 
						|
    public partial class EPSummaryReport : PageBase
 | 
						|
    {
 | 
						|
 | 
						|
        #region 定义变量
 | 
						|
        /// <summary>
 | 
						|
        /// 主键
 | 
						|
        /// </summary>
 | 
						|
        public string EPSummaryReportId
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["EPSummaryReportId"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["EPSummaryReportId"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 加载页面
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        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
 | 
						|
        /// <summary>
 | 
						|
        /// 清空文本框
 | 
						|
        /// </summary>
 | 
						|
        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_EPSummaryReport report = Funs.DB.Information_EPSummaryReport.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.YearId == year);
 | 
						|
            if (report != null)
 | 
						|
            {
 | 
						|
                string upState = string.Empty;
 | 
						|
                if (report.UpState == BLL.Const.UpState_3)
 | 
						|
                {
 | 
						|
                    upState = "(已上报)";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    upState = "(未上报)";
 | 
						|
                }
 | 
						|
                this.SimpleForm1.Title = "生态环保工作总结报告" + upState;
 | 
						|
                if (!string.IsNullOrEmpty(report.UnitId))
 | 
						|
                {
 | 
						|
                    this.lblUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(report.UnitId);
 | 
						|
                }
 | 
						|
                this.lblYearId.Text = report.YearId.ToString();
 | 
						|
 | 
						|
                this.GetTxetValue(report);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                SetEmpty();
 | 
						|
            }
 | 
						|
            this.GetButtonPower();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 得到值
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="report"></param>
 | 
						|
        private void GetTxetValue(Model.Information_EPSummaryReport report)
 | 
						|
        {
 | 
						|
            this.EPSummaryReportId = report.EPSummaryReportId;
 | 
						|
            var unit = BLL.UnitService.GetUnitByUnitId(report.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 = report.ResponsiblePerson;
 | 
						|
            this.lblResponsiblePersonTel.Text = report.ResponsiblePersonTel;
 | 
						|
            this.lblContactPerson.Text = report.ContactPerson;
 | 
						|
            this.lblContactPersonTel.Text = report.ContactPersonTel;
 | 
						|
            this.lblReportDate.Text = report.ReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReportDate) : "";
 | 
						|
 | 
						|
            string textvalue = string.Empty;
 | 
						|
 | 
						|
            textvalue = "  一、贯彻落实国家有关环保节能相关文件情况,落实集团公司有关环保节能工作部署情况。\r\n\r\n"
 | 
						|
               + report.Description1 + "\r\n\r\n"
 | 
						|
               + "     二、企业报告期环保节能主要指标完成情况,对增减幅度较大的指标或发生并购、重组等影响能源消耗及污染物排放的重大事项要进行特殊说明。\r\n\r\n"
 | 
						|
               + report.Description2 + "\r\n\r\n"
 | 
						|
               + "     三、企业任期环保节能考核指标完成情况。\r\n\r\n"
 | 
						|
               + report.Description3 + "\r\n\r\n"
 | 
						|
               + "     四、企业环保节能组织管理、统计监测、考核奖惩体系建设情况。\r\n\r\n"
 | 
						|
               + report.Description4 + "\r\n\r\n"
 | 
						|
               + "     五、企业本年度绿色发展规划、环保节能相关制度政策制定实施情况和节能环保资金投入情况。\r\n\r\n"
 | 
						|
               + report.Description5 + "\r\n\r\n"
 | 
						|
               + "     六、企业推进产业结构绿色转型升级进展情况,包括淘汰落后产能、传统产业优化升级、构建绿色产业链、绿色技术创新以及发展绿色金融、循环经济、节能环保战略性新兴产业等方面。\r\n\r\n"
 | 
						|
               + report.Description6 + "\r\n\r\n"
 | 
						|
               + "     七、企业环保节能工作采取的重大措施及取得的成果,包括能源结构调整、能源消费总量和强度控制、资源综合循环利用、污染防治、生态环境保护与修复、应对气候变化等方面。\r\n\r\n"
 | 
						|
               + report.Description7 + "\r\n\r\n"
 | 
						|
               + "     八、企业环保节能存在的主要问题与原因、下一阶段(年度)工作重点。\r\n\r\n"
 | 
						|
               + report.Description8 + "\r\n\r\n"
 | 
						|
            + "     九、本企业及所属企业发生的环保重大违法违规事件、各级政府有关部门对本企业环保节能年度检查、考核和奖惩情况等重要事项。\r\n\r\n"
 | 
						|
               + report.Description9;
 | 
						|
 | 
						|
            this.txtValue.Text = textvalue;
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 增加、修改、删除、上报
 | 
						|
        /// <summary>
 | 
						|
        /// 增加按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnNew_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EPSummaryReportEdit.aspx?UnitId={0}&&Year={1}", this.CurrUser.UnitId, this.drpYear.SelectedValue, "编辑 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 弹出编辑框
 | 
						|
        /// </summary>
 | 
						|
        private void ShowEdit()
 | 
						|
        {
 | 
						|
            Model.Information_EPSummaryReport report = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearId(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue));
 | 
						|
            if (report == null)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("所选时间无报表记录!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EPSummaryReportEdit.aspx?EPSummaryReportId={0}", report.EPSummaryReportId, "编辑 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 编辑
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnEdit_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            ShowEdit();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 上报
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnUpdata_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            ShowEdit();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 删除
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnDelete_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Model.Information_EPSummaryReport report = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearId(drpUnit.SelectedValue, Funs.GetNewIntOrZero(drpYear.SelectedValue));
 | 
						|
            if (report != null)
 | 
						|
            {
 | 
						|
                BLL.LogService.AddSys_Log(this.CurrUser, this.lblYearId.Text, report.EPSummaryReportId, BLL.Const.EPSummaryReportMenuId, BLL.Const.BtnDelete);
 | 
						|
 | 
						|
                //BLL.ProjectDataFlowSetService.DeleteFlowSetByDataId(report.WorkSummaryReportId);
 | 
						|
                BLL.EPSummaryReportService.DeleteEPSummaryReportById(report.EPSummaryReportId);
 | 
						|
 | 
						|
                SetEmpty();
 | 
						|
                this.btnNew.Hidden = false;
 | 
						|
                ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("所选时间无报表记录!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 关闭弹出窗口
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭编辑弹出窗口
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
            GetValue();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 获取按钮权限
 | 
						|
        /// <summary>
 | 
						|
        /// 获取按钮权限
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="button"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        private void GetButtonPower()
 | 
						|
        {
 | 
						|
            var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.EPSummaryReportMenuId);
 | 
						|
            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.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearId(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 单位下拉框联动事件
 | 
						|
        /// <summary>
 | 
						|
        /// 单位下拉框联动事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            GetValue();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 上一年度、下一年度
 | 
						|
        /// <summary>
 | 
						|
        /// 上一年度
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void BtnBulletLeft_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            int y = Convert.ToInt32(drpYear.SelectedValue) - 1;
 | 
						|
            drpYear.SelectedValue = y.ToString();
 | 
						|
            GetValue();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 下一年度
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void BtnBulletRight_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            int y = Convert.ToInt32(drpYear.SelectedValue) + 1;
 | 
						|
            drpYear.SelectedValue = y.ToString();
 | 
						|
            GetValue();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 查看未上报的项目
 | 
						|
        /// <summary>
 | 
						|
        /// 查看未上报的项目
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        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.StartDate.Value.Year <= date
 | 
						|
                            select x).ToList();
 | 
						|
            foreach (var item in projects)
 | 
						|
            {
 | 
						|
                var report = Funs.DB.InformationProject_EPSummaryReport.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.YearId == date);
 | 
						|
                if (report == null)
 | 
						|
                {
 | 
						|
                    info += item.ProjectCode + ":" + item.ProjectName + ",未填写报表;</br>";
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            if (!string.IsNullOrEmpty(info))
 | 
						|
            {
 | 
						|
                Alert.ShowInTop(info + "项目报表未上报。", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("项目报表已上报", MessageBoxIcon.Success);
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |