Ejemplo n.º 1
0
 public static void ChangeChildPkPath(string menupk, string pkpath, int grade, DB_OPT dbo)
 {
     MenuModel model = new MenuDal();
     MenuModel[] childs = model.GetChilds(menupk, dbo);
     if (childs != null)
     {
         for (int i = 0; i < childs.Length; i++)
         {
             model.MemuPK = childs[i].MemuPK;
             model.Grade = grade;
             model.PKPath = pkpath;
             model.UpdatePKPathAndGrade(dbo);
             if (childs[i].IsHasBaby == "1")
             {
                 ChangeChildPkPath(childs[i].MemuPK, pkpath + model.MemuPK + "|", grade + 1, dbo);
             }
         }
     }
     else
     {
         model.MemuPK = menupk;
         model.IsHasBaby = "0";
         model.UpdateHasBaby(dbo);
     }
 }
Ejemplo n.º 2
0
 private void SetValue(MenuModel mm)
 {
     this.txtfwqxbm.Text = mm.PowerCode;
     this.txtMenuMemo.Text = mm.Discription;
     this.txtMenuName.Text = mm.MenuName;
     this.txtMenuUrl.Text = mm.PageUrl;
     this.txtTally.Text = mm.VisitPoint.ToString();
     this.txtMenuPX.Text = mm.OrderBy.ToString();
     this.drpdWindow.SelectedValue = mm.OpenType;
     this.drpdPodomZT.SelectedValue = mm.IsCheckPower;
     this.drpdIsList.SelectedValue = mm.IsShow;
     this.DrpType.SelectedValue = mm.MenuType;
     this.fl1.ImageUrl = mm.ImgUrl;
     this.txtishasbaby.Value = mm.IsHasBaby;
     this.FartherMenuPK.Value = mm.FatherPK.Trim();
     if (mm.FatherPK.Trim() != "")
     {
         MenuModel model = new MenuDal();
         this.txtFartherMenu.Text = model.GetList("MemuPK='" + mm.FatherPK + "'", this.dbo).Tables[0].Rows[0]["MenuName"].ToString();
     }
 }
Ejemplo n.º 3
0
 private void UpdateMenu()
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         this.dbo.TranFar();
         if (this.txtMenuName.Text.Trim() == "")
         {
             Const.ShowMessage("带*的数据必须填写!", this.Page);
         }
         else
         {
             string oldpath = "";
             if (this.fl1.LoadFile.HasFile)
             {
                 string menuUrl = ConfigMenu.MenuUrl;
                 oldpath = ConfigMenu.MenuUrl;
                 string str3 = Public.UpFile(base.Server.MapPath(Public.RelativelyPath(oldpath)), this.fl1.LoadFile.PostedFile);
                 if (menuUrl != "")
                 {
                     oldpath = menuUrl + "/" + str3;
                 }
                 else
                 {
                     oldpath = str3;
                 }
             }
             else
             {
                 oldpath = this.fl1.ImageUrl;
             }
             MenuModel model = new MenuDal();
             MenuModel model2 = new MenuDal();
             model.FatherPK = this.FartherMenuPK.Value;
             if (model.FatherPK != "")
             {
                 model.MemuPK = model.FatherPK;
                 model = model.GetModel(false, this.dbo);
                 if (model.IsHasBaby == "0")
                 {
                     model2.MemuPK = model.MemuPK;
                     model2.UpdateHasBaby(this.dbo);
                 }
                 model2.PKPath = model.PKPath + model.MemuPK + "|";
                 if (this.txtishasbaby.Value == "1")
                 {
                     MenuDal.ChangeChildPkPath(base.Request.QueryString["PK"].ToString(), model2.PKPath + base.Request.QueryString["PK"].ToString() + "|", model.Grade + 2, this.dbo);
                 }
                 model2.Grade = model.Grade + 1;
             }
             else
             {
                 model2.Grade = 0;
             }
             model2.FatherPK = this.FartherMenuPK.Value.Trim();
             model2.IsHasBaby = this.txtishasbaby.Value;
             model2.MemuPK = base.Request.QueryString["PK"].ToString();
             model2.PowerCode = this.txtfwqxbm.Text.Trim();
             model2.Discription = this.txtMenuMemo.Text;
             model2.MenuName = this.txtMenuName.Text;
             model2.ImgUrl = oldpath;
             model2.PageUrl = this.txtMenuUrl.Text;
             model2.VisitPoint = int.Parse(this.txtTally.Text);
             model2.OrderBy = int.Parse(this.txtMenuPX.Text);
             model2.OpenType = this.drpdWindow.SelectedValue;
             model2.IsCheckPower = this.drpdPodomZT.SelectedValue;
             model2.IsShow = this.drpdIsList.SelectedValue;
             model2.MenuType = this.DrpType.SelectedValue;
             model2.pk_corp = HttpContext.Current.Session["pk_corp"].ToString();
             model2.Update(this.dbo);
             this.dbo.Commit();
             Const.DoSuccessClose("", this.Page);
         }
     }
     catch (Exception exception)
     {
         this.dbo.RollBack();
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "UpdateMenu()";
         this.el.WriteExceptionLog(true);
         Const.OpenErrorPage("操作失败,请联系管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
Ejemplo n.º 4
0
 private string GetStrParent(string pkpath)
 {
     string str;
     try
     {
         string str2 = "";
         this.dbo = new DB_OPT();
         this.dbo.Open();
         MenuModel[] parents = new MenuDal { PKPath = pkpath }.GetParents(this.dbo);
         for (int i = 0; i < parents.Length; i++)
         {
             str2 = parents[i].MemuPK + "~" + str2;
         }
         if (str2.Length > 0)
         {
             str2 = str2.Substring(0, str2.Length - 1);
         }
         str = str2;
     }
     catch (Exception)
     {
         str = "";
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
     return str;
 }
Ejemplo n.º 5
0
 public void BindTV(DB_OPT dbo)
 {
     DataSet list = new MenuDal().GetList("", dbo);
     this.GetTreeView(list);
 }
Ejemplo n.º 6
0
 private void BindTV(DB_OPT dbo)
 {
     MenuModel model = new MenuDal();
     string str = ((UserModel)this.Session["User"]).Power.Replace('|', ',');
     string strWhere = "";
     if (((UserModel)this.Session["User"]).UserName != "admin")
     {
         strWhere = " PowerCode in (" + str + ")";
     }
     DataSet list = model.GetList(strWhere, dbo);
     this.GetTreeView(list);
 }
Ejemplo n.º 7
0
    public void LoadAction()
    {
        Response.Buffer = true;
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.Expires = 0;
        Response.CacheControl = "no-cache";
        Response.AddHeader("Pragma", "No-Cache");

        string active = HttpContext.Current.Request["action"];                                          //提交类型
        string ModuleId = HttpContext.Current.Request["ModuleId"];
        MenuModel model = new MenuDal();
        string strWhere = "";
        switch (active)
        {
            case "LoadAccordionMenu":   //加载手风琴菜单
                StringBuilder sb_html = new StringBuilder();
                try
                {
                    if (this.Session["User"] != null)
                    {
                        string power = ((UserModel)this.Session["User"]).Power;
                        if (power != "")
                        {
                            if (((UserModel)this.Session["User"]).UserName != "admin")
                            {
                                strWhere = "patindex('%|'||rtrim(PowerCode)||'|%','|" + power + "|')>0 or ISCHECKPOWER='0'";
                            }
                        }
                    }
                    this.dbo = new DB_OPT();
                    this.dbo.Open();
                    DataTable dt = model.GetList(strWhere, dbo).Tables[0];
                    DataRow[] rows = dt.Select("Grade='0' and IsShow='1'");
                    foreach (DataRow dr in rows)
                    {

                        sb_html.Append("<li title=" + dr["MENUNAME"] + ">");
                        sb_html.Append("<div class=\"link\">");
                        sb_html.Append("<img src=" + dr["IMGURL"] + ">&nbsp;&nbsp;<span>" + dr["MENUNAME"] + "</span><i class=\"chevron-down\"></i>");
                        sb_html.Append("</div>");
                        sb_html.Append("<div id=\"" + dr["MEMUPK"].ToString().Trim() + "\" class=\"submenu bottomline\"></div>");
                        sb_html.Append("</li>");
                    }
                }
                catch (Exception exception)
                {
                    this.el = new ExceptionLog.ExceptionLog();
                    this.el.ErrClassName = base.GetType().ToString();
                    this.el.ErrMessage = exception.Message.ToString();
                    this.el.ErrMethod = "Page_Load()";
                    this.el.WriteExceptionLog(true);
                    PageShowText.OpenErrorPage("获取数据失败,请联系管理员!", this.Page);
                }
                finally
                {
                    if (this.dbo != null)
                    {
                        this.dbo.Close();
                    }
                }
                Response.Write(sb_html.ToString());
                Response.End();
                break;
            case "LoadTreeMenu":        //加载子树菜单
                if (this.Session["User"] != null)
                {
                    string power = ((UserModel)this.Session["User"]).Power;
                    if (power != "")
                    {
                        if (((UserModel)this.Session["User"]).UserName != "admin")
                        {
                            strWhere = "patindex('%|'||rtrim(PowerCode)||'|%','|" + power + "|')>0 or ISCHECKPOWER='0'";
                        }
                    }
                }
                this.dbo = new DB_OPT();
                this.dbo.Open();
                DataTable submenu_dt = model.GetList(strWhere, dbo).Tables[0];
                DataRow[] submenu_rows = submenu_dt.Select("IsShow='1'");
                List<TreeJsonEntity> TreeList = new List<TreeJsonEntity>();
                foreach (DataRow dr in submenu_rows)
                {
                    TreeJsonEntity tree = new TreeJsonEntity();
                    bool hasChildren = false;
                    DataRow[] childnode = submenu_dt.Select("FatherPK='" + dr["MEMUPK"].ToString() + "'");
                    if (childnode.Length > 0)
                    {
                        hasChildren = true;
                    }
                    tree.id = dr["MEMUPK"].ToString().Trim();
                    tree.text = dr["MENUNAME"].ToString();
                    tree.value = dr["MEMUPK"].ToString().Trim();
                    tree.title = dr["PAGEURL"].ToString().Trim();
                    tree.img = dr["IMGURL"].ToString().Trim();
                    tree.isexpand = false;
                    tree.complete = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId = dr["FATHERPK"].ToString();
                    TreeList.Add(tree);
                }
                string str = TreeList.TreeToJson(ModuleId).Trim();
                Response.Write(TreeList.TreeToJson(ModuleId).Trim());
                Response.End();
                break;
            default:
                break;
        }
    }
Ejemplo n.º 8
0
 public MenuModel[] GetMenuList(string parentid)
 {
     MenuModel[] modelArray;
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         modelArray = new MenuDal().GetModels("FatherPK='" + parentid.Split(new char[] { '|' })[0] + "'", false, this.dbo);
     }
     catch (Exception)
     {
         modelArray = null;
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
     return modelArray;
 }