Esempio n. 1
0
 /// <summary>
 /// 修改一条数据
 /// </summary>
 public int Modify(ADT.XingZhi.Models.S.Menu model)
 {
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@id",       SqlDbType.Int),
             new SqlParameter("@pid",      SqlDbType.Int),
             new SqlParameter("@name",     SqlDbType.NVarChar,  50),
             new SqlParameter("@code",     SqlDbType.VarChar,   10),
             new SqlParameter("@icon",     SqlDbType.NVarChar, 200),
             new SqlParameter("@link",     SqlDbType.NVarChar, 200),
             new SqlParameter("@disabled", SqlDbType.Bit),
             new SqlParameter("@result",   SqlDbType.Int)
         };
         param[0].Value     = model.Id;
         param[1].Value     = model.ParentId;
         param[2].Value     = model.Name;
         param[3].Value     = model.Code;
         param[4].Value     = model.Icon;
         param[5].Value     = model.Link;
         param[6].Value     = model.Disabled;
         param[7].Direction = ParameterDirection.Output;
         SqlHelper.ExecuteNonQuery(DefaultConnection.ConnectionStringByDefaultDB, CommandType.StoredProcedure, "sp_modify_S_Menu", param);
         return(Convert.ToInt32(param[7].Value));
     }
     catch (ArgumentNullException ex)
     {
         logger.Error("调用方法Modify(ADT.XingZhi.Models.S.Menu model)发生ArgumentNullException", ex);
     }
     catch (SqlException ex)
     {
         logger.Error("调用方法Modify(ADT.XingZhi.Models.S.Menu model)发生SqlException", ex);
     }
     catch (Exception ex)
     {
         logger.Error("调用方法Modify(ADT.XingZhi.Models.S.Menu model)发生Exception", ex);
     }
     return(-1);
 }
Esempio n. 2
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("修改数据失败");
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 修改一条数据
 /// </summary>
 /// <param name="model">Model</param>
 public int Modify(ADT.XingZhi.Models.S.Menu model)
 {
     return(dal.Modify(model));
 }
Esempio n. 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("保存失败");
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 新增一条数据
 /// </summary>
 /// <param name="model">Model</param>
 public int Add(ADT.XingZhi.Models.S.Menu model)
 {
     return(dal.Add(model));
 }