예제 #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);
     }
 }
예제 #2
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();
         }
     }
 }