Example #1
0
 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
 {
     if (e.CommandName == "UDISABLED")
     {
         //编辑权限
         if (!VerifyPurview(",SM-SET,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
         bool          checkState = checkField.GetCheckedState(e.RowIndex);
         int           result     = new PCBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState);
         string        tipText    = (checkState ? "禁用" : "启用");
         if (result > 0)
         {
             Alert.ShowInParent(tipText + "成功!");
             BindData();
         }
         else
         {
             Alert.ShowInParent(tipText + "失败!");
         }
     }
     if (e.CommandName == "Edit")
     {
         txtID.Text          = Grid1.DataKeys[e.RowIndex][0].ToString();
         txtName.Text        = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][1].ToString());
         txtCode.Text        = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][2].ToString()).Split('-')[1];
         chkDisabled.Checked = Convert.ToBoolean(Grid1.DataKeys[e.RowIndex][3].ToString());
     }
 }
Example #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //设置权益
            if (!VerifyPurview(",SM-SET,"))
            {
                Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
                return;
            }
            if (mid <= 0 || mcode.Length == 0)
            {
                Alert.ShowInParent("参数错误");
                return;
            }
            string strErr = String.Empty;
            int    num    = 1;
            string name   = HttpUtility.HtmlEncode(txtName.Text.Trim());

            if (name.Length == 0)
            {
                strErr += num + "、权益名称不能为空 <br />";
                num++;
            }
            string code = HttpUtility.HtmlEncode(txtCode.Text.Trim());

            if (code.Length == 0)
            {
                strErr += num + "、权益编码不能为空 <br />";
            }
            if (strErr.Length > 0)
            {
                Alert.ShowInParent(strErr);
                return;
            }
            PCModel model = new PCModel();

            model.Id       = Convert.ToInt32(txtID.Text);
            model.Name     = name;
            model.Code     = mcode + "-" + code;
            model.MenuId   = mid;
            model.Disabled = chkDisabled.Checked;
            string tipTitle = model.Id == 0 ? "添加" : "修改";
            int    result   = new PCBLL().Save(model);

            if (result > 0)
            {
                BindData();
            }
            else if (result == -10000)
            {
                Alert.ShowInParent("存在相同的权益编码");
            }
            else
            {
                Alert.ShowInParent(tipTitle + "数据失败");
            }
        }