Пример #1
0
 private void LoadParentData()
 {
     id = WX.Request.rMenuId;
     if (id == 0)
     {
         Response.Redirect("Menu_List.aspx");
     }
     WX.Model.Menu.MODEL funNew = WX.Request.rMenu; //;WX.Model.Menu.GetModel("select * from TE_Menus where ID=" + id);
     WX.Data.Dict.BindListCtrl_MenuList(this.ui_ParentID, null, "0#最顶层", funNew.ParentID.ToString());
     ui_Name.Value  = funNew.Name.ToString();
     ui_Title.Value = funNew.Title.ToString();
     try
     {
         ui_State.SelectedIndex = int.Parse(funNew.State.value.ToString());
     }
     catch
     {
     }
     ui_Url.Value = funNew.Url.ToString();
     try
     {
         ui_icon.Value = "/Manage/icon/" + funNew.Icon.value.ToString();
     }
     catch
     {
     }
     nowimg.Src       = ui_icon.Value;
     ui_OrderID.Value = funNew.OrderID.value.ToString();
 }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            //2.取得用户变量
            int    id       = WX.Request.rMenuId;
            string name     = ui_Name.Value;
            int    parentID = String.IsNullOrEmpty(ui_ParentID.SelectedValue) ? 0 : Convert.ToInt32(ui_ParentID.SelectedValue);
            int    state    = Convert.ToInt32(ui_State.Value);
            string title    = Convert.ToString(ui_Title.Value);
            string url      = Convert.ToString(ui_Url.Value);
            int    degree   = this.getDegree(ui_ParentID.SelectedItem.Text);
            string icon     = ui_icon.Value.Substring(ui_icon.Value.LastIndexOf("/") + 1);
            int    orderid  = (ui_OrderID.Value.Trim() == "" ? 0 : Convert.ToInt32(ui_OrderID.Value.Trim()));

            //以下代码由后台开发人员填写
            //3.验证用户变量,包含Request.QueryString及Request.Form
            if (id == parentID)
            {
                ULCode.Debug.Alert(this, "自己不能选择自己为父目录!");
                return;
            }
            //4.业务处理过程
            WX.Model.Menu.MODEL funNew = WX.Request.rMenu; //WX.Model.Menu.GetModel("select * from TE_Menus where ID=" + Request["id"]);
            //if (ULCode.QDA.XSql.IsHasRow("select * from TE_Menus where ParentID=" + parentID + " and Name='" + name + "' and ID!=" + funNew.ID.value.ToString())==true)
            if (WX.Model.Menu.Caches.Find(delegate(WX.Model.Menu.MODEL dele) { return(dele.ParentID.ToInt32() == parentID && dele.ID.ToInt32() != id && dele.Name.ToString() == name); }) != null)
            {
                ULCode.Debug.Alert(this, "功能名称已存在,请重新输入!");
                return;
            }
            bool bDeal = false;

            funNew.Name.set(name);
            funNew.ParentID.set(parentID);
            funNew.State.set(state);
            funNew.Title.set(title);
            funNew.Url.set(url);
            funNew.Degree.set(degree);
            funNew.Icon.set(icon);
            funNew.OrderID.set(orderid);
            //Response.Write(parentID);
            int iR = funNew.Update();

            if (iR != 0)
            {
                bDeal = true;
                //6.登记日志
                if (bDeal)
                {
                    WX.Main.AddLog(WX.LogType.Default, "编辑功能成功!", "");
                }
                //7.返回处理结果或返回其它页面。
                ULCode.Debug.Confirm(this, "成功修改功能,是否返回功能列表页?", "Menu_List.aspx", this.Request.RawUrl);
                //Response.Redirect("Menu_List.aspx");
            }
            else
            {
                //funNew.RestoreInitial();
                ULCode.Debug.Alert(this, "编辑功能失败,可能是重复添加!");
            }
        }
Пример #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            //2.取得用户变量
            string name     = ui_Name.Value;
            int    parentID = String.IsNullOrEmpty(ui_ParentID.SelectedValue) ? 0 : Convert.ToInt32(ui_ParentID.SelectedValue);
            int    state    = Convert.ToInt32(ui_State.Value);
            string title    = Convert.ToString(ui_Title.Value);
            string url      = Convert.ToString(ui_Url.Value);
            int    degree   = this.getDegree(this.ui_ParentID.SelectedItem.Text);
            string icon     = ui_icon.Value.Substring(ui_icon.Value.LastIndexOf("/") + 1);
            int    orderid  = (ui_OrderID.Value.Trim() == ""?0:Convert.ToInt32(ui_OrderID.Value.Trim()));

            //以下代码由后台开发人员填写
            //3.验证用户变量,包含Request.QueryString及Request.Form

            //4.业务处理过程
            if (ULCode.QDA.XSql.IsHasRow("select * from TE_Menus where ParentID=" + parentID + " and Name='" + name + "'") == true)
            {
                ULCode.Debug.AjaxAlert(this, "菜单名称已存在,请重新输入!");
                return;
            }
            WX.Model.Menu.MODEL funNew = WX.Model.Menu.NewDataModel();
            funNew.Name.set(name);
            funNew.ParentID.set(parentID);
            funNew.State.set(state);
            funNew.Title.set(title);
            funNew.Url.set(url);
            funNew.Degree.set(degree);
            funNew.Icon.set(icon);
            funNew.OrderID.set(orderid);
            int iR = funNew.Insert(true);

            if (iR > 0)
            {
                funNew.SaveIntoCaches();
                //5.(用户及业务对象)统计与状态

                //6.登记日志
                WX.Main.AddLog(WX.LogType.Default, "添加菜单成功!", "");
                //7.返回处理结果或返回其它页面。
                ULCode.Debug.Confirm(this, "菜单添加成功!是否继续添加??", this.Request.RawUrl, "Menu_List.aspx");
            }
            else
            {
                ULCode.Debug.Alert(this, "添加菜单失败,可能是重复添加!");
            }
        }