public void showProp()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClientMenu menu = new ClientMenu();

            Application.Run(menu);
        }
Exemple #2
0
        // GET: Client
        public ActionResult Menu(int? categoryId)
        {
            ClientMenu cm = new ClientMenu();
            cm.Categories = db.DishCategories;
            IEnumerable<Dish> dishes = db.Dishes;
            if (categoryId != null)
                cm.Dishes = dishes.Where(s => s.CategoryId == categoryId);
            else
                cm.Dishes = dishes;

            ViewBag.SelectedCategoryId = categoryId ?? 0;

            return View(cm);
        }
Exemple #3
0
        public ClientMenuManageModel(ClientMenu menu)
        {
            _clientMenuServices = HostContainer.GetInstance <IClientMenuServices>();
            Id   = menu.Id;
            Name = menu.Name;
            Url  = menu.Url;
            IncludeInSiteNavigation = menu.IncludeInSiteNavigation;
            StartPublishingDate     = menu.StartPublishingDate;
            EndPublishingDate       = menu.EndPublishingDate;
            ParentId = menu.ParentId;
            Parents  = _clientMenuServices.GetPossibleParents(menu.Id);

            int position;
            int relativePageId;
            var relativePages = _clientMenuServices.GetRelativeMenus(out position, out relativePageId, menu.Id, menu.ParentId);

            Position       = position;
            Positions      = EnumUtilities.GetSelectListFromEnum <PageEnums.PositionEnums>();
            RelativeMenuId = relativePageId;
            RelativeMenus  = relativePages;
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pageId"></param>
        /// <returns></returns>
        public ResponseModel SavePageToClientMenu(int pageId)
        {
            var page       = _pageRepository.GetById(pageId);
            var clientMenu = FetchFirst(c => c.PageId == pageId);

            if (clientMenu != null)
            {
                clientMenu.Name   = page.Title;
                clientMenu.PageId = page.Id;
                clientMenu.Url    = page.FriendlyUrl;
                if (page.ParentId.HasValue && page.Page1.ClientMenus.Any())
                {
                    clientMenu.ParentId = page.Page1.ClientMenus.First().Id;
                }
                else
                {
                    clientMenu.ParentId = null;
                }
                clientMenu.IncludeInSiteNavigation = page.IncludeInSiteNavigation;
                clientMenu.StartPublishingDate     = page.StartPublishingDate;
                clientMenu.EndPublishingDate       = page.EndPublishingDate;
                if (page.RecordOrder * 10 != clientMenu.RecordOrder)
                {
                    var relativePages = _pageRepository.Fetch(p => (page.ParentId.HasValue ? p.ParentId == page.ParentId : !p.ParentId.HasValue) && p.Id != page.Id);
                    foreach (var relativePage in relativePages)
                    {
                        var relativeMenu = relativePage.ClientMenus.First();
                        relativeMenu.RecordOrder = relativePage.RecordOrder * 10;
                        Update(relativeMenu);
                    }
                    clientMenu.RecordOrder = page.RecordOrder * 10;
                }
                clientMenu.RecordActive = page.RecordActive;
                return(HierarchyUpdate(clientMenu));
            }
            clientMenu = new ClientMenu(page);
            return(HierarchyInsert(clientMenu));
        }
        public void show()
        {
            ClientMenu menu = new ClientMenu();

            Application.Run(menu);
        }
Exemple #6
0
 public ResponseModel Delete(ClientMenu clientMenu)
 {
     return(_clientMenuRepository.Delete(clientMenu));
 }
Exemple #7
0
 public ResponseModel HierarchyInsert(ClientMenu clientMenu)
 {
     return(_clientMenuRepository.HierarchyInsert(clientMenu));
 }
Exemple #8
0
 public ResponseModel HierarchyUpdate(ClientMenu clientMenu)
 {
     return(_clientMenuRepository.HierarchyUpdate(clientMenu));
 }
Exemple #9
0
 public ResponseModel Update(ClientMenu clientMenu)
 {
     return(_clientMenuRepository.Update(clientMenu));
 }
Exemple #10
0
 public ResponseModel Insert(ClientMenu clientMenu)
 {
     return(_clientMenuRepository.Insert(clientMenu));
 }
Exemple #11
0
        /// <summary>
        /// Save client menu manage model
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel SaveClientMenuManageModel(ClientMenuManageModel model)
        {
            ClientMenu    relativeMenu;
            ResponseModel response;
            var           clientMenu = GetById(model.Id);

            #region Edit ClientMenu
            if (clientMenu != null)
            {
                clientMenu.Name = model.Name;

                clientMenu.IncludeInSiteNavigation = model.IncludeInSiteNavigation;
                clientMenu.StartPublishingDate     = model.StartPublishingDate;
                clientMenu.EndPublishingDate       = model.EndPublishingDate;

                //Parse url
                clientMenu.Url = string.IsNullOrWhiteSpace(model.Url)
                                       ? model.Name.ToUrlString()
                                       : model.Url.ToUrlString();

                //Get page record order
                relativeMenu = GetById(model.RelativeMenuId);
                if (relativeMenu != null)
                {
                    if (model.Position == (int)ClientMenuEnums.PositionEnums.Before)
                    {
                        clientMenu.RecordOrder = relativeMenu.RecordOrder;
                        var query =
                            string.Format(
                                "Update ClientMenus set RecordOrder = RecordOrder + 1 Where {0} And RecordOrder >= {1}",
                                relativeMenu.ParentId.HasValue ? string.Format(" ParentId = {0}", relativeMenu.ParentId) : "ParentId Is NULL", relativeMenu.RecordOrder);
                        _pageRepository.ExcuteSql(query);
                    }
                    else
                    {
                        clientMenu.RecordOrder = relativeMenu.RecordOrder + 1;
                        var query =
                            string.Format(
                                "Update ClientMenus set RecordOrder = RecordOrder + 1 Where {0} And RecordOrder > {1}",
                                relativeMenu.ParentId.HasValue ? string.Format(" ParentId = {0}", relativeMenu.ParentId) : "ParentId Is NULL", relativeMenu.RecordOrder);
                        _pageRepository.ExcuteSql(query);
                    }
                }

                clientMenu.ParentId = model.ParentId;
                response            = HierarchyUpdate(clientMenu);

                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateSuccessfully:::Update client menu successfully.")
                    : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateFailure:::Update client menu failed. Please try again later.")));
            }
            #endregion

            clientMenu = new ClientMenu
            {
                Name     = model.Name,
                ParentId = model.ParentId,
                IncludeInSiteNavigation = model.IncludeInSiteNavigation,
                StartPublishingDate     = model.StartPublishingDate,
                EndPublishingDate       = model.EndPublishingDate,
                Url = string.IsNullOrWhiteSpace(model.Url) ? model.Name.ToUrlString() : model.Url.ToUrlString()
            };

            //Get menu record order
            relativeMenu = GetById(model.RelativeMenuId);
            if (relativeMenu != null)
            {
                if (model.Position == (int)ClientMenuEnums.PositionEnums.Before)
                {
                    clientMenu.RecordOrder = relativeMenu.RecordOrder - 1;
                }
                else
                {
                    clientMenu.RecordOrder = relativeMenu.RecordOrder + 1;
                }
            }

            response = HierarchyInsert(clientMenu);
            return(response.SetMessage(response.Success ?
                                       _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateSuccessfully:::Create client menu successfully.")
                : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateFailure:::Create client menu failed. Please try again later.")));
        }
Exemple #12
0
        // User Logged In Successfully Changes the hole interface according to user role
        public void OnUserLoggedIn(object sender, LoginEventArgs e) // I must add admin / client default form event handeler subscription when implemented
        {
            // Disable Logins
            SignInBtn.Enabled   = false;
            SignInBtn.Visible   = false;
            SignUpBtn.IconChar  = IconChar.SignOutAlt;
            SignUpBtn.Text      = "Sign Out";
            SignUpBtn.IconColor = RGBColors.color6;

            // Show the logged in panel
            LoggedPannel.Visible = true;
            LoggedLabel.Text     = "Welcome " + e.User.Email + " !";

            // Set user Informations to this login
            currentUser = e.User;

            // Close current child forms
            if (currentChildForm != null)
            {
                currentChildForm.Close();
            }
            if (currentMenuForm != null)
            {
                currentMenuForm.Close();
            }
            if (currentSignForm != null)
            {
                currentSignForm.Close();
            }

            // Disable loggin panel
            SignPanel.Enabled = false;
            SignPanel.Visible = false;
            SignPanel.Dispose();

            // check for user role and open corresponding child forms
            if (e.User.Role == User.Admin)
            {
                // set color for header
                CurrentChildFormIcon.IconColor  = RGBColors.color2;
                CurrentChildFormTitle.ForeColor = RGBColors.color2;

                // Open admin forms
                AdminMenu adminMenu = new AdminMenu();
                adminMenu.SelectedMenu += OnSelectedMenu;
                // Here add other event handler subscription if needed in the future
                OpenMenuForm(adminMenu);

                Adherents adherents = new Adherents();

                /*
                 * Here Add your event handelers when implemented
                 */
                OpenChildForm(adherents);
            }

            else if (e.User.Role == User.NonPayedClient || e.User.Role == User.NonRegisteredClient)
            {
                // Create Unregistered Forms
                UnsubscribedClientMenu unsubscribedClientMenu = new UnsubscribedClientMenu(currentUser);
                unsubscribedClientMenu.SelectedMenu += OnSelectedMenu;
                OpenMenuForm(unsubscribedClientMenu);
            }

            else if (e.User.Role == User.Client)
            {
                // Open client forms
                ClientMenu clientMenu = new ClientMenu();
                clientMenu.SelectedMenu += OnSelectedMenu;
                // Here add other event handler subscription if needed in the future
                OpenMenuForm(clientMenu);

                UpdateCurrentUser();
                Profile profile = new Profile(currentUser);

                /*
                 * Here Add your event handelers when implemented
                 */
                OpenChildForm(profile);
            }
        }