Exemplo n.º 1
0
	    // GET: Menus
        public async Task<ActionResult> List()
        {
			var model = new MenuModel();
	        var response = await _menusService.GetMenus();

            return View(model.Adapt(response.Menus));
        }
Exemplo n.º 2
0
 private static void FillInformations(IEnumerable<Item> items, MenuModel menu)
 {
     foreach (var item in items)
     {
         item.Menu = menu;
         var loaderItem = item as ContentLoaderItem;
         var commandItem = item as CommandItem;
         var userControlItem = item as UserControlItem;
         if (loaderItem != null)
         {
             loaderItem.Command = new UiCommand(delegate
             {
                 var loadedItems = loaderItem.Items();
                 FillInformations(loadedItems, menu);
                 menu.PushItems(loadedItems, loaderItem.Name);
             });
         }
         if (commandItem != null)
         {
             commandItem.Command = new UiCommand(o =>
             {
                 commandItem.Action();
                 Dispatch("Remove PopUps", new Func<PopUp, bool>(popUp => ReferenceEquals(popUp.PopUpElement, o)));
                 menu.Reset();
             });
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MenuModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into MenuInfo(");
            strSql.Append("Id,MenuName,ParentId,Url,MenuDes)");
            strSql.Append(" values (");
            strSql.Append("@Id,@MenuName,@ParentId,@Url,@MenuDes)");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@MenuName", SqlDbType.VarChar,150),
                    new SqlParameter("@ParentId", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@Url", SqlDbType.VarChar,350),
                    new SqlParameter("@MenuDes", SqlDbType.VarChar)};
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = model.MenuName;
            parameters[2].Value = Guid.NewGuid();
            parameters[3].Value = model.Url;
            parameters[4].Value = model.MenuDes;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 4
0
        public void ActionTest()
        {
            this.dialog1.Active = false;
            this.dialog2.Active = true;

            MenuModel target = new MenuModel();
            target.MenuDialogs = this.dialogs;
            target.Action();

            Assert.AreEqual(0, action11);
            Assert.AreEqual(1, action21);
        }
Exemplo n.º 5
0
        public void DownTest()
        {
            this.dialog1.Active = false;
            this.dialog2.Active = true;

            MenuModel target = new MenuModel();
            target.MenuDialogs = this.dialogs;
            target.Down();

            Assert.IsTrue(this.menuItem11.Selected);
            Assert.IsFalse(this.menuItem12.Selected);
            Assert.IsFalse(this.menuItem21.Selected);
            Assert.IsTrue(this.menuItem22.Selected);
        }
Exemplo n.º 6
0
        public void BuildMenuBar(MenuBarDefinition menuBarDefinition, MenuModel result)
        {
            var menus = _menus
                .Where(x => x.MenuBar == menuBarDefinition)
                .OrderBy(x => x.SortOrder);

            foreach (var menu in menus)
            {
                var menuModel = new TextMenuItem(menu);
                AddGroupsRecursive(menu, menuModel);
                if (menuModel.Children.Any())
                    result.Add(menuModel);
            }
        }
Exemplo n.º 7
0
        private void MenuSelected(MenuModel menu)
        {
            if (Works.FirstOrDefault(x => x.Menu.Equals(menu)) is null)
            {
                IFlowElement content = null;

                switch (menu.IconType)
                {
                case GeoIcon.FolderOpenOutline: content = new Finder().UseViewModel(new FinderViewModel()); break;

                case GeoIcon.EyedropperVariant: content = new ColorSpoid().UseViewModel(new ColorSpoidViewModel()); break;

                case GeoIcon.Palette: content = new SwitchSkin().UseViewModel(Skin); break;

                case GeoIcon.Web: content = new Translator().UseViewModel(Translate); break;

                case GeoIcon.Close: Environment.Exit(0); break;

                default: content = new EmptyView(); break;
                }
                content.OnShow(menu);
            }
        }
Exemplo n.º 8
0
        //To delete Employee details
        public bool AddToCart(int Id, string UserName, int Quantity)
        {
            connection();
            MenuModel  mMenuModel = new MenuModel();
            SqlCommand com        = new SqlCommand("spr_AddCart", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@FoodID", Id);
            com.Parameters.AddWithValue("@UserName", UserName);
            com.Parameters.AddWithValue("@Quantity", Quantity);
            con.Open();
            int i = com.ExecuteNonQuery();

            con.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public bool EditMenu(MenuModel obj)
        {
            connection();
            SqlCommand com = new SqlCommand("spr_EditMenu", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@ID", obj.ID);
            com.Parameters.AddWithValue("@FoodName", obj.FoodName);
            com.Parameters.AddWithValue("@Description", obj.Description);
            com.Parameters.AddWithValue("@Price", obj.Price);
            con.Open();
            int i = com.ExecuteNonQuery();

            con.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 10
0
 public bool InsertMenu(MenuModel model)
 {
     try
     {
         var mn = new SysMenus
         {
             Id        = model.Id,
             SortOrder = model.Sequence ?? 0,
             Name      = model.Name,
             URL       = model.URL,
             IconCss   = model.Icon,
             ParentId  = model.ParentId
         };
         _db.SysMenus.Add(mn);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         LogHelper.Error("MenuRepository insert: " + ex.Message + " Inner Exception: " + ex.InnerException.Message);
         return(false);
     }
 }
Exemplo n.º 11
0
        public ActionResult Create()
        {
            if (!CheckPermission(MenusPermissions.ManageMenus))
            {
                return(new HttpUnauthorizedResult());
            }

            WorkContext.Breadcrumbs.Add(T("Menus"), Url.Action("Index", new { area = Constants.Areas.Menus }));
            WorkContext.Breadcrumbs.Add(T("Create"));

            var model = new MenuModel();

            var result = new ControlFormResult <MenuModel>(model)
            {
                Title                = T("Create Menu").Text,
                UpdateActionName     = "Update",
                ShowBoxHeader        = false,
                FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml,
                FormWrapperEndHtml   = Constants.Form.FormWrapperEndHtml
            };

            return(result);
        }
Exemplo n.º 12
0
        public IHttpActionResult GetProjectAllMenu(string projectGuid)
        {
            ResponseBase <MenuModel> response = new ResponseBase <MenuModel>()
            {
                IsSuccess      = true,
                MessageCode    = (int)ApiBaseErrorCode.API_SUCCESS,
                MessageContent = ApiBaseErrorCode.API_SUCCESS.ToString()
            };

            if (string.IsNullOrWhiteSpace(projectGuid))
            {
                response.IsSuccess      = false;
                response.MessageCode    = (int)ApiBaseErrorCode.API_PARAM_ERROR;
                response.MessageContent = "项目标识不能为空,请检查";
                return(Ok(response));
            }

            MenuModel content = menumanager.GetMenu(projectGuid);

            response.Result = content;

            return(Ok(response));
        }
Exemplo n.º 13
0
        public MenuModel RenderMenu(string menuCode)
        {
            using (EntitiesContext context = new EntitiesContext()) {
                var menu = context.MenuEssences.Where(a => a.Code == menuCode).FirstOrDefault(); //.Find(menuCode);

                if (menu == null)
                {
                    throw new ValidationException("Меню не найдено", "");
                }

                var menuModel = new MenuModel {
                    Id        = menu.Id,
                    Code      = menu.Code,
                    TitleMenu = menu.TitleMenu
                };

                if (menu.MenuItems != null)
                {
                    var listMenuItem = new List <MenuItemModel>();
                    foreach (var menuItems in menu.MenuItems)
                    {
                        var menuItem = new MenuItemModel {
                            Id            = menuItems.Id,
                            MenuID        = menuItems.MenuID.Value,
                            PageID        = menuItems.PageID,
                            TitleMenuItem = menuItems.TitleMenuItem,
                            Url           = menuItems.Url,
                            Weight        = menuItems.Weight
                        };
                        listMenuItem.Add(menuItem);
                    }
                    menuModel.MenuItemsModel = listMenuItem;
                }

                return(menuModel);
            }
        }
Exemplo n.º 14
0
 /*==Update -  Store ==*/
 public void Update(MenuModel _params)
 {
     try
     {
         _uow.MenuRepo.ExcQuery("exec sp_Menu_Update " +
                                "@Menu_ID," +
                                "@Parent_ID," +
                                "@Menu_Name," +
                                "@Display_Order," +
                                "@Is_Active",
                                new SqlParameter("Menu_ID", SqlDbType.Int)
         {
             Value = _params.Menu_ID
         },
                                new SqlParameter("Parent_ID", SqlDbType.Int)
         {
             Value = _params.Parent_ID ?? 0
         },
                                new SqlParameter("Menu_Name", SqlDbType.NVarChar, (50))
         {
             Value = _params.Menu_Name ?? DBNull.Value.ToString()
         },
                                new SqlParameter("Display_Order", SqlDbType.Int)
         {
             Value = _params.Display_Order ?? 1
         },
                                new SqlParameter("Is_Active", SqlDbType.Bit)
         {
             Value = _params.Is_Active ?? true
         }
                                );
     }
     catch (Exception ex)
     {
         throw new Exception("Có lỗi xãy ra trong quá trình cập nhật " + ex.Message);
     }
 }
Exemplo n.º 15
0
        public ActionResult AddMenu(MenuModel model)
        {
            if (ModelState.IsValid)
            {
                var menuContext = new MenuContext
                {
                    Name             = model.Name,
                    Link             = model.Link,
                    TabIndex         = model.TabIndex,
                    IsFooterMenuOnly = model.IsFooterMenuOnly
                };

                using (var context = new ApplicationDbContext())
                {
                    if ((model.Id == 0) || (model.Id == null))
                    {
                        context.MenuContexts.Add(menuContext);
                    }
                    else
                    {
                        var item = context.MenuContexts.Where(y => y.Id == model.Id).FirstOrDefault();
                        item.Link             = model.Link;
                        item.Name             = model.Name;
                        item.TabIndex         = model.TabIndex;
                        item.IsFooterMenuOnly = model.IsFooterMenuOnly;
                    }

                    context.SaveChanges();
                }

                return(RedirectToAction("ViewMenus"));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 自定义菜单
        /// </summary>
        /// <param name="APPID"></param>
        /// <param name="APPSECRET"></param>
        /// <returns></returns>
        public async Task <bool> UpdateMenu(string token, object data)
        {
            try
            {
                var ret = new MenuModel()
                {
                    button = new List <MenuBtn>()
                };
                ret.button.Add(new MenuBtn()
                {
                    type = "click",
                    name = "测试",
                    key  = "V1001_TODAY_MUSIC"
                });

                ret.button.Add(new MenuBtn()
                {
                    type = "click",
                    name = "测试2",
                    key  = "V1001_TODAY_MUSIC"
                });
                Uri uri = new Uri($" https://api.weixin.qq.com/cgi-bin/menu/create?access_token={token}");

                var json = await PostApi(uri, data);

                if (json["errcode"] != null)
                {
                    LogWrite(json["errmsg"].ToString());
                    return(false);
                }
                return(true);
            }
            catch (Exception E)
            {
                return(false);
            }
        }
Exemplo n.º 17
0
        public JsonResult Save(MenuModel model)
        {
            ResponseBase rs;

            try
            {
                //if (isAuthenticate)
                //{
                model.CompanyId = UserContext.CompanyId;
                rs = BLLMenu.Instance.InsertOrUpdate(model, UserContext.UserID);
                if (!rs.IsSuccess)
                {
                    JsonDataResult.Result = "ERROR";
                    JsonDataResult.ErrorMessages.AddRange(rs.Errors);
                    if (model.Icon != "0")
                    {
                        string path = model.Icon.Split(',').ToList().First();
                        if (System.IO.File.Exists(Server.MapPath(path)))
                        {
                            System.IO.File.Delete(Server.MapPath(path));
                        }
                    }
                }
                JsonDataResult.Result = "OK";
                //}
            }
            catch (Exception ex)
            {
                //add Error
                JsonDataResult.Result = "ERROR";
                JsonDataResult.ErrorMessages.Add(new Error()
                {
                    MemberName = "Lỗi Dữ Liệu", Message = "Lỗi: " + ex.Message
                });
            }
            return(Json(JsonDataResult));
        }
        protected MenuModel PrepareMenuModel(string currentNodeId, string targetNodeId)
        {
            var menu = _menuService.GetMenu("Main");

            if (menu == null)
            {
                return(null);
            }

            object nodeId = ConvertNodeId(targetNodeId);

            var model = new MenuModel
            {
                Name         = "offcanvas",
                Root         = menu.Root,
                SelectedNode = IsNullNode(nodeId)
                    ? menu.Root
                    : menu.Root.SelectNodeById(nodeId)
            };

            menu.ResolveElementCounts(model.SelectedNode, false);

            if (currentNodeId == targetNodeId)
            {
                ViewBag.CurrentNode = model.SelectedNode;
            }
            else
            {
                nodeId = ConvertNodeId(currentNodeId);
                if (!IsNullNode(nodeId))
                {
                    ViewBag.CurrentNode = menu.Root.SelectNodeById(nodeId);
                }
            }

            return(model);
        }
Exemplo n.º 19
0
        public IActionResult SubMenuCreate(MenuModel menuModel)
        {
            if (ModelState.IsValid)
            {
                List <SubMenuLanguage> subMenuLanguages = new List <SubMenuLanguage>()
                {
                    new SubMenuLanguage()
                    {
                        LanguageId = 1,
                        Name       = menuModel.EngName
                    },
                    new SubMenuLanguage()
                    {
                        LanguageId = 2,
                        Name       = menuModel.AzName
                    },
                    new SubMenuLanguage()
                    {
                        LanguageId = 3,
                        Name       = menuModel.RuName
                    }
                };

                SubMenu subMenu = new SubMenu()
                {
                    MenuId           = 1,
                    Action           = menuModel.Action,
                    Controller       = menuModel.Controller,
                    SubMenuLanguages = subMenuLanguages
                };

                _baselDb.SubMenus.Add(subMenu);

                _baselDb.SaveChanges();
            }
            return(View(nameof(Menu)));
        }
Exemplo n.º 20
0
        public async Task <ActionResult> SaveMenu(int menuId, string name, IFormFile pdf, IFormFile banner)
        {
            byte[] bannerBytes = null;
            byte[] pdfBytes    = null;
            if (banner != null)
            {
                using (var readStream = banner.OpenReadStream())
                {
                    bannerBytes = new byte[banner.Length];
                    await readStream.ReadAsync(bannerBytes, 0, (int)banner.Length);
                }
            }
            if (pdf != null)
            {
                using (var readStream = pdf.OpenReadStream())
                {
                    pdfBytes = new byte[pdf.Length];
                    await readStream.ReadAsync(pdfBytes, 0, (int)pdf.Length);
                }
            }
            var model = new MenuModel()
            {
                ID     = menuId,
                NAME   = name,
                PDF    = pdfBytes,
                BANNER = bannerBytes
            };


            if (_adminService.SaveMenu(model.ID, model.NAME, model.BANNER, model.PDF))
            {
                return(Ok(new { response = "menu has been updated successfully" }));
            }

            return(BadRequest(new { response = "failed to update menu" }));
        }
Exemplo n.º 21
0
        public MenuModel HeaderMenu(IServiceProvider serviceProvider)
        {
            var localizationService = serviceProvider
                                      .GetService <IInstallationCheckingLocalizationService>();

            var result = new MenuModel();

            result.LeftMenu.Add(new MenuItemModel()
            {
                Name   = localizationService.GetString("Planning"),
                E2EId  = "installationchecking",
                Link   = "",
                Guards = new List <string>()
                {
                    InstallationCheckingClaims.AccessInstallationCheckingPlugin
                },
                MenuItems = new List <MenuItemModel>()
                {
                    new MenuItemModel()
                    {
                        Name     = localizationService.GetString("Installation"),
                        E2EId    = "installationchecking-pn-installation",
                        Link     = "/plugins/installationchecking-pn/installation",
                        Position = 0,
                    },
                    new MenuItemModel()
                    {
                        Name     = localizationService.GetString("Removal"),
                        E2EId    = "installationchecking-pn-removal",
                        Link     = "/plugins/installationchecking-pn/removal",
                        Position = 1,
                    }
                }
            });
            return(result);
        }
Exemplo n.º 22
0
        public IActionResult AddMenu(MenuModel model)
        {
            var res = new MgResult();

            if (!ModelState.IsValid)
            {
                res.Code = 110;
                res.Msg  = "后端模型验证失败!";
                return(Json(res));
            }
            var tempMenu = _mapper.Map <Menu>(model);

            var repoMenu = _unitOfWork.GetRepository <Menu>();

            tempMenu.CreateUser   = CurUserInfo.TrueName;
            tempMenu.CreateUserId = CurUserInfo.UserId;
            tempMenu.CreateTime   = DateTime.Now;
            repoMenu.Insert(tempMenu);
            var r = _unitOfWork.SaveChanges();

            res.Code = r > 0 ? 0 : 1;
            res.Msg  = r > 0 ? "ok" : "SaveChanges失败!";
            return(Json(res));
        }
Exemplo n.º 23
0
        private string GetMenuListSql(MenuModel entity)
        {
            string sql = string.Empty;

            sql  = "SELECT a.* ";
            sql += " ,DisplayIndex = row_number() over(order by a.display_index asc) ";
            sql += " ,b.Def_App_Name Reg_App_Name ";
            sql += " ,c.menu_name parent_menu_name ";
            sql += " into #tmp ";
            sql += " from t_menu a ";
            sql += " left join t_def_app b on b.Def_App_Id=a.reg_app_id ";
            sql += " left join t_menu c on c.menu_id=a.parent_menu_id ";
            sql += " where a.status='1' ";
            sql += " and a.customer_id='" + CurrentUserInfo.CurrentUser.customer_id + "' ";
            if (entity.Menu_Id != null && entity.Menu_Id.Trim().Length > 0)
            {
                sql += " and a.Menu_Id = '" + entity.Menu_Id + "' ";
            }
            if (entity.Parent_Menu_Id != null && entity.Parent_Menu_Id.Trim().Length > 0)
            {
                sql += " and a.Parent_Menu_Id = '" + entity.Parent_Menu_Id + "' ";
            }
            if (entity.Reg_App_Id != null && entity.Reg_App_Id.Trim().Length > 0)
            {
                sql += " and a.Reg_App_Id = '" + entity.Reg_App_Id + "' ";
            }
            if (entity.Menu_Name != null && entity.Menu_Name.Trim().Length > 0)
            {
                sql += " and a.Menu_Name like '%" + entity.Menu_Name + "%' ";
            }
            if (entity.Menu_Code != null && entity.Menu_Code.Trim().Length > 0)
            {
                sql += " and a.Menu_Code like '%" + entity.Menu_Code + "%' ";
            }
            return(sql);
        }
Exemplo n.º 24
0
        public ActionResult ListMenu()
        {
            var lstMenu          = _menuService.GetAllMenu().OrderBy(x => x.ParentId).ToList();
            List <MenuModel> lst = new List <MenuModel>();

            for (int i = 0; i < lstMenu.Count; i++)
            {
                if (lstMenu[i].ParentId == 0)
                {
                    MenuModel c = lstMenu[i].Map <MenuModel>();
                    c.LstMenuChild = new List <MenuModel>();
                    for (int j = i + 1; j < lstMenu.Count; j++)
                    {
                        if (lstMenu[j].ParentId == c.Id && lstMenu[j].ParentId != 0)
                        {
                            c.LstMenuChild.Add(lstMenu[j].Map <MenuModel>());
                        }
                    }
                    lst.Add(c);
                }
            }

            return(View(lst));
        }
Exemplo n.º 25
0
        /// <inheritdoc />
        /// <summary>
        /// Gets the return URL.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <returns></returns>
        public string GetReturnUrl(string emailAddress)
        {
            string returnUrl = string.Empty;

            IMember member = UserService.GetUser(emailAddress);

            UserService.UpdateLoginStatus(member);

            string role = UserService.GetDefaultRole(member.Username);

            if (!string.IsNullOrEmpty(role))
            {
                IPublishedContent menuNode = settingsService.GetMenu(role);

                if (menuNode != null)
                {
                    MenuModel menuModel = new MenuModel(menuNode);

                    returnUrl = menuModel.LandingPage;
                }
            }

            return(returnUrl);
        }
Exemplo n.º 26
0
 public static MenuModel Insert(int vendor)
 {
     try
     {
         using (RoundTheCornerEntities rc = new RoundTheCornerEntities())
         {
             PL.TblMenu newRow = new TblMenu()
             {
                 MenuID   = rc.TblMenus.Any() ? rc.TblMenus.Max(u => u.MenuID) + 1 : 1,
                 VendorID = vendor,
                 IsActive = true
             };
             rc.TblMenus.Add(newRow);
             rc.SaveChanges();
             MenuModel menuModel = new MenuModel();
             menuModel.MenuID = newRow.MenuID;
             return(menuModel);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public List <MenuModel> CreateMenuModel(string UIDUSER)
        {
            SecurityDS ds = new SecurityDS();

            using (SecurityBusiness bSecurity = new SecurityBusiness())
            {
                bSecurity.FillMenu(ds);
                bSecurity.FillUserMenu(UIDUSER, ds);
            }

            List <int> idMenuAbilitati = ds.RW_USER_MENU.Where(x => x.UIDUSER == UIDUSER).Select(x => (int)x.IDMENU).ToList();

            List <MenuModel> menu = new List <MenuModel>();

            foreach (SecurityDS.RW_MENURow row in ds.RW_MENU.Where(x => x.IsIDMENUPADRENull()))
            {
                MenuModel elementoMenu = CreaMenu(ds, row.IDMENU, idMenuAbilitati);
                menu.Add(elementoMenu);
            }



            return(menu);
        }
Exemplo n.º 28
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            //skip requests (json) without a model
            if (filterContext.Controller.ViewData.Model == null)
            {
                return;
            }

            var actionName = filterContext.ActionDescriptor.ActionName;

            if (actionName == "Index")
            {
                return;
            }

            var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
            var controller     = filterContext.Controller as RestrictedControllerBase;

            MenuModel menu = MenuModel.Create(controller.ViewData.Model, controllerName, actionName, controller.SecurityToken.RoleName);

            menu.BuildMenus();

            controller.ViewBag.Menu = menu;
        }
Exemplo n.º 29
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var parameter = e.Parameter;

            Type type = e.Parameter?.GetType();

            if (type != null)
            {
                Permission permission = (Permission)type.GetProperty("Permission").GetValue(parameter);
                var        dataSource = this[permission];
                listView.ItemsSource = dataSource;
            }

            if (e.NavigationMode == NavigationMode.New)
            {
                if (listView.Items.Count > 0)
                {
                    MenuModel link = listView.Items.First() as MenuModel;
                    contentFrame.Navigate(link.LinkType);
                }
            }

            (Application.Current as App).ContentFrame = contentFrame;

            //var t = Task.Run(() => {   });

            //测试用的数据导入
            //using (var context = new PostgreSQLContext())
            //{
            //    PostgreSQLContxtSeeder.Seed(context);
            //}
            ////数据库数据加载,显示慢,转菊花?还是怎么优化?
            //   (new MasterdataManager()).Load();

            base.OnNavigatedTo(e);
        }
Exemplo n.º 30
0
        // GET: Menu
        public ActionResult Index()
        {
            var model   = new List <MenuModel>();
            var lstMenu = _menuService.GetAllMenus().ToList();

            if (lstMenu.Count > 0)
            {
                var menuModel = new MenuModel();
                foreach (var menu in lstMenu)
                {
                    menuModel.IsActive     = menu.IsActive;
                    menuModel.DisplayOrder = menu.DisplayOrder;
                    menuModel.MenuId       = menu.Id;
                    menuModel.Name         = menu.Name;
                    menuModel.ParentMenuId = menu.ParentMenuId;
                    menuModel.Title        = menu.Title;
                    menuModel.Url          = menu.Url;
                    menuModel.UserId       = menu.UserId;
                    model.Add(menuModel);
                }
            }

            return(View(model));
        }
Exemplo n.º 31
0
        public IActionResult HeadMenuCreate(MenuModel menuModel)
        {
            if (ModelState.IsValid)
            {
                List <HeadMenuLanguage> headMenuLanguages = new List <HeadMenuLanguage>()
                {
                    new HeadMenuLanguage()
                    {
                        LanguageId = 1,
                        Name       = menuModel.EngName
                    },
                    new HeadMenuLanguage()
                    {
                        LanguageId = 2,
                        Name       = menuModel.AzName
                    },
                    new HeadMenuLanguage()
                    {
                        LanguageId = 3,
                        Name       = menuModel.RuName
                    }
                };

                HeadMenu headMenu = new HeadMenu()
                {
                    Action            = menuModel.Action,
                    Controller        = menuModel.Controller,
                    HeadMenuLanguages = headMenuLanguages
                };

                _baselDb.HeadMenus.Add(headMenu);

                _baselDb.SaveChanges();
            }
            return(View(nameof(Menu)));
        }
Exemplo n.º 32
0
        public IActionResult AccountMenuCreate(MenuModel menuModel)
        {
            if (ModelState.IsValid)
            {
                List <AccountMenuLanguage> accountMenuLanguages = new List <AccountMenuLanguage>()
                {
                    new AccountMenuLanguage()
                    {
                        LanguageId = 1,
                        Name       = menuModel.EngName
                    },
                    new AccountMenuLanguage()
                    {
                        LanguageId = 2,
                        Name       = menuModel.AzName
                    },
                    new AccountMenuLanguage()
                    {
                        LanguageId = 3,
                        Name       = menuModel.RuName
                    }
                };

                AccountMenu accountMenu = new AccountMenu()
                {
                    Action               = menuModel.Action,
                    Controller           = menuModel.Controller,
                    AccountMenuLanguages = accountMenuLanguages
                };

                _baselDb.AccountMenus.Add(accountMenu);

                _baselDb.SaveChanges();
            }
            return(View(nameof(Menu)));
        }
Exemplo n.º 33
0
        public ActionResult AddBurger(string custName, int tableID, int bunID, int meatID, int cheeseID)
        {
            IngridientModel Bun  = new IngMapper().GetIngridient(bunID);
            IngridientModel Meat = new IngMapper().GetIngridient(meatID);

            MenuModel Menu = new MenuModel
            {
                CustName = custName,
                TableID  = tableID,
                Bun      = Bun,
                Meat     = Meat
            };

            if (cheeseID != 0)
            {
                Menu.Cheese = new IngMapper().GetIngridient(cheeseID);
            }

            MenuMapper mapper = new MenuMapper();

            mapper.CreateNewBurger(Menu);

            return(this.RedirectToAction("Index", "Burger"));
        }
Exemplo n.º 34
0
        public static List <MenuModel> ReadMenusXmlData(string pathName)
        {
            // string path = Utils.installPath + Settings.Default["VehicleMeunUrl"];
            string      path   = Utils.installPath + Settings.Default[pathName];
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNode          xn        = xmlDoc.SelectSingleNode("MenuData");
            XmlNodeList      xnl       = xn.ChildNodes;
            List <MenuModel> listModel = new List <MenuModel>();

            foreach (XmlNode nodel in xnl)
            {
                MenuModel   model = new MenuModel();
                XmlElement  xe    = (XmlElement)nodel;
                XmlNodeList xnll  = xe.ChildNodes;
                model.ID       = Int32.Parse(xnll.Item(0).InnerText);
                model.MenuName = xnll.Item(1).InnerText;
                model.ParentID = xnll.Item(2).InnerText.ToString();
                model.OrderID  = Int32.Parse(xnll.Item(3).InnerText);
                listModel.Add(model);
            }
            return(listModel);
        }
Exemplo n.º 35
0
        public ActionResult DeleteConfirmed(int id)
        {
            var child = from menus in db.Menus
                        where menus.ParentId == id
                        select menus;

            if (child.ToList().Count > 0)//有用户属于此角色不能删除
            {
                ModelState.AddModelError("", "此菜单有子菜单存在,无法删除!");
                return(View(db.Roles.Find(id)));
            }

            MenuModel menu = db.Menus.Find(id);

            db.Menus.Remove(menu);
            db.SaveChanges();

            if (!savePath(menu))//保存path字段,路径如 0,1,2
            {
                return(View(menu));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 36
0
    public static IList<MenuModel> BuildMenu() {

      IList<MenuModel> mmList = new List<MenuModel>();
      try {

        var menu_items = db.MSTR_Menu;
        var UserId = System.Web.HttpContext.Current.Session["UserId"] == null ? 0 : System.Web.HttpContext.Current.Session["UserId"];


        String SQL = "select * from MSTR_Menu where Visible=1 and  MenuId" +
            " in(select b.MenuId from  MSTR_Profile a left join   M2M_ProfileMenu b" +
             "  on a.ProfileId = b.ProfileId left join MSTR_User c on b.ProfileId = c.UserProfileId" +
             "   where c.UserId =" + UserId + ") order by SortOrder asc ";
        var MenuName = db.Database.SqlQuery<MSTR_Menu>(SQL);


        foreach (MSTR_Menu mnu in MenuName) {
          MenuModel model = new MenuModel();
          model.Id = mnu.MenuId;
          model.Name = mnu.MenuName;
          model.ParentId = mnu.ParentId.GetValueOrDefault();
          model.SortOrder = mnu.SortOrder.GetValueOrDefault();
          model.PageUrl = mnu.PageUrl;

          mmList.Add(model);

          if(mnu.MenuName == "Home") {
            AddCmsMenuTo(mmList, mnu.MenuId);
          }
        }

      } catch (Exception ex) {
        Util.ErrorHandler(ex);
      }
      return mmList;
    }
Exemplo n.º 37
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MenuModel GetModel(Guid Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 Id,MenuName,ParentId,Url,MenuDes from MenuInfo ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.UniqueIdentifier,16)};
            parameters[0].Value = Id;

            MenuModel model = new MenuModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = new Guid(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MenuName"] != null && ds.Tables[0].Rows[0]["MenuName"].ToString() != "")
                {
                    model.MenuName = ds.Tables[0].Rows[0]["MenuName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ParentId"] != null && ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentId = new Guid(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Url"] != null && ds.Tables[0].Rows[0]["Url"].ToString() != "")
                {
                    model.Url = ds.Tables[0].Rows[0]["Url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MenuDes"] != null && ds.Tables[0].Rows[0]["MenuDes"].ToString() != "")
                {
                    model.MenuDes = ds.Tables[0].Rows[0]["MenuDes"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 38
0
 /// <summary>
 /// 得到所有对象
 /// </summary>
 public List<MenuModel> GetAllModels()
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select * from MenuInfo ");
     var result = new List<MenuModel>();
     var dr = DbHelperSQL.ExecuteReader(strSql.ToString());
     while(dr.Read())
     {
         MenuModel model = new MenuModel();
         if (dr["Id"] != DBNull.Value)
         {
             model.Id = Guid.Parse(dr["Id"].ToString());
         }
         if (dr["MenuName"] != null && dr["MenuName"].ToString() != "")
         {
             model.MenuName = dr["MenuName"].ToString();
         }
         if (dr["ParentId"] != null && dr["ParentId"].ToString() != "")
         {
             model.ParentId = new Guid(dr["ParentId"].ToString());
         }
         if (dr["Url"] != null && dr["Url"].ToString() != "")
         {
             model.Url = dr["Url"].ToString();
         }
         if (dr["MenuDes"] != null && dr["MenuDes"].ToString() != "")
         {
             model.MenuDes = dr["MenuDes"].ToString();
         }
         if (dr["OrderNum"] != DBNull.Value)
         {
             model.OrderNum = Convert.ToInt32(dr["OrderNum"]);
         }
         result.Add(model);
     }
     return result;
 }
Exemplo n.º 39
0
 public int UpdateMenu_Info(MenuModel menuModel)
 {
     return menuInfoBll.UpdateMenu_Info(menuModel);
 }
Exemplo n.º 40
0
 public override MenuModel[] GetEgality(bool bj, DB_OPT dbo)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  ");
     builder.Append(" MemuPK,MenuBH,MenuName,PageUrl,ImgUrl,FatherPK,IsHasBaby,Grade,PKPath,IsShow,PowerCode,InsertPC,UpdatePC,DeletePC,PrintPC,OpenType,IsCheckPower,VisitPoint,MenuType,OrderBy,Discription,pk_corp ");
     builder.Append(" from DB_Menu ");
     if (base.Grade >= 0)
     {
         builder.Append(" where Grade='" + base.Grade + "'");
     }
     else
     {
         if (base.MemuPK == "")
         {
             throw new Exception("条件不足.");
         }
         builder.Append(" where Grade=(select Grade from Menu where MemuPK='" + base.MemuPK + "')");
     }
     builder.Append(" order by PowerCode");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     MenuModel[] modelArray = new MenuModel[set.Tables[0].Rows.Count];
     for (int i = 0; i < set.Tables[0].Rows.Count; i++)
     {
         modelArray[i] = new MenuModel();
         modelArray[i] = this.Getmm(set.Tables[0].Rows[i], bj, dbo);
     }
     return modelArray;
 }
Exemplo n.º 41
0
        public void SetPauseMenuTest()
        {
            this.dialog1.Active = true;
            this.dialog2.Active = false;

            MenuModel target = new MenuModel();
            target.MenuDialogs = this.dialogs;
            target.SetPauseMenu();

            Assert.IsFalse(dialog1.Active);
            Assert.IsTrue(dialog2.Active);
        }
Exemplo n.º 42
0
 public void MenuDialogsTest()
 {
     MenuModel target = new MenuModel();
     target.MenuDialogs = this.dialogs;
     Assert.AreEqual(this.dialogs, target.MenuDialogs);
 }
Exemplo n.º 43
0
 /// <summary>
 /// Creates a new MenuView object.
 /// </summary>
 /// <param name="menuDialogViews">An array of MenuDialogView objects.</param>
 /// <param name="menuModel">The dedicated MenuModel.</param>
 public MenuView(MenuDialogView[] menuDialogViews, MenuModel menuModel)
 {
     this.menuDialogViews = menuDialogViews;
     this.menuModel = menuModel;
 }
Exemplo n.º 44
0
 public bool EditMenu(MenuModel target)
 {
     var result = da.Update(target);
     return result;
 }
Exemplo n.º 45
0
 private void DataDelete(string strPK)
 {
     try
     {
         this.mm = new MenuDal();
         this.dbo = new DB_OPT();
         this.dbo.Open();
         this.mm = new MenuDal();
         this.mm.MemuPK = strPK;
         this.mm.Delete(this.dbo);
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "DataDelete()";
         this.el.WriteExceptionLog(true);
         PageShowText.OpenErrorPage("操作失败,请联系系统管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
Exemplo n.º 46
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MenuModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update MenuInfo set ");
            strSql.Append("MenuName=@MenuName,");
            strSql.Append("ParentId=@ParentId,");
            strSql.Append("Url=@Url,");
            strSql.Append("MenuDes=@MenuDes");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@MenuName", SqlDbType.VarChar,150),
                    new SqlParameter("@ParentId", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@Url", SqlDbType.VarChar,350),
                    new SqlParameter("@MenuDes", SqlDbType.VarChar),
                    new SqlParameter("@Id", SqlDbType.UniqueIdentifier,16)};
            parameters[0].Value = model.MenuName;
            parameters[1].Value = model.ParentId;
            parameters[2].Value = model.Url;
            parameters[3].Value = model.MenuDes;
            parameters[4].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 47
0
        public void SetGameEndedMenuTest()
        {
            List<MenuDialog> dialogList = new List<MenuDialog>();
            for (int i = 0; i <= 10; i += 1)
            {
                MenuItem menuItem = new MenuItem(delegate(MenuItem m) { }, null);
                MenuItem[] menuItems = { menuItem };
                MenuDialog d = new MenuDialog(menuItems);
                d.Active = (i == 3) ? true : false;
                dialogList.Add(d);
            }

            MenuModel target = new MenuModel();
            target.MenuDialogs = dialogList.ToArray();
            target.SetGameEndedMenu(2);

            Assert.IsFalse(dialogList[3].Active);
            Assert.IsTrue(dialogList[10].Active);
            Assert.AreEqual(2, target.WinningPlayerID);
        }
Exemplo n.º 48
0
        public void WaitForKeyTest()
        {
            MenuModel target = new MenuModel();
            Assert.IsFalse(target.IsWaitingForKey);

            Keys k = Keys.None;
            target.WaitForKey(delegate(Keys key) { k = key; });

            Assert.IsTrue(target.IsWaitingForKey);

            target.SetWaitingKey(Keys.A);

            Assert.IsFalse(target.IsWaitingForKey);
            Assert.AreEqual(Keys.A, k);
        }
Exemplo n.º 49
0
        public void SetPreviousDialogActiveTest()
        {
            this.dialog1.Active = true;
            this.dialog2.Active = false;

            MenuModel target = new MenuModel();
            target.MenuDialogs = this.dialogs;
            target.SetActiveDialogByIndex(1);
            target.SetPreviousDialogActive();

            Assert.IsTrue(dialog1.Active);
            Assert.IsFalse(dialog2.Active);
        }
Exemplo n.º 50
0
 private MenuModel Getmm(DataRow dr, bool bj, DB_OPT dbo)
 {
     MenuModel model = new MenuModel {
         MemuPK = dr["MemuPK"].ToString(),
         MenuBH = dr["MenuBH"].ToString(),
         MenuName = dr["MenuName"].ToString(),
         PageUrl = dr["PageUrl"].ToString(),
         ImgUrl = dr["ImgUrl"].ToString(),
         FatherPK = dr["FatherPK"].ToString(),
         IsHasBaby = dr["IsHasBaby"].ToString()
     };
     if (dr["Grade"].ToString() != "")
     {
         model.Grade = int.Parse(dr["Grade"].ToString());
     }
     model.PKPath = dr["PKPath"].ToString();
     model.IsShow = dr["IsShow"].ToString();
     model.PowerCode = dr["PowerCode"].ToString();
     model.InsertPC = dr["InsertPC"].ToString();
     model.UpdatePC = dr["UpdatePC"].ToString();
     model.DeletePC = dr["DeletePC"].ToString();
     model.PrintPC = dr["PrintPC"].ToString();
     model.OpenType = dr["OpenType"].ToString();
     model.IsCheckPower = dr["IsCheckPower"].ToString();
     if (dr["VisitPoint"].ToString() != "")
     {
         model.VisitPoint = int.Parse(dr["VisitPoint"].ToString());
     }
     model.MenuType = dr["MenuType"].ToString();
     if (dr["OrderBy"].ToString() != "")
     {
         model.OrderBy = int.Parse(dr["OrderBy"].ToString());
     }
     model.Discription = dr["Discription"].ToString();
     model.pk_corp = dr["pk_corp"].ToString();
     if ((dr["IsHasBaby"].ToString() == "1") && bj)
     {
         model.Childs = this.GetChilds(model.MemuPK, dbo);
     }
     return model;
 }
Exemplo n.º 51
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.txtMenuPX.Attributes.Add("onkeypress", "javascript:return onlyNum();");
     this.Master.LBTitle = "乡镇财政资金监管信息系统 - 修改菜单";
     this.Master.TitlePic = "~/images/页标题/修改菜单副本.jpg";
     this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
     if (!this.Page.IsPostBack && (this.Session["User"] != null))
     {
         if (base.Request.QueryString["PK"] != null)
         {
             try
             {
                 try
                 {
                     string userName = ((UserModel)this.Session["User"]).UserName;
                     string power = ((UserModel)this.Session["User"]).Power;
                     ButtonsModel model = new ButtonsModel(userName);
                     if (PowerClass.IfHasPower(userName, power, PowerNum.MenuUpdate))
                     {
                         model.IfAdd = false;
                         model.IfSave = true;
                         model.IfUpdate = false;
                         model.IfDelete = false;
                         model.IfLook = false;
                         model.IfSearch = false;
                         model.IfRefresh = true;
                         model.IfHuiZong = false;
                         model.IfPutOut = false;
                         model.IfSet = false;
                         model.IfExit = true;
                         this.Master.btModel = model;
                         this.dbo = new DB_OPT();
                         this.dbo.Open();
                         this.mm = new MenuDal();
                         this.mm.MemuPK = base.Request.QueryString["PK"].ToString();
                         this.mm = this.mm.GetModel(false, this.dbo);
                         this.SetValue(this.mm);
                     }
                     else
                     {
                         Const.SorryForPower(this.Page);
                     }
                 }
                 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);
                     Const.OpenErrorPage("获取数据失败,请联系管理员!", this.Page);
                 }
                 goto Label_0237;
             }
             finally
             {
                 if (this.dbo != null)
                 {
                     this.dbo.Close();
                 }
             }
         }
         Const.GoLoginPath_Open(this.Page);
     }
     Label_0237:
     this.fl1.VirtualCatalog = "";
     this.fl1.ImagePath = "System/menu/images";
 }
Exemplo n.º 52
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();
     }
 }
Exemplo n.º 53
0
        protected void InitContextMenu()
        {
            this.nodeContextModel = new MenuModel();
            this.nodeContextView = new MenuStripMenuView(this.contextMenuNode.Items);
            this.nodeContextView.ItemSortComparison = this.ContextMenuItemComparison;
            this.nodeContextView.Model = this.nodeContextModel;

            this.nodeContextModel.AddItems(new MenuModelItem[]
            {
                new MenuModelItem
                {
                    Name			= "TopSeparator",
                    SortValue		= MenuModelItem.SortValue_UnderTop - 1,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemNew = new MenuModelItem
                {
                    Name			= Properties.SceneViewRes.SceneView_ContextItemName_New,
                    SortValue		= MenuModelItem.SortValue_UnderTop,
                    Items			= new MenuModelItem[]
                    {
                        new MenuModelItem
                        {
                            Name			= typeof(GameObject).Name,
                            Icon			= typeof(GameObject).GetEditorImage(),
                            SortValue		= MenuModelItem.SortValue_Top,
                            ActionHandler	= this.gameObjectToolStripMenuItem_Click
                        },
                        new MenuModelItem
                        {
                            Name			= "TopSeparator",
                            SortValue		= MenuModelItem.SortValue_Top,
                            TypeHint		= MenuItemTypeHint.Separator
                        }
                    }
                },
                new MenuModelItem
                {
                    Name			= "UnderTopSeparator",
                    SortValue		= MenuModelItem.SortValue_UnderTop,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemClone = new MenuModelItem
                {
                    Name			= Properties.SceneViewRes.SceneView_ContextItemName_Clone,
                    Icon			= Properties.Resources.page_copy,
                    ShortcutKeys	= Keys.Control | Keys.C,
                    ActionHandler	= this.cloneToolStripMenuItem_Click
                },
                this.nodeContextItemDelete = new MenuModelItem
                {
                    Name			= Properties.SceneViewRes.SceneView_ContextItemName_Delete,
                    Icon			= Properties.Resources.cross,
                    ShortcutKeys	= Keys.Delete,
                    ActionHandler	= this.deleteToolStripMenuItem_Click
                },
                this.nodeContextItemRename = new MenuModelItem
                {
                    Name			= Properties.SceneViewRes.SceneView_ContextItemName_Rename,
                    ActionHandler	= this.renameToolStripMenuItem_Click
                },
                new MenuModelItem
                {
                    Name			= "BottomSeparator",
                    SortValue		= MenuModelItem.SortValue_Bottom,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemLockHide = new MenuModelItem
                {
                    Name			= Properties.SceneViewRes.SceneView_ContextItemName_LockHide,
                    SortValue		= MenuModelItem.SortValue_Bottom,
                    ActionHandler	= this.lockedToolStripMenuItem_Click
                }
            });
        }
Exemplo n.º 54
0
 public void Buttons(string ibtid)
 {
     string str;
     if (((str = ibtid) != null) && (str != "ibtcontrol_ibtupdate"))
     {
         if (str == "ibtcontrol_ibtsave")
         {
             this.UpdateMenu();
         }
         else if (str != "ibtcontrol_ibtrefresh")
         {
             if (!(str == "ibtcontrol_ibtset"))
             {
                 bool flag1 = str == "ibtcontrol_ibtexit";
             }
         }
         else
         {
             this.dbo = new DB_OPT();
             this.dbo.Open();
             this.mm = new MenuDal();
             this.mm.MemuPK = base.Request.QueryString["MenuPK"].ToString();
             this.mm = this.mm.GetModel(false, this.dbo);
             this.GetStrParent(this.mm.PKPath);
             this.SetValue(this.mm);
         }
     }
 }
Exemplo n.º 55
0
 public override MenuModel[] GetParents(DB_OPT dbo)
 {
     string[] strArray;
     string str;
     int num;
     StringBuilder builder = new StringBuilder();
     builder.Append("select  ");
     builder.Append(" MemuPK,MenuBH,MenuName,PageUrl,ImgUrl,FatherPK,IsHasBaby,Grade,PKPath,IsShow,PowerCode,InsertPC,UpdatePC,DeletePC,PrintPC,OpenType,IsCheckPower,VisitPoint,MenuType,OrderBy,Discription,pk_corp ");
     builder.Append(" from DB_Menu ");
     if (base.PKPath != "")
     {
         strArray = base.PKPath.Split(new char[] { '|' });
         str = "";
         for (num = 0; num < strArray.Length; num++)
         {
             if (strArray[num] != "")
             {
                 str = str + "'" + strArray[num] + "',";
             }
         }
         str = str.Substring(0, str.Length - 1);
         builder.Append(" where MemuPK in (" + str + ")");
     }
     else
     {
         if (!(base.MemuPK != ""))
         {
             throw new Exception("条件不足.");
         }
         string strSql = "select PKPath from DB_Menu where MemuPK='" + base.MemuPK + "'";
         DataSet set = dbo.BackDataSet(strSql, null);
         if (!(set.Tables[0].Rows[0][0].ToString() != ""))
         {
             throw new Exception("没有上级.");
         }
         strArray = set.Tables[0].Rows[0][0].ToString().Split(new char[] { '|' });
         str = "";
         for (num = 0; num < strArray.Length; num++)
         {
             if (strArray[num] != "")
             {
                 str = str + "'" + strArray[num] + "',";
             }
         }
         builder.Append(" where MemuPK in (" + str.Substring(0, str.Length - 1) + ")");
     }
     builder.Append(" order by PowerCode");
     DataSet set2 = dbo.BackDataSet(builder.ToString(), null);
     if (set2.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     MenuModel[] modelArray = new MenuModel[set2.Tables[0].Rows.Count];
     for (num = 0; num < set2.Tables[0].Rows.Count; num++)
     {
         modelArray[num] = new MenuModel();
         modelArray[num] = this.Getmm(set2.Tables[0].Rows[num], false, dbo);
     }
     return modelArray;
 }
Exemplo n.º 56
0
 public int Menu_Info_Add(MenuModel menuModel)
 {
     return menuInfoBll.Menu_Info_Add(menuModel);
 }
Exemplo n.º 57
0
 public override MenuModel[] GetChilds(string parentpk, DB_OPT dbo)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  ");
     builder.Append(" MemuPK,MenuBH,MenuName,PageUrl,ImgUrl,FatherPK,IsHasBaby,Grade,PKPath,IsShow,PowerCode,InsertPC,UpdatePC,DeletePC,PrintPC,OpenType,IsCheckPower,VisitPoint,MenuType,OrderBy,Discription,pk_corp ");
     builder.Append(" from DB_Menu ");
     if (parentpk != "")
     {
         builder.Append(" where FatherPK='" + parentpk + "'");
     }
     builder.Append(" order by PowerCode");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     MenuModel[] modelArray = new MenuModel[set.Tables[0].Rows.Count];
     for (int i = 0; i < set.Tables[0].Rows.Count; i++)
     {
         modelArray[i] = new MenuModel();
         modelArray[i] = this.Getmm(set.Tables[0].Rows[i], true, dbo);
     }
     return modelArray;
 }
Exemplo n.º 58
0
 public void ShowData(string str)
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         this.mm = new MenuDal();
         if (str != "")
         {
             str = " where " + str + " ";
         }
         DataSet set = PageUsuClass.GetPageSizeData(MenuDal.GetMenuColsName(), "DB_Menu", str, "MemuPK", " order by PowerCode ", this.Master.PageIndex, this.Master.PageSize, out this.count);
         this.Master.RecordCount = Convert.ToInt32(this.count);
         if ((set != null) && (set.Tables[0].Rows.Count > 0))
         {
             DataView defaultView = set.Tables[0].DefaultView;
             defaultView.Sort = DataListDo.GetViewSort();
             this.gvResult.DataSource = defaultView;
             this.gvResult.DataBind();
         }
         else
         {
             DataTable table = new DataTable();
             table = set.Tables[0];
             DataRow row = table.NewRow();
             table.Rows.Add(row);
             this.gvResult.DataSource = table.DefaultView;
             this.gvResult.DataBind();
         }
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "ShowData()";
         this.el.WriteExceptionLog(true);
         PageShowText.OpenErrorPage("获取数据失败,请联系系统管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
Exemplo n.º 59
0
        protected void InitContextMenu()
        {
            this.nodeContextModel = new MenuModel();
            this.nodeContextView = new MenuStripMenuView(this.contextMenuNode.Items);
            this.nodeContextView.ItemSortComparison = this.ContextMenuItemComparison;
            this.nodeContextView.Model = this.nodeContextModel;

            this.nodeContextModel.AddItems(new MenuModelItem[]
            {
                new MenuModelItem
                {
                    Name			= "TopSeparator",
                    SortValue		= MenuModelItem.SortValue_UnderTop - 1,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemNew = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_New,
                    SortValue		= MenuModelItem.SortValue_UnderTop,
                    Items			= new MenuModelItem[]
                    {
                        new MenuModelItem
                        {
                            Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Folder,
                            Icon			= Properties.Resources.folder,
                            SortValue		= MenuModelItem.SortValue_Top,
                            ActionHandler	= this.folderToolStripMenuItem_Click
                        },
                        new MenuModelItem
                        {
                            Name			= "TopSeparator",
                            SortValue		= MenuModelItem.SortValue_Top,
                            TypeHint		= MenuItemTypeHint.Separator
                        }
                    }
                },
                new MenuModelItem
                {
                    Name			= "UnderTopSeparator",
                    SortValue		= MenuModelItem.SortValue_UnderTop,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemCut = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Cut,
                    Icon			= Properties.Resources.cut,
                    ShortcutKeys	= Keys.Control | Keys.X,
                    ActionHandler	= this.cutToolStripMenuItem_Click
                },
                this.nodeContextItemCopy = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Copy,
                    Icon			= Properties.Resources.page_copy,
                    ShortcutKeys	= Keys.Control | Keys.C,
                    ActionHandler	= this.copyToolStripMenuItem_Click
                },
                this.nodeContextItemPaste = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Paste,
                    Icon			= Properties.Resources.page_paste,
                    ShortcutKeys	= Keys.Control | Keys.V,
                    ActionHandler	= this.pasteToolStripMenuItem_Click
                },
                this.nodeContextItemDelete = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Delete,
                    Icon			= Properties.Resources.cross,
                    ShortcutKeys	= Keys.Delete,
                    ActionHandler	= this.deleteToolStripMenuItem_Click
                },
                this.nodeContextItemRename = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_Rename,
                    ActionHandler	= this.renameToolStripMenuItem_Click
                },
                new MenuModelItem
                {
                    Name			= "BottomSeparator",
                    SortValue		= MenuModelItem.SortValue_Bottom,
                    TypeHint		= MenuItemTypeHint.Separator
                },
                this.nodeContextItemShowInExplorer = new MenuModelItem
                {
                    Name			= Properties.ProjectViewRes.ProjectFolderView_ContextItemName_ShowInExplorer,
                    SortValue		= MenuModelItem.SortValue_Bottom,
                    ActionHandler	= this.showInExplorerToolStripMenuItem_Click
                }
            });
        }
Exemplo n.º 60
0
 private void BindDrop(DB_OPT dbo)
 {
     this.mm = new MenuDal();
     MenuModel[] modelArray = this.mm.GetModels("", false, dbo);
     this.ddlgl.DataSource = modelArray;
     this.ddlgl.DataTextField = "MenuName";
     this.ddlgl.DataValueField = "MemuPK";
     this.ddlgl.DataBind();
 }