Beispiel #1
0
        protected void btnSure_Click(object sender, EventArgs e)
        {
            #region model赋值
            Model.T_Dictionary model = new Model.T_Dictionary();
            model.dType    = ddlParentId.SelectedValue;
            model.dNum     = txtNum.Text.Trim();
            model.dName    = txtName.Text.Trim();
            model.dSortNum = Convert.ToInt32(txtSortId.Text);
            if (model.dType == "00")
            {
                model.dLevel = 1;
            }
            else
            {
                model.dLevel = 2;
            }
            if (bll.GetCount(" and dNum='" + model.dNum + "' and dType='" + model.dType + "' and ID!=" + id) > 0 || model.dNum == "00")
            {
                JscriptMsg("相同父级下的菜单标号不能重复!", "", "Error");
                return;
            }
            #endregion


            if (action == MXEnums.ActionEnum.Edit.ToString()) //修改
            {
                model.ID = id;

                ChkAdminLevel(levelName, MXEnums.ActionEnum.Edit.ToString()); //检查权限
                if (!bll.Update(model))
                {
                    JscriptMsg("保存过程中发生错误!", "", "Error");
                    return;
                }
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), GetAdminInfo().real_name + " 修改数据字典:" + model.dName); //记录日志
                JscriptMsg("修改信息成功!", backUrl, "Success");
            }
            else //添加
            {
                ChkAdminLevel(levelName, MXEnums.ActionEnum.Add.ToString()); //检查权限
                if (bll.Insert(model) <= 0)
                {
                    JscriptMsg("保存过程中发生错误!", "", "Error");
                    return;
                }
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), GetAdminInfo().real_name + " 添加数据字典:" + model.dName); //记录日志
                JscriptMsg("添加信息成功!", backUrl, "Success");
            }
        }
Beispiel #2
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(LevelName, MXEnums.ActionEnum.Edit.ToString()); //检查权限
     Model.T_Dictionary model = new Model.T_Dictionary();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         model.ID       = id;
         model.dSortNum = sortId;
         bll.Update(model);
     }
     AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存数据字典排序"); //记录日志
     JscriptMsg("保存排序成功!", ThisUrl, "Success");
 }