private void wczytaj_Click(object sender, RoutedEventArgs e)
        {
            string data_format = data.SelectedDate.Value.Day + " " + GetMonth(data.SelectedDate.Value.Month) + " " + data.SelectedDate.Value.Year;

            Models.Menu menu = DAO.MenusDAO.SelectAll(data_format, miasto.SelectedValue.ToString(), dieta.SelectedValue.ToString());

            if (menu != null)
            {
                Properties.Settings.Default.dashboard_nazwa_sniadanie    = menu.nazwa_sniadanie;
                Properties.Settings.Default.dashboard_nazwa_IIsniadanie  = menu.nazwa_IIsniadanie;
                Properties.Settings.Default.dashboard_nazwa_obiad        = menu.nazwa_obiad;
                Properties.Settings.Default.dashboard_nazwa_podwieczorek = menu.nazwa_podwieczorek;
                Properties.Settings.Default.dashboard_nazwa_kolacja      = menu.nazwa_kolacja;

                Properties.Settings.Default.dashboard_sklad_sniadanie    = menu.sklad_sniadanie;
                Properties.Settings.Default.dashboard_sklad_IIsniadanie  = menu.sklad_IIsniadanie;
                Properties.Settings.Default.dashboard_sklad_obiad        = menu.sklad_obiad;
                Properties.Settings.Default.dashboard_sklad_podwieczorek = menu.sklad_podwieczorek;
                Properties.Settings.Default.dashboard_sklad_kolacja      = menu.sklad_kolacja;

                Properties.Settings.Default.dashboard_diet = dieta.SelectedIndex;
                Properties.Settings.Default.dashboard_unit = miasto.SelectedIndex;
                Properties.Settings.Default.dashboard_date = Convert.ToDateTime(data.SelectedDate);

                Properties.Settings.Default.Save();

                this.NavigationService.GoBack();
            }
            else
            {
                MessageBox.Show("Nie znaleziono jadłospisu", "Błąd");
            }
        }
        private void crearArbol(List <MenuPadre_Result> L)
        {
            // Usuarios xx = (Usuarios)base.Session["USUARIO"];
            //  string eso = xx.CliNit.ToString();
            try
            {
                int imagen = 1;
                foreach (MenuPadre_Result result in L)
                {
                    TreeNode r = new TreeNode();
                    MenuItem a = new MenuItem();

                    Models.Menu m = new Models.Menu();
                    r.Text        = result.DescMenu;
                    r.NavigateUrl = result.Url;
                    r.ToolTip     = result.DescMenu;
                    m.IdPadre     = new int?(result.IdMenu);
                    this.CrearHijos(this.bMenu.ObtenerHijos((Usuarios)base.Session["USUARIO"], m), r, a);
                    //  this.TreeView1.Nodes.Add(r);

                    a.Text        = result.DescMenu;
                    a.NavigateUrl = "#";
                    a.ToolTip     = result.DescMenu;
                    a.ImageUrl    = ".." + result.UrlImagen;
                    this.NavigationMenu.Items.Add(a);

                    imagen++;
                }
                //this.TreeView1.Nodes;
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Example #3
0
        private void GetMenu()
        {
            SqlHelper           sqlHelper  = new SqlHelper();
            List <SqlParameter> parameters = new List <SqlParameter>();

            Models.Menu menu;

            data = sqlHelper.ExecuteDataSet("ListadoMenu", parameters.ToArray());

            foreach (DataRow row in data.Tables[0].Select("IdPadre = 0"))
            {
                menu = new Models.Menu
                {
                    IdMenu      = Convert.ToInt32(row["IdMenu"]),
                    IdPadre     = Convert.ToInt32(row["IdPermiso"]),
                    IdPermiso   = Convert.ToInt32(row["IdPermiso"]),
                    Descripcion = Convert.ToString(row["Descripcion"]),
                    Url         = Convert.ToString(row["Url"])
                };

                GetSubMenu(menu);

                listMenu.Add(menu);
            }
        }
Example #4
0
        public override bool Read()
        {
            Models.Menu Menu = (Models.Menu)Model;

            Dictionary <String, UserPositions[]> readList = new Dictionary <string, UserPositions[]>();

            readList.Add("Company", new UserPositions[] { UserPositions.Admin, UserPositions.ProjectManager, UserPositions.Developer, UserPositions.Customer });
            readList.Add("Project", new UserPositions[] { UserPositions.Admin, UserPositions.ProjectManager, UserPositions.Developer, UserPositions.Customer });
            readList.Add("Milestone", new UserPositions[] { UserPositions.Admin, UserPositions.ProjectManager, UserPositions.Developer, UserPositions.Customer });
            readList.Add("Task", new UserPositions[] { UserPositions.Admin, UserPositions.ProjectManager, UserPositions.Developer, UserPositions.Customer });
            readList.Add("User", new UserPositions[] { UserPositions.Admin, UserPositions.ProjectManager, UserPositions.Developer });
            readList.Add("Menu", new UserPositions[] { UserPositions.Admin });

            if (readList.ContainsKey(Menu.controller))
            {
                if (readList[Menu.controller].ToList().Contains((UserPositions)User.position))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        public static string Import(string portalId, Models.Menu menu, Dictionary <string, string> idMap, string userId = null)
        {
            userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId;
            var existing = Get(portalId, menu.Name);

            if (existing != null)
            {
                menu.Id = existing.Id;
            }
            else
            {
                menu.Id = null;
            }
            menu.PortalId = portalId;
            foreach (var item in menu.Items)    //todo: only support 2 levels for now...
            {
                foreach (var subItem in item.Items)
                {
                    subItem.Roles = Security.GetNewRoleIds(subItem.Roles, idMap);
                }
                item.Roles = Security.GetNewRoleIds(item.Roles, idMap);
            }

            return(Save(menu, userId));
        }
Example #6
0
 public CommentPageViewModel(Models.Menu menu)
 {
     this.SelectedMenu       = menu;
     this.PostCommentCommand = new Command(this.PostComment);
     this.GotoProfileCommand = new Command(this.GotoProfile);
     this.RefreshCommand     = new Command(this.Refresh);
 }
 protected void rbPadres_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         this.bMenu = new GestorDocumental.Controllers.MenuController();
         Models.Menu mP = new Models.Menu
         {
             IdMenu = int.Parse(this.rbPadres.SelectedValue)
         };
         this.chkHijos.DataSource     = this.bMenu.ObtenerHijos(mP);
         this.chkHijos.DataTextField  = "DescMenu";
         this.chkHijos.DataValueField = "IdMenu";
         this.chkHijos.DataBind();
         P_Roles r = new P_Roles
         {
             RolId = int.Parse(this.lstPerfil.SelectedValue)
         };
         this.ResaltarOpcionesMenu(this.bMenu.ObtenerHijosPerfil(r, mP));
         this.UpdatePanel2.Update();
     }
     catch (Exception exception)
     {
         this.lblError.Text = exception.Message;
         this.UpdatePanel3.Update();
     }
 }
Example #8
0
 public LocalMenu(Models.Menu menu)
 {
     this.ID             = menu.ID;
     this.Name           = menu.Name;
     this.Headline       = menu.Headline;
     this.Portion        = menu.Portion;
     this.ImageSource    = menu.ImageSource;
     this.Price          = menu.Price;
     this.Like           = menu.Like;
     this.Promoted       = menu.Promoted;
     this.PostID         = menu.PostID;
     this.OwnerID        = menu.Owner.ID;
     this.Username       = menu.Owner.Email;
     this.Email          = menu.Owner.Email;
     this.OwnerName      = menu.Owner.Name;
     this.OwnerHeadline  = menu.Owner.Headline;
     this.OpeningHour    = menu.Owner.OpeningHour;
     this.ClosingHour    = menu.Owner.ClosingHour;
     this.ProfilePicture = menu.Owner.ProfilePicture;
     this.ContactNumber  = menu.Owner.ContactNumber;
     this.ContactWA      = menu.Owner.ContactWA;
     this.Address        = menu.Owner.Location.Address;
     this.City           = menu.Owner.Location.City;
     this.Country        = menu.Owner.Location.Country;
     this.Latitude       = menu.Owner.Location.Latitude;
     this.Longitude      = menu.Owner.Location.Longitude;
 }
Example #9
0
        private void InitializeMenu()
        {
            UserService userService  = new UserService();
            string      userFullName = userService.CurrentUserName();

            Menu = new Models.Menu
            {
                Welcome      = $"Hoş Geldiniz {userFullName}",
                GeneralItems = new List <Models.Menu.Item>(),
                ProfileItems = new List <Models.Menu.Item>(),
                ActionItems  = new List <Models.Menu.Item>()
            };

            Menu.GeneralItems.Add(new Models.Menu.Item {
                Title = "Duyurular", TargetType = typeof(AnnouncementListPage), IsPage = false
            });

            Menu.ProfileItems.Add(new Models.Menu.Item {
                Title = "Duyurularınız", TargetType = typeof(ProfileAnnouncementListPage), IsPage = false
            });
            Menu.ProfileItems.Add(new Models.Menu.Item {
                Title = "Beğenileriniz", TargetType = typeof(ProfileLikeListPage), IsPage = false
            });
            Menu.ProfileItems.Add(new Models.Menu.Item {
                Title = "Önerileriniz", TargetType = typeof(ProfileRecommendationListPage), IsPage = false
            });

            Menu.ActionItems.Add(new Models.Menu.Item {
                Title = "Yeni Duyuru Ekle", TargetType = typeof(AnnouncementFormPage), IsPage = true
            });
            Menu.ActionItems.Add(new Models.Menu.Item {
                Title = "Arama", TargetType = typeof(SearchPage), IsPage = false
            });
        }
Example #10
0
        private void wczytaj_Click(object sender, RoutedEventArgs e)
        {
            Models.Menu menu = jadlospisyDanegoDnia[dieta.SelectedIndex];

            if (menu != null)
            {
                Properties.Settings.Default.dashboard_nazwa_sniadanie    = menu.nazwa_sniadanie;
                Properties.Settings.Default.dashboard_nazwa_IIsniadanie  = menu.nazwa_IIsniadanie;
                Properties.Settings.Default.dashboard_nazwa_obiad        = menu.nazwa_obiad;
                Properties.Settings.Default.dashboard_nazwa_podwieczorek = menu.nazwa_podwieczorek;
                Properties.Settings.Default.dashboard_nazwa_kolacja      = menu.nazwa_kolacja;

                Properties.Settings.Default.dashboard_sklad_sniadanie    = menu.sklad_sniadanie;
                Properties.Settings.Default.dashboard_sklad_IIsniadanie  = menu.sklad_IIsniadanie;
                Properties.Settings.Default.dashboard_sklad_obiad        = menu.sklad_obiad;
                Properties.Settings.Default.dashboard_sklad_podwieczorek = menu.sklad_podwieczorek;
                Properties.Settings.Default.dashboard_sklad_kolacja      = menu.sklad_kolacja;

                Properties.Settings.Default.dashboard_diet = dieta.SelectedIndex;
                Properties.Settings.Default.dashboard_unit = miasto.SelectedIndex;

                Properties.Settings.Default.Save();

                this.NavigationService.GoBack();
            }
            else
            {
                MessageBox.Show("Nie znaleziono jadłospisu", "Błąd");
            }
        }
        public async Task <IActionResult> UpdateMenu(int menuId,
                                                     [FromBody] Models.Menu menu)
        {
            if (menu == null)
            {
                return(BadRequest());
            }

            var menuEnt = await _menuService.GetMenuAsync(menuId);

            if (menuEnt == null)
            {
                return(NotFound(new { Error = $"A menu with the ID '{menuId}' could not be found." }));
            }

            TryValidateModel(menu);

            // Add validation
            if (!ModelState.IsValid)
            {
                return(new UnprocessableEntityObjectResult(ModelState));
            }

            _menuMapper.MapMenuModelToEntity(menu, menuEnt);

            _menuService.UpdateMenu(menuEnt);

            if (!await _menuService.SaveChangesAsync())
            {
                throw new Exception($"Error updating menu '{menuEnt.Name}'.");
            }

            return(NoContent());
        }
Example #12
0
        public IActionResult Create([FromBody] Models.Menu menu)
        {
            IActionResult result = null;

            if (menu == null)
            {
                result = BadRequest("Missing menu data");
            }

            if (result == null)
            {
                using (ILifetimeScope scope = m_container.BeginLifetimeScope())
                {
                    IMenuFactory factory   = scope.Resolve <IMenuFactory>();
                    IMenu        innerMenu = factory.Create();
                    IMapper      mapper    = new Mapper(m_mapperConfiguration);
                    mapper.Map <Models.Menu, IMenu>(menu, innerMenu);

                    if (string.IsNullOrEmpty(innerMenu.Title))
                    {
                        result = BadRequest("Missing title");
                    }

                    if (result == null)
                    {
                        IMenuSaver saver = scope.Resolve <IMenuSaver>();
                        saver.Create(m_settings.Value, innerMenu);
                        result = Ok(mapper.Map <Models.Menu>(innerMenu));
                    }
                }
            }

            return(result);
        }
        public void MapMenuModelToEntity(Models.Menu menuMod, Entities.Menu menuEnt)
        {
            var mapper = new MapperConfiguration(configure =>
                                                 configure.CreateMap <Models.Menu, Entities.Menu>())
                         .CreateMapper();

            mapper.Map(menuMod, menuEnt);
        }
Example #14
0
        public static string Save(Models.Menu menu, string userId = null)
        {
            userId        = string.IsNullOrEmpty(userId) ? Account.AuditId : userId;
            menu.PortalId = string.IsNullOrEmpty(menu.PortalId) ? Services.Portal.CurrentPortalId : menu.PortalId;
            Validate(menu);
            var res = Repository.Current.StoreResource("Menu", null, menu, userId);

            return(res.Id);
        }
Example #15
0
        public static bool IsDuplicate(Models.Menu menu)
        {
            var r = Get(menu.PortalId, menu.Name);

            if (r != null)
            {
                return(r.Id != menu.Id);
            }
            return(false);
        }
Example #16
0
        public CommentPage(Models.Menu menu)
        {
            InitializeComponent();

            this.ViewModel = new CommentPageViewModel(menu)
            {
                Title = this.Title
            };
            this.BindingContext = this.ViewModel;
        }
Example #17
0
 public static void Validate(Models.Menu menu)
 {
     if (string.IsNullOrEmpty(menu.Name))
     {
         throw new Exception(Localization.GetExceptionText("InvalidResource.Error", "{0} is invalid.", "Menu"));
     }
     if (IsDuplicate(menu))
     {
         throw new Exception(Localization.GetExceptionText("DuplicateResource.Error", "{0} already exists.   Duplicates Not Allowed.", "Menu"));
     }
 }
 public ActionResult Index(string meal = "", string dish = "")
 {
     var menu = new Models.Menu();
     menu.SelectedMeal = meal;
     var selected = menu.Items
         .Where(s => s.Meal == meal && s.Key == dish)
         .FirstOrDefault();
     if (selected != null)
         selected.IsSelected = true;
     return View(menu);
 }
Example #19
0
        public static int Register(Models.Menu menu)
        {
            var count = 0;

            if (!Menu.Exists(menu))
            {
                Logging.Logger.InfoFormat("Registering menu: {0}", menu.Name);
                Menu.Save(menu, Account.AuditId);
                count++;
            }
            return(count);
        }
Example #20
0
        private async void SelectMenu(Models.Menu menu)
        {
            if (this.IsBusy)
            {
                return;
            }
            this.IsBusy = true;

            await this.NavigationService.NavigateTo(typeof(MenuDetailPage), new object[] { menu });

            this.IsBusy = false;
        }
Example #21
0
        private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            Models.Menu menu = e.SelectedItem as Models.Menu;
            if (menu == null)
            {
                return;
            }

            await this.Navigation.PushAsync(new MenuViewPage(menu), true);

            MenuListView.SelectedItem = null;
        }
Example #22
0
        private void MenuListView_ItemSelected(object sender, ItemTappedEventArgs e)
        {
            Models.Menu menu = e.Item as Models.Menu;
            if (menu == null)
            {
                return;
            }

            if (this.ViewModel.SelectMenuCommand.CanExecute(menu))
            {
                this.ViewModel.SelectMenuCommand.Execute(menu);
            }
        }
Example #23
0
        public async Task SyncItem()
        {
            if (this.IsBusy)
            {
                return;
            }
            this.IsBusy       = true;
            this.IsRefreshing = true;

            var list = await App.SavedMenuDatabase.GetMenusAsync();

            if (list == null)
            {
                this.IsRefreshing = false;
                this.IsBusy       = false;
                return;
            }

            foreach (LocalMenu menu in list)
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Task.Run(async() =>
                {
                    if (!CrossConnectivity.Current.IsConnected)
                    {
                        return;
                    }

                    Models.Menu newMenu = await MenuService.GetMenu(menu.ID);
                    if (newMenu == null)
                    {
                        return;
                    }

                    await App.SavedMenuDatabase.SaveMenuAsync(new LocalMenu(newMenu));

                    var curMenu = this.MenuList.Where(m => m.ID == newMenu.ID).FirstOrDefault();
                    if (curMenu == null)
                    {
                        return;
                    }

                    int idx            = this.MenuList.IndexOf(curMenu);
                    this.MenuList[idx] = newMenu;
                });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }

            this.IsRefreshing = false;
            this.IsBusy       = false;
        }
Example #24
0
        public void Update(Models.Menu menuItem)
        {
            Menu menuFromDatabase = GetMenuItembyID(menuItem.MenuId);

            if (menuFromDatabase != null)
            {
                db.Entry(menuFromDatabase).CurrentValues.SetValues(menuItem);
                db.SaveChanges();
            }
            else
            {
                throw new Exception("Menu Not Found");
            }
        }
        public MenuViewPageViewModel(Models.Menu menu)
        {
            this.SelectedMenu       = menu;
            this.PromoteMenuCommand = new Command(this.PromoteMenu);
            this.PreviewCommand     = new Command(this.GotoPreview);
            this.SaveCommand        = new Command(this.SaveMenu);
            this.DeleteMenuCommand  = new Command(this.DeleteMenu);

            this.ImageSource     = menu.ImageSource;
            this.NameText        = this.SelectedMenu.Name;
            this.DescriptionText = this.SelectedMenu.Headline;
            this.PortionText     = this.SelectedMenu.Portion;
            this.PriceText       = this.SelectedMenu.Price.ToString();
        }
        public MenuDetailPageViewModel(Models.Menu menu)
        {
            this.SelectedMenu         = menu;
            this.OpenOwnerCommand     = new Command(this.OpenOwner);
            this.OpenWhatsAppCommand  = new Command(this.OpenWhatsApp);
            this.ShareCommand         = new Command(this.ShareMenu);
            this.OpenMapDetailCommand = new Command(this.OpenMapDetail);
            this.RefreshPageCommand   = new Command(this.RefreshPage);
            this.PostCommentCommand   = new Command(this.PostComment);
            this.GotoProfileCommand   = new Command(this.GotoProfile);
            this.ViewCommentsCommand  = new Command(this.ViewComments);

            this.InitialiseFields();
        }
Example #27
0
        public SubMenuPage(Models.Menu menu)
        {
            InitializeComponent();

            SubMenus = new ObservableCollection <SubMenu>();

            foreach (var subMenu in menu.SubMenus)
            {
                subMenu.Price += " USD";
                SubMenus.Add(subMenu);
            }

            LvSubMenu.ItemsSource = SubMenus;
        }
 public SubMenuPage(Models.Menu menu)
 {
     InitializeComponent();
     subMenus = new ObservableCollection <SubMenu>();
     foreach (SubMenu subMenuItem in menu.SubMenus)
     {
         if (!subMenuItem.Price.Contains("USD"))
         {
             subMenuItem.Price = subMenuItem.Price + " USD";
         }
         subMenus.Add(subMenuItem);
     }
     LvSubMenu.ItemsSource = subMenus;
 }
Example #29
0
        public ActionResult Index(string meal = "", string dish = "")
        {
            var menu = new Models.Menu();

            menu.SelectedMeal = meal;
            var selected = menu.Items
                           .Where(s => s.Meal == meal && s.Key == dish)
                           .FirstOrDefault();

            if (selected != null)
            {
                selected.IsSelected = true;
            }
            return(View(menu));
        }
Example #30
0
        public AddMenuItemViewModel(Models.Menu menu, IEnumerable <Cheese> cheeses)
        {
            MenuID        = menu.ID;
            MenuName      = menu.Name;
            CheeseChoices = new List <SelectListItem>();

            foreach (Cheese cheese in cheeses)
            {
                CheeseChoices.Add(new SelectListItem
                {
                    Text  = cheese.Name,
                    Value = cheese.ID.ToString()
                });
            }
        }
Example #31
0
        public MenuViewPage(Models.Menu menu)
        {
            InitializeComponent();

            this.ViewModel = new MenuViewPageViewModel(menu)
            {
                Title = this.Title
            };
            this.BindingContext = this.ViewModel;

            if (menu.Promoted)
            {
                this.BtnPromote.Icon = "ic_promoted_active";
            }
        }
Example #32
0
        private CategoryCompany GetMenu()
        {
            List<MusStore.Models.Menu> menu = new List<MusStore.Models.Menu>();
            var topics = _topicRepo.GetAll();
            var companies = _companyRepo.GetAll();
            CategoryCompany displayMenu = new CategoryCompany();
            displayMenu.CompanyCategory = new Dictionary<string, List<MusStore.Models.Menu>>();

            foreach (var item in topics)
            {
                if (item.isVisible)
                {
                    var menuitem = new Models.Menu();
                    menuitem.TopicId = item.Id; //we are assigning topic id here since topic related to that company will be displayed
                    menuitem.CompanyName = companies.Where(p => p.Id == item.CompanyId).FirstOrDefault().CompanyName;
                   //menuitems path is no longer valid it is turned into a guid and
                    //needs to be retrieved from image table
                    //F
                    // menuitem.Path = item.Path;
                    //
                    menuitem.ProductCategory = item.ProductCategory;
                    //menu.Add(menuitem);

                    if (displayMenu.CompanyCategory.ContainsKey(item.ProductCategory))
                    {

                        displayMenu.CompanyCategory[item.ProductCategory].Add(menuitem);
                    }
                    else
                    {
                        displayMenu.CompanyCategory.Add(item.ProductCategory, new List<MusStore.Models.Menu> { menuitem });

                    }

                }
            }

            return displayMenu;
        }
        private Models.Menu GetMenus() {
            Services.Menus menu;
            Models.Menu model = new Models.Menu();

            model.Menus = _menuService.GetMenus(SessionData.customer.id);
            model.Menus.Insert(0, new Menus() { id = 0, CustomerId = SessionData.customer.id, Name = "All", Description = "" });
            menu = model.Menus.Take(1).FirstOrDefault();

            if (menu != null) {
                model.id = menu.id;
                model.Name = menu.Name;
                model.Description = menu.Description;
            }
            model.CurrentMenu = menu;
            return model;
        }