Пример #1
0
 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
 {
     if (e.CommandName == "UDISABLED")
     {
         //编辑权限
         if (!VerifyPurview(",SM-EDIT,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
         bool          checkState = checkField.GetCheckedState(e.RowIndex);
         int           result     = new ModBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState);
         string        tipText    = (checkState ? "禁用" : "启用");
         if (result > 0)
         {
             Alert.ShowInParent(tipText + "成功!");
             BindData();
         }
         else
         {
             Alert.ShowInParent(tipText + "失败!");
         }
     }
     else if (e.CommandName == "MoveUp")
     {
         //排序权限
         if (!VerifyPurview(",SM-SORT,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         if (new ModBLL().ChangeSort(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), SortType.MoveUp) > 0)
         {
             BindData();
         }
     }
     else if (e.CommandName == "MoveDown")
     {
         //排序权限
         if (!VerifyPurview(",SM-SORT,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         if (new ModBLL().ChangeSort(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), SortType.MoveDown) > 0)
         {
             BindData();
         }
     }
 }
Пример #2
0
 private void LoadInfo()
 {
     if (id > 0)
     {
         ModModel model = new ModBLL().GetModelById(id);
         if (model != null)
         {
             txtName.Text              = HttpUtility.HtmlDecode(model.Name);
             txtLinkUrl.Text           = HttpUtility.HtmlDecode(model.Link);
             txtCode.Text              = HttpUtility.HtmlDecode(model.Code);
             chkDisabled.Checked       = model.Disabled;
             ddlParentId.SelectedValue = model.ParentId.ToString();
             txtIcon.Text              = HttpUtility.HtmlDecode(model.Icon);
         }
         else
         {
             Alert.ShowInParent("读取数据失败!", String.Empty, ActiveWindow.GetHideReference());
         }
     }
     else
     {
         Alert.ShowInParent("参数错误!", String.Empty, ActiveWindow.GetHideReference());
     }
 }
Пример #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //保存权限
            if (!VerifyPurview(",SM-EDIT,"))
            {
                Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
                return;
            }
            string strErr = String.Empty;
            int    num = 1, parentId = 0;

            if (id <= 0)
            {
                strErr += num + "、参数错误 <br />";
                num++;
            }
            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 />";
                num++;
            }
            if (!Int32.TryParse(ddlParentId.SelectedValue, out parentId) || parentId < 0)
            {
                strErr += num + "、请选择所属菜单 <br />";
            }
            if (strErr.Length > 0)
            {
                Alert.ShowInParent(strErr);
                return;
            }
            ModModel model = new ModModel();

            model.Id       = id;
            model.Name     = name;
            model.ParentId = parentId;
            model.Code     = code;
            model.Disabled = chkDisabled.Checked;
            model.Link     = HttpUtility.HtmlEncode(txtLinkUrl.Text.Trim());
            model.Icon     = HttpUtility.HtmlEncode(txtIcon.Text.Trim());
            int result = new ModBLL().Modify(model);

            if (result > 0)
            {
                Alert.ShowInParent("修改成功!", String.Empty, ActiveWindow.GetHidePostBackReference());
            }
            else if (result == -10000)
            {
                Alert.ShowInParent("同级菜单已存在该名称数据");
            }
            else
            {
                Alert.ShowInParent("修改数据失败");
            }
        }
Пример #4
0
        private void SaveData(bool isClose)
        {
            //新增权限
            if (!VerifyPurview(",SM-ADD,"))
            {
                Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
                return;
            }
            string strErr = String.Empty;
            int    num = 1, parentId = 0;
            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 />";
                num++;
            }
            if (!Int32.TryParse(ddlParentId.SelectedValue, out parentId) || parentId < 0)
            {
                strErr += num + "、请选择所属菜单 <br />";
            }
            if (strErr.Length > 0)
            {
                Alert.ShowInParent(strErr);
                return;
            }
            ModModel model = new ModModel();

            model.Name     = name;
            model.ParentId = parentId;
            model.Code     = code;
            model.Disabled = chkDisabled.Checked;
            model.Link     = HttpUtility.HtmlEncode(txtLinkUrl.Text.Trim());
            model.Icon     = HttpUtility.HtmlEncode(txtIcon.Text.Trim());
            int result = new ModBLL().Add(model);

            if (result > 0)
            {
                if (isClose)
                {
                    Alert.ShowInParent("保存成功!", String.Empty, ActiveWindow.GetHidePostBackReference());
                }
                else
                {
                    Alert.ShowInParent("保存成功!");
                    PageContext.Refresh();
                }
            }
            else if (result == -10000)
            {
                Alert.ShowInParent("同级菜单已存在该名称数据");
            }
            else
            {
                Alert.ShowInParent("保存失败");
            }
        }