/// <summary>
 /// 保存按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HazardRegisterTypesSupervisionMenuId, Const.BtnSave))
     {
         Model.HSSE_Hazard_HazardRegisterTypes title = new Model.HSSE_Hazard_HazardRegisterTypes();
         title.RegisterTypesName = this.txtRegisterTypesName.Text.Trim();
         title.TypeCode          = this.txtTypeCode.Text.Trim();
         if (this.drpGroupType.SelectedValue != BLL.Const._Null)
         {
             title.GroupType = this.drpGroupType.SelectedValue;
         }
         title.Remark             = this.txtRemark.Text.Trim();
         title.HazardRegisterType = "3";   //安全督查类型
         if (string.IsNullOrEmpty(this.RegisterTypesId))
         {
             this.RegisterTypesId  = SQLHelper.GetNewID(typeof(Model.HSSE_Hazard_HazardRegisterTypes));
             title.RegisterTypesId = this.RegisterTypesId;
             BLL.HSSE_Hazard_HazardRegisterTypesService.AddHazardRegisterTypes(title);
             BLL.LogService.AddSys_Log(this.CurrUser, title.TypeCode, title.RegisterTypesId, BLL.Const.HazardRegisterTypesSupervisionMenuId, BLL.Const.BtnAdd);
         }
         else
         {
             title.RegisterTypesId = this.RegisterTypesId;
             BLL.HSSE_Hazard_HazardRegisterTypesService.UpdateHazardRegisterTypes(title);
             BLL.LogService.AddSys_Log(this.CurrUser, title.TypeCode, title.RegisterTypesId, BLL.Const.HazardRegisterTypesSupervisionMenuId, BLL.Const.BtnModify);
         }
         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
     }
     else
     {
         ShowNotify("您没有这个权限,请与管理员联系!");
     }
 }
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHideReference();

                this.RegisterTypesId = Request.QueryString["RegisterTypesId"];
                if (!string.IsNullOrEmpty(this.RegisterTypesId))
                {
                    Model.HSSE_Hazard_HazardRegisterTypes title = BLL.HSSE_Hazard_HazardRegisterTypesService.GetTitleByRegisterTypesId(this.RegisterTypesId);
                    if (title != null)
                    {
                        this.txtRegisterTypesName.Text = title.RegisterTypesName;
                        this.txtTypeCode.Text          = title.TypeCode;
                        if (title.IsPunished == true)
                        {
                            chkIsPunished.Checked = true;
                        }
                        else
                        {
                            chkIsPunished.Checked = false;
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 删除职务信息
 /// </summary>
 /// <param name="RegisterTypesId"></param>
 public static void DeleteTitle(string RegisterTypesId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.HSSE_Hazard_HazardRegisterTypes types = db.HSSE_Hazard_HazardRegisterTypes.FirstOrDefault(e => e.RegisterTypesId == RegisterTypesId);
     if (types != null)
     {
         db.HSSE_Hazard_HazardRegisterTypes.DeleteOnSubmit(types);
         db.SubmitChanges();
     }
 }
        /// <summary>
        /// 修改巡检问题类型信息
        /// </summary>
        /// <param name="RegisterTypesId"></param>
        /// <param name="RegisterTypesName"></param>
        /// <param name="TypeCode"></param>
        public static void UpdateHazardRegisterTypes(Model.HSSE_Hazard_HazardRegisterTypes types)
        {
            Model.SUBHSSEDB db = Funs.DB;
            Model.HSSE_Hazard_HazardRegisterTypes newTitle = db.HSSE_Hazard_HazardRegisterTypes.FirstOrDefault(e => e.RegisterTypesId == types.RegisterTypesId);
            if (newTitle != null)
            {
                newTitle.RegisterTypesName = types.RegisterTypesName;
                newTitle.TypeCode          = types.TypeCode;
                newTitle.GroupType         = types.GroupType;
                newTitle.Remark            = types.Remark;
                newTitle.IsPunished        = types.IsPunished;

                db.SubmitChanges();
            }
        }
        /// <summary>
        /// 添加巡检问题类型信息
        /// </summary>
        /// <param name="RegisterTypesName"></param>
        /// <param name="TypeCode"></param>
        public static void AddHazardRegisterTypes(Model.HSSE_Hazard_HazardRegisterTypes types)
        {
            Model.SUBHSSEDB db = Funs.DB;
            Model.HSSE_Hazard_HazardRegisterTypes newTitle = new Model.HSSE_Hazard_HazardRegisterTypes();
            newTitle.RegisterTypesId    = types.RegisterTypesId;
            newTitle.RegisterTypesName  = types.RegisterTypesName;
            newTitle.TypeCode           = types.TypeCode;
            newTitle.HazardRegisterType = types.HazardRegisterType;
            newTitle.GroupType          = types.GroupType;
            newTitle.Remark             = types.Remark;
            newTitle.IsPunished         = types.IsPunished;

            db.HSSE_Hazard_HazardRegisterTypes.InsertOnSubmit(newTitle);
            db.SubmitChanges();
        }
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHideReference();

                this.RegisterTypesId = Request.QueryString["RegisterTypesId"];
                Funs.FineUIPleaseSelect(this.drpGroupType);
                if (!string.IsNullOrEmpty(this.RegisterTypesId))
                {
                    Model.HSSE_Hazard_HazardRegisterTypes title = BLL.HSSE_Hazard_HazardRegisterTypesService.GetTitleByRegisterTypesId(this.RegisterTypesId);
                    if (title != null)
                    {
                        this.txtRegisterTypesName.Text = title.RegisterTypesName;
                        if (!string.IsNullOrEmpty(title.GroupType))
                        {
                            this.drpGroupType.SelectedValue = title.GroupType;
                        }
                        this.txtTypeCode.Text = title.TypeCode;
                        this.txtRemark.Text   = title.Remark;
                    }
                }
            }
        }