Exemplo n.º 1
0
        private void cmdContextMenu_execute(object obj)
        {
            objMenu = lstMenuMaster.FirstOrDefault(p => p.ID == ctxID);
            if (objMenu == null)
            {
                foreach (Models.MenuMaster item in lstMenuMaster)
                {
                    objMenu = item.lstChild.FirstOrDefault(p => p.ID == ctxID);
                    if (objMenu != null)
                    {
                        break;
                    }
                }
            }

            gridRoot        = System.Windows.Visibility.Collapsed;
            gridUserControl = System.Windows.Visibility.Collapsed;
            if (obj != null)
            {
                paramVal = Convert.ToInt32(obj);
                if ((paramVal == 5 || paramVal == 6) && objMenu.ScreenID > 0)
                {
                    IMSLibrary.UI.UIHelper.ShowErrorMessage("Please select Parent or Child Parent Node");
                    return;
                }
                if (paramVal == 1 || paramVal == 3 || paramVal == 5)
                {
                    gridRoot = System.Windows.Visibility.Visible;
                    return;
                }
                if (paramVal == 2 || paramVal == 6)
                {
                    gridUserControl = System.Windows.Visibility.Visible;
                    return;
                }
                if (paramVal == 4)
                {
                    try
                    {
                        System.Windows.MessageBoxResult mresult = Xceed.Wpf.Toolkit.MessageBox.Show("Do you want to Delete this Hierarchy?", "", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question);
                        if (mresult == System.Windows.MessageBoxResult.Yes && pxy.DeleteMenuMaster(ctxID))
                        {
                            GetMenuData();
                            IMSLibrary.UI.UIHelper.ShowMessage("Menu Modified");
                        }
                    }
                    catch (FaultException ex)
                    {
                        IMSLibrary.UI.UIHelper.ShowErrorMessage(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private ObservableCollection <Models.MenuMaster> AddChildItems(ObservableCollection <Models.MenuMaster> lstMenu, Models.MenuMaster menuItem)
        {
            ObservableCollection <Models.MenuMaster> lstChild = new ObservableCollection <Models.MenuMaster>(lstMenu.Where(p => p.ParentID == Convert.ToInt32(menuItem.ID)).ToList());

            foreach (Models.MenuMaster childItem in lstChild)
            {
                childItem.lstChild = new ObservableCollection <Models.MenuMaster>(AddChildItems(lstMenu, childItem));
            }
            return(lstChild);
        }