public async Task <List <TreeItem <ViewMenu> > > GetUserTreeMenuAsync(int iUserId)
        {
            List <ViewMenu> lstViewMenu = new List <ViewMenu>();
            List <Menu>     lstUserMenu = new List <Menu>();

            //查询角色所拥有的菜单集合
            lstUserMenu = await RedisMethod.GetUserMenuAsync(iUserId, -1, () => _MenuService.GetRoleMenuListAsync(iUserId));

            if (lstUserMenu?.Count > 0)
            {
                //排序
                lstUserMenu = lstUserMenu.OrderBy(x => x.Isort).ToList();
                lstUserMenu.ForEach(entityMenu =>
                {
                    ViewMenu entityViewMenu    = new ViewMenu();
                    entityViewMenu.Id          = entityMenu.Id;
                    entityViewMenu.ParentId    = entityMenu.IparentId == -1 ? 0 : entityMenu.IparentId;
                    entityViewMenu.DisplayName = entityMenu.Sname;
                    entityViewMenu.IconUrl     = entityMenu.SiconUrl;
                    entityViewMenu.LinkUrl     = entityMenu.SlinkUrl;
                    entityViewMenu.Target      = "";
                    lstViewMenu.Add(entityViewMenu);
                });
            }
            return(lstViewMenu.GenerateTree(x => x.Id, x => x.ParentId).ToList());
        }
Example #2
0
        private void btnbookingsview_Click(object sender, EventArgs e)
        {
            ViewMenu form = new ViewMenu();

            this.Hide();
            form.Show();
        }
Example #3
0
        private void gridView1_MouseDown(object sender, MouseEventArgs e)
        {
            GridView view = sender as GridView;
            // obtaining hit info
            GridHitInfo hitInfo = view.CalcHitInfo(new Point(e.X, e.Y));

            if (((e.Button & MouseButtons.Right) != 0) && (hitInfo.InRow) && (!view.IsGroupRow(hitInfo.RowHandle)))
            {
                // switching focus
                view.FocusedRowHandle = hitInfo.RowHandle;
                // showing the custom context menu
                ViewMenu menu = new ViewMenu(view);
                {
                    {
                        DXMenuItem menuItem = new DXMenuItem("RefreshRow", new EventHandler(this.RefreshFocusedRow));
                        menuItem.Tag = view;
                        menu.Items.Add(menuItem);
                    }
                    {
                        DXMenuItem menuItem = new DXMenuItem("DeleteRow", new EventHandler(this.DeleteFocusedRow));
                        menuItem.Tag = view;
                        menu.Items.Add(menuItem);
                    }
                    menu.Show(hitInfo.HitPoint);
                }
            }
        }
Example #4
0
 //public IEnumerable<ViewMenu> GetMenus(int userId)
 //{
 //    return Function(context =>
 //    {
 //        var roleIds = context.UserRoles.Where(x => x.UserId == userId).Select(x => x.RoleId);
 //        var menus = context.MenuRoles.Where(x => roleIds.Contains(x.RoleId)).Select(s => s.Menu).Where(w => w.ParentId == null);
 //        var data = menus.ToList();
 //        return Mapper.Map<IEnumerable<ViewMenu>>(menus.ToList());
 //    });
 //}
 public IEnumerable <ViewMenu> GetMenus(int userId)
 {
     return(Function(context =>
     {
         var roleIds = context.UserRoles.Where(x => x.UserId == userId).Select(x => x.RoleId);
         var data = roleIds.ToList();
         var menus = context.MenuRoles.Where(x => roleIds.Contains(x.RoleId)).Select(s => s.Menu);
         var menuData = Mapper.Map <IEnumerable <ViewMenu> >(menus.ToList());
         List <ViewMenu> menu = new List <ViewMenu>();
         foreach (var item in menuData)
         {
             if (item.ParentId == null)
             {
                 ViewMenu MenuInfo = new ViewMenu();
                 MenuInfo.Id = item.Id;
                 MenuInfo.MenuName = item.MenuName;
                 MenuInfo.MenuUrl = item.MenuUrl;
                 MenuInfo.MenuCode = item.MenuCode;
                 MenuInfo.Depth = item.Depth;
                 MenuInfo.ParentId = item.ParentId;
                 MenuInfo.Children = GetChildMenu(menuData, item.Id);
                 menu.Add(MenuInfo);
             }
         }
         return menu;
     }));
 }
        protected void CreateAndShowPopupMenu(GridHitInfo hitInfo, GridView view)
        {
            var menu = new ViewMenu(view);

            menu.Items.Add(popupMenuItem);
            menu.Show(hitInfo.HitPoint);
        }
Example #6
0
        private void btnback_Click(object sender, EventArgs e)
        {
            ViewMenu menu = new ViewMenu();

            this.Hide();
            menu.Show();
        }
Example #7
0
 public ActionResult Index()
 {
     ViewBag.Title = "菜单管理";
     List<Menu> list = DbServices.GetMenuList();
     List<ViewMenu> parentList = null;
     if (list != null)
     {
         parentList = new List<ViewMenu>();
         foreach (var item in list)
         {
             if (item.ParentMenuId == 0)
             {
                 ViewMenu vm = new ViewMenu();
                 vm.ParentMenu = new Menu();
                 vm.ParentMenu.MenuId = item.MenuId;
                 vm.ParentMenu.MenuType = item.MenuType;
                 vm.ParentMenu.MenuValue = item.MenuValue;
                 vm.ParentMenu.Title = item.Title;
                 vm.ParentMenu.ParentMenuId = 0;
                 vm.ChildMenuList = (from c in list where c.ParentMenuId == vm.ParentMenu.MenuId select c).ToList();
                 parentList.Add(vm);
             }
         }
     }
     ViewBag.MenuList = parentList;
     return View();
 }
        private void grvOrder_MouseDown(object sender, MouseEventArgs e)
        {
            var view = sender as GridView;

            if (view == null)
            {
                return;
            }
            var hitInfo = view.CalcHitInfo(new Point(e.X, e.Y));

            if (((e.Button & MouseButtons.Right) != 0) && (hitInfo.InRow) &&
                (!view.IsGroupRow(hitInfo.RowHandle)))
            {
                view.FocusedRowHandle = hitInfo.RowHandle;

                var menu = new ViewMenu(view);

                var menuItem = new DXMenuItem("Add New SubMenu Item", new EventHandler(gridView3_AddNewRow));
                menuItem.Tag = view;
                menu.Items.Add(menuItem);

                //menuItem = new DXMenuItem("Edit Menu Item", new EventHandler(gridView2_EditFocusedRow));
                //menuItem.Tag = view;
                //menu.Items.Add(menuItem);

                menuItem     = new DXMenuItem("Delete Menu Item", null);
                menuItem.Tag = view;
                menu.Items.Add(menuItem);

                menu.Show(hitInfo.HitPoint);
            }
        }
Example #9
0
        private void posts_PreRender(object sender, EventArgs e)
        {
            bool isWatched = HandleWatchTopic();

            // options menu...
            OptionsMenu.AddPostBackItem("watch", isWatched ? GetText("UNWATCHTOPIC") : GetText("WATCHTOPIC"));
            if (PageContext.BoardSettings.AllowEmailTopic)
            {
                OptionsMenu.AddPostBackItem("email", GetText("EMAILTOPIC"));
            }
            OptionsMenu.AddPostBackItem("print", GetText("PRINTTOPIC"));
            if (PageContext.BoardSettings.ShowRSSLink)
            {
                OptionsMenu.AddPostBackItem("rssfeed", GetText("RSSTOPIC"));
            }

            // view menu
            ViewMenu.AddPostBackItem("normal", GetText("NORMAL"));
            ViewMenu.AddPostBackItem("threaded", GetText("THREADED"));

            // attach both the menus to HyperLinks
            OptionsMenu.Attach(OptionsLink);
            ViewMenu.Attach(ViewLink);

            if (!_dataBound)
            {
                BindData();
            }
        }
        public ViewMenu GetBread(int id)
        {
            var      per       = operContext.PerSession;
            var      bread1    = (from p in per where p.Id == id select p).FirstOrDefault();
            var      bread2    = (from p in per where p.Id == bread1.ParentId && p.Id != 1 select p).FirstOrDefault();
            ViewMenu viewModel = bread1.ToMenu();

            if (bread2 != null)
            {
                viewModel.text = bread2.PName + ">" + bread1.PName;
            }
            return(viewModel);
        }
Example #11
0
        static void Main(string[] args)
        {
            Pessoa p = new Pessoa("marcaum", "lajaica", "1992-05-01", 666, "F", "brasiliao", "99999999999");

            p.Id = 1;

            PessoaDaoSql pd = new PessoaDaoSql();

            pd.CadastraDados(p);

            ViewMenu menu = new ViewMenu();

            menu.IniciaMenu();
        }
Example #12
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Models
            M_Jogador = new Jogador();
            M_Peca    = new Peca();
            M_Jogo    = new Jogo();
            //Views
            V_MinesWeeper = new ViewMinesWeeper();
            V_Menu        = new ViewMenu();
            //Controllers

            Application.Run(V_Menu);
        }
Example #13
0
        private List <ViewMenu> GetChildMenu(IEnumerable <ViewMenu> viewMenus, int menuId)
        {
            List <ViewMenu> menus = new List <ViewMenu>();

            foreach (var item in viewMenus.Where(p => p.ParentId == menuId))
            {
                ViewMenu MenuInfo = new ViewMenu();
                MenuInfo.Id       = item.Id;
                MenuInfo.MenuName = item.MenuName;
                MenuInfo.MenuUrl  = item.MenuUrl;
                MenuInfo.MenuCode = item.MenuCode;
                MenuInfo.Depth    = item.Depth;
                MenuInfo.ParentId = item.ParentId;
                MenuInfo.Children = GetChildMenu(viewMenus, item.Id);
                menus.Add(MenuInfo);
            }
            return(menus);
        }
Example #14
0
        private void posts_PreRender(object sender, EventArgs e)
        {
            bool bWatched = HandleWatchTopic();

            MyTestMenu.AddItem("watch", bWatched ? GetText("unwatchtopic") : GetText("watchtopic"));
            MyTestMenu.AddItem("email", GetText("emailtopic"));
            MyTestMenu.AddItem("print", GetText("printtopic"));
            if (BoardSettings.ShowRSSLink)
            {
                MyTestMenu.AddItem("rssfeed", GetText("rsstopic"));
            }
            ViewMenu.AddItem("normal", GetText("NORMAL"));
            ViewMenu.AddItem("threaded", GetText("THREADED"));
            MyTestMenu.Attach(MyTest);
            ViewMenu.Attach(View);

            if (!m_bDataBound)
            {
                BindData();
            }
        }
Example #15
0
        public static string ParseJsonData(List<Menu> list)
        {
            StringBuilder postData = new StringBuilder();
            List<ViewMenu> parentList = new List<ViewMenu>();
            foreach (var item in list)
            {
                if (item.ParentMenuId == 0)
                {
                    ViewMenu vm = new ViewMenu();
                    vm.ParentMenu = new Menu();
                    vm.ParentMenu.MenuId = item.MenuId;
                    vm.ParentMenu.MenuType = item.MenuType;
                    vm.ParentMenu.MenuValue = item.MenuValue;
                    vm.ParentMenu.Title = item.Title;
                    vm.ParentMenu.ParentMenuId = 0;
                    vm.ChildMenuList = (from c in list where c.ParentMenuId == vm.ParentMenu.MenuId select c).ToList();
                    parentList.Add(vm);
                }
            }
            postData.Append("{ \"button\":[");
            foreach (var p in parentList)
            {
                postData.Append("{ \"name\":\"" + p.ParentMenu.Title + "\",");
                if (p.ChildMenuList.Count > 0)
                {
                    postData.Append("\"sub_button\":[");
                    foreach (var sub in p.ChildMenuList.Take(5))
                    {
                        postData.Append("{ \"type\":\"" + sub.MenuType + "\",");
                        postData.Append("\"name\":\"" + sub.Title + "\",");
                        if (sub.MenuType == "view")
                        {
                            postData.Append("\"url\":\"" + sub.MenuValue + "\"");
                        }
                        else
                        {
                            postData.Append("\"key\":\"" + sub.MenuValue + "\"");
                        }
                        postData.Append("},");
                    }
                    if (postData.ToString().EndsWith(","))
                    {
                        postData.Remove(postData.Length - 1, 1);
                    }
                    postData.Append("]");
                }
                else
                {
                    postData.Append("\"type\":\"" + p.ParentMenu.MenuType + "\",");
                    if (p.ParentMenu.MenuType == "view")
                    {
                        postData.Append("\"url\":\"" + p.ParentMenu.MenuValue + "\"");
                    }
                    else
                    {
                        postData.Append("\"key\":\"" + p.ParentMenu.MenuValue + "\"");
                    }
                }
                postData.Append("},");
            }
            if (postData.ToString().EndsWith(","))
            {
                postData.Remove(postData.Length - 1, 1);
            }
            postData.Append("]}");

            //StringBuilder sb = new StringBuilder();
            //sb.Append("{\"button\":[{\"type\":\"click\",\"name\":\"今日歌曲\",\"key\":\"V1001_TODAY_MUSIC\"},{\"name\":\"菜单\",\"sub_button\":[{\"type\":\"view\",\"name\":\"搜索\",\"url\":\"http://www.soso.com/\"}]}]}");

            return postData.ToString();
        }
        public void StartMenuOperacoes(ViewContaBancaria viewConta, ViewRelatorioOperacoes viewRelatorioOperacoes, ViewMenu viewMenu, ViewTransferencia viewTransferencia, ViewDeposito viewDeposito, ViewSaque viewSaque, RelatorioOperacaoDao relatorioDao, ContaBancariaDao contaDao)
        {
            ConsoleKeyInfo _opcao;

            Console.WriteLine("\n PRESSIONE: \n\n F1 Para realizar um saque \n F2 Para fazer um deposito \n F3 Para fazer uma transferencia \n F4 Para exibir o relatorio de operacoes \n F12 para voltar ao menu principal");
            _opcao = Console.ReadKey();
            switch (_opcao.Key)
            {
            case ConsoleKey.F1:
                Console.Clear();
                viewSaque.RealizaSaque(relatorioDao, contaDao, viewConta);
                break;

            case ConsoleKey.F2:
                Console.Clear();
                viewDeposito.RealizaDeposito(contaDao, viewConta, relatorioDao);
                break;

            case ConsoleKey.F3:
                Console.Clear();
                viewTransferencia.RealizaTransferencia(viewConta, relatorioDao, contaDao);
                break;

            case ConsoleKey.F4:
                Console.Clear();
                viewRelatorioOperacoes.VisualizaRelatorioDeOperacoes(relatorioDao);
                break;

            case ConsoleKey.F12:
                Console.Clear();
                viewMenu.IniciaMenu();
                break;
            }
        }
Example #17
0
 private void button2_Click(object sender, EventArgs e)
 {
     ViewMenu.Show(PointToScreen(DroplocView.Location));
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public AlignmentViewModel()
        {
            Options = new RuntimeOptionsViewModel();

            _isScreenSplit = false;
            _rightPaneSize = Double.PositiveInfinity;

            SplitScreenCommand    = new DelegatingCommand(() => IsScreenSplit = !IsScreenSplit);
            ShowOptionsCommand    = new DelegatingCommand(OnShowOptions);
            ShowBirdsEyeView      = new DelegatingCommand(OnShowBev);
            MakeReferenceSequence = new DelegatingCommand <AlignmentEntityViewModel>(OnMakeReferenceSequence);
            FlipGrouping          = new DelegatingCommand(() => IsGrouped = !IsGrouped, () => SupportsGrouping);
            GotoColumn            = new DelegatingCommand(OnGotoColumn);
            GotoRow                   = new DelegatingCommand(OnGotoRow);
            GotoRefColumn             = new DelegatingCommand(OnGotoRefColumn, () => HasReferenceSequence);
            FindByName                = new DelegatingCommand(OnFindByName);
            JumpNextNucleotide        = new DelegatingCommand(OnGotoNextNucleotide, () => FocusedRow != null && FocusedColumnIndex < TotalColumns - 1);
            JumpPreviousNucleotide    = new DelegatingCommand(OnGotoPreviousNucleotide, () => FocusedRow != null && FocusedColumnIndex > 0);
            JumpNextRefNucleotide     = new DelegatingCommand(OnGotoNextRefNucleotide, () => FocusedRow != null && FocusedColumnIndex < TotalColumns - 1 && HasReferenceSequence);
            JumpPreviousRefNucleotide = new DelegatingCommand(OnGotoPreviousRefNucleotide, () => FocusedRow != null && FocusedColumnIndex > 0 && HasReferenceSequence);
            ShiftFocusLeft            = new DelegatingCommand(OnShiftFocusLeft, () => FocusedRow != null);
            ShiftFocusRight           = new DelegatingCommand(OnShiftFocusRight, () => FocusedRow != null);
            FindByTaxonomy            = new DelegatingCommand(OnFindByTaxonomy, () => IsGrouped);

            OptionsMenu.Add(new MenuItem("Change _View Options")
            {
                Command = ShowOptionsCommand, GestureText = "Ctrl+O"
            });
            _groupByMenuItem = new MenuItem("Group By Taxonomy")
            {
                Command = FlipGrouping, IsChecked = IsGrouped, GestureText = "Ctrl+G"
            };
            OptionsMenu.Add(_groupByMenuItem);

            _splitScreenMenuItem = new MenuItem("Split Screen View")
            {
                Command = SplitScreenCommand, IsChecked = IsScreenSplit, GestureText = "Ctrl+S"
            };
            ViewMenu.Add(_splitScreenMenuItem);
            ViewMenu.Add(new MenuItem("_Taxonomy Browser")
            {
                Command = FindByTaxonomy, GestureText = "Ctrl+T"
            });
            ViewMenu.Add(new MenuItem("Birds-Eye Viewer")
            {
                Command = ShowBirdsEyeView, GestureText = "Ctrl+B"
            });

            EditMenu.Add(new MenuItem("Jump To _Column")
            {
                Command = GotoColumn, GestureText = "Ctrl+C"
            });
            EditMenu.Add(new MenuItem("Jump To _Row")
            {
                Command = GotoRow, GestureText = "Ctrl+R"
            });
            EditMenu.Add(new MenuItem());
            EditMenu.Add(new MenuItem("Jump To Previous Nucelotide")
            {
                Command = JumpPreviousNucleotide, GestureText = "F2"
            });
            EditMenu.Add(new MenuItem("Jump To Next Nucelotide")
            {
                Command = JumpNextNucleotide, GestureText = "F3"
            });
            EditMenu.Add(new MenuItem());
            EditMenu.Add(new MenuItem("Jump To Reference Nucelotide")
            {
                Command = GotoRefColumn, GestureText = "Ctrl+N"
            });
            EditMenu.Add(new MenuItem("Jump To Previous Reference Nucelotide")
            {
                Command = JumpPreviousRefNucleotide, GestureText = "Ctrl+F2"
            });
            EditMenu.Add(new MenuItem("Jump To Next Reference Nucelotide")
            {
                Command = JumpNextRefNucleotide, GestureText = "Ctrl+F3"
            });
            EditMenu.Add(new MenuItem());
            EditMenu.Add(new MenuItem("Find By _Name")
            {
                Command = FindByName, GestureText = "Ctrl+F"
            });

            NucleotideColorSelector = new NucleotideColorSelector(this, Options);
            _leftView  = new SplitPaneViewModel(this);
            _rightView = new SplitPaneViewModel(this);

            // Set the intial view
            SetActiveView(_leftView);
        }