Beispiel #1
0
 /// <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.PunishItemMenuId, Const.BtnSave))
     {
         Model.HSSE_Hazard_PunishItem title = new Model.HSSE_Hazard_PunishItem();
         title.PunishItemCode    = this.txtPunishItemCode.Text.Trim();
         title.PunishItemType    = this.rblPunishItemType.SelectedValue;
         title.PunishItemContent = this.txtPunishItemContent.Text.Trim();
         title.Deduction         = Funs.GetNewInt(this.drpDeduction.SelectedValue);
         title.PunishMoney       = Funs.GetNewInt(this.txtPunishMoney.Text.Trim());
         if (string.IsNullOrEmpty(this.PunishItemId))
         {
             this.PunishItemId  = SQLHelper.GetNewID(typeof(Model.HSSE_Hazard_PunishItem));
             title.PunishItemId = this.PunishItemId;
             BLL.HSSE_Hazard_PunishItemService.AddPunishItem(title);
             BLL.LogService.AddSys_Log(this.CurrUser, title.PunishItemCode, title.PunishItemId, BLL.Const.PunishItemMenuId, BLL.Const.BtnAdd);
         }
         else
         {
             title.PunishItemId = this.PunishItemId;
             BLL.HSSE_Hazard_PunishItemService.UpdatePunishItem(title);
             BLL.LogService.AddSys_Log(this.CurrUser, title.PunishItemCode, title.PunishItemId, BLL.Const.PunishItemMenuId, BLL.Const.BtnModify);
         }
         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
     }
     else
     {
         ShowNotify("您没有这个权限,请与管理员联系!");
     }
 }
Beispiel #2
0
        /// <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.PunishItemId = Request.QueryString["PunishItemId"];
                if (!string.IsNullOrEmpty(this.PunishItemId))
                {
                    Model.HSSE_Hazard_PunishItem title = BLL.HSSE_Hazard_PunishItemService.GetTitleByPunishItemId(this.PunishItemId);
                    if (title != null)
                    {
                        this.txtPunishItemCode.Text = title.PunishItemCode;
                        if (title.PunishItemType == "1")
                        {
                            this.rblPunishItemType.SelectedValue = "1";
                        }
                        else
                        {
                            this.rblPunishItemType.SelectedValue = "2";
                        }
                        this.txtPunishItemContent.Text = title.PunishItemContent;
                        if (title.Deduction != null)
                        {
                            this.drpDeduction.SelectedValue = title.Deduction.ToString();
                        }
                        if (title.PunishMoney != null)
                        {
                            this.txtPunishMoney.Text = title.PunishMoney.ToString();
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 删除职务信息
 /// </summary>
 /// <param name="PunishItemId"></param>
 public static void DeleteTitle(string PunishItemId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.HSSE_Hazard_PunishItem types = db.HSSE_Hazard_PunishItem.FirstOrDefault(e => e.PunishItemId == PunishItemId);
     if (types != null)
     {
         db.HSSE_Hazard_PunishItem.DeleteOnSubmit(types);
         db.SubmitChanges();
     }
 }
        /// <summary>
        /// 添加处罚基础信息
        /// </summary>
        /// <param name="PunishItemName"></param>
        /// <param name="TypeCode"></param>
        public static void AddPunishItem(Model.HSSE_Hazard_PunishItem types)
        {
            Model.SUBHSSEDB db = Funs.DB;
            Model.HSSE_Hazard_PunishItem newTitle = new Model.HSSE_Hazard_PunishItem();
            newTitle.PunishItemId      = types.PunishItemId;
            newTitle.PunishItemCode    = types.PunishItemCode;
            newTitle.PunishItemType    = types.PunishItemType;
            newTitle.PunishItemContent = types.PunishItemContent;
            newTitle.Deduction         = types.Deduction;
            newTitle.PunishMoney       = types.PunishMoney;

            db.HSSE_Hazard_PunishItem.InsertOnSubmit(newTitle);
            db.SubmitChanges();
        }
        /// <summary>
        /// 修改处罚基础信息
        /// </summary>
        /// <param name="PunishItemId"></param>
        /// <param name="PunishItemName"></param>
        /// <param name="TypeCode"></param>
        public static void UpdatePunishItem(Model.HSSE_Hazard_PunishItem types)
        {
            Model.SUBHSSEDB db = Funs.DB;
            Model.HSSE_Hazard_PunishItem newTitle = db.HSSE_Hazard_PunishItem.FirstOrDefault(e => e.PunishItemId == types.PunishItemId);
            if (newTitle != null)
            {
                newTitle.PunishItemCode    = types.PunishItemCode;
                newTitle.PunishItemType    = types.PunishItemType;
                newTitle.PunishItemContent = types.PunishItemContent;
                newTitle.Deduction         = types.Deduction;
                newTitle.PunishMoney       = types.PunishMoney;

                db.SubmitChanges();
            }
        }