public ActionResult Index()
        {
            GlobalModel    global   = new GlobalModel();
            List <Product> proList  = new List <Product>();
            List <Dishes>  dishList = new List <Dishes>();

            global.Products = db.Products.ToList();

            global.Dishes_Products = db.Dishes_Products.ToList();
            global.DishesList      = db.Dishes.Where(dishes => db.Dishes_Products.ToList().Any(dp => dishes.Id == dp.Id_Dishes)).ToList <Dishes>();

            foreach (var pro in db.Products)
            {
                if (pro.UserId == System.Web.HttpContext.Current.User.Identity.GetUserId())
                {
                    proList.Add(pro);
                }
            }
            foreach (var dish in db.Dishes)
            {
                if (dish.UserId == System.Web.HttpContext.Current.User.Identity.GetUserId())
                {
                    dishList.Add(dish);
                }
            }

            global.Products   = proList;
            global.DishesList = dishList;

            return(View(global));
        }
Esempio n. 2
0
        //
        // GET: /Master/

        protected override ViewResult View(string viewName, string masterName, object model)
        {
            //Move all "Global content" into the viewbag - it shouldnt be accessible in the model

            var frontPage = CurrentPage.AncestorOrSelf(1);

            var global = new GlobalModel();

            global.MainMenu = NavigationItemMapper.Map <NavigationItem>(frontPage, CurrentPage);
            ViewBag.Global  = global;

            /*
             * global.isFrontpage = CurrentPage.Id == rootNode.Id;
             *          global.GoogleAnalytics = GoogleAnalyticsMapper.Map<GoogleAnalyticsModel>(CurrentPage, Umbraco);
             *          global.Breadcrumb = NavigationItemMapper.Map(new List<NavigationItemModel>(), CurrentPage.AncestorsOrSelf(),
             *                  CurrentPage, Umbraco);
             *          global.TopMenu = NavigationItemMapper.Map(new List<NavigationItemModel>(), CurrentPage.AncestorsOrSelf(1),
             *                  CurrentPage, Umbraco);
             *          global.InShopContext = ShopHelper.InShopContext(CurrentPage);
             *          global.Seo = SeoMapper.Map<SeoModel>(CurrentPage, global.InShopContext, Umbraco);
             *          SetLanguageDropdown(global, rootNode);
             *          global.SocialMetaData = GetSocialMetaData(global, CurrentPage, rootNode);
             *          ViewBag.Global = global;
             */

            return(base.View(viewName, masterName, model));
        }
Esempio n. 3
0
 public void LeaveGame()
 {
     Connection.Socket.LeaveMatchAsync(Matchmaker.Match);
     Matchmaker.CancelSearch();
     GlobalModel.ResetGameFlags();
     ExitScene("MainMenu");
 }
Esempio n. 4
0
        public ViewResult Edit(int id)
        {
            var customers = _customerManager.Get();
            var services  = _serviceManager.Get();
            var states    = _stateManager.GetStates();
            var order     = _orderManager.GetOrder((int)id);

            GlobalModel vm = new GlobalModel
            {
                Customer   = customers.Customer,
                Service    = services.Service,
                State      = states,
                Id         = order.Id,
                CustomerId = order.Customer.Id,
                ServiceId  = order.Service.Id,
                Date       = order.Date,
                StatusId   = order.Status.Id
            };

            var config  = new MapperConfiguration(cfg => cfg.CreateMap <GlobalModel, GlobalViewModel>());
            var mapper  = new Mapper(config);
            var orderVM = mapper.Map <GlobalViewModel>(vm);

            return(View(orderVM));
        }
        public ActionResult Edit(int?id, string name)
        {
            GlobalModel    global  = new GlobalModel();
            List <Product> proList = new List <Product>();

            global.Dishes = new Dishes();

            foreach (var pro in db.Products)
            {
                if (pro.UserId == System.Web.HttpContext.Current.User.Identity.GetUserId())
                {
                    proList.Add(pro);
                }
            }

            global.Products        = proList;
            global.Dishes_Products = db.Dishes_Products.Where(x => x.Id_Dishes == id).ToList <Dishes_Products>();
            global.DishesList      = db.Dishes.Where(x => x.Id == id).ToList <Dishes>();


            for (int i = 0; i < global.Dishes_Products.Count; i++)
            {
                global.Products.Find(d => d.Id == global.Dishes_Products[i].Id_Product).Volume = global.Dishes_Products[i].gram;
            }

            global.Dishes.Name = name;

            if (id == null)
            {
                return(HttpNotFound());
            }
            return(View(global));
        }
Esempio n. 6
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (returnUrl == "/Account/LogOut")
            {
                returnUrl = null;
            }
            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            EnumUserPortalAuthenticationStatus retVal = _membershipService.ValidateAdmin(model.Email, model.Password);
            GlobalModel global = new GlobalModel();

            switch (retVal)
            {
            case EnumUserPortalAuthenticationStatus.Successful:
                return(RedirectToLocal(returnUrl));

            case EnumUserPortalAuthenticationStatus.UnauthorizedLogin:
                ModelState.AddModelError("", "Unauthorized Login");
                return(View(model));

            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
        // GET: Master
        protected override ViewResult View(IView view, object model)
        {
            var rootNode      = CurrentPage.AncestorOrSelf(1);
            var currentMember = Members.GetCurrentMember();
            var children      = MenuItemMapper.Map <MenuItemModel>(rootNode.Children, CurrentPage, Umbraco).ToList();

            var global = new GlobalModel();

            global.MenuItems = new MenuItemModel()
            {
                Children = children, Url = rootNode.Url, Name = rootNode.Name
            };
            global.MemberLogin = new MemberLoginModel();
            global.IsLoggedIn  = false;
            if (currentMember != null)
            {
                global.IsLoggedIn  = true;
                global.MemberLogin = new MemberLoginModel()
                {
                    Username = currentMember.Name
                };
            }
            global.LoginPage = CurrentPage.Id == 1092 ? true : false;
            ViewBag.Global   = global;

            return(base.View(view, model));
        }
Esempio n. 8
0
        public RaceMainPage(GlobalModel model)
        {
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(UIConfiguration.PanelWidth)
            });
            grid.ColumnSpacing = 0;
            grid.RowSpacing    = 0;

            grid.Children.Add(new LeftPanelBuilder(model).Build(), 0, 0);
            grid.Children.Add(new BoxView()
            {
                Color = UIConfiguration.ButtonColor, WidthRequest = 2, HeightRequest = -1
            }, 1, 0);
            grid.Children.Add(new RightPanelBuilder(model).Build(), 2, 0);

            Content         = grid;
            BackgroundColor = Color.Black;

            MessagingHub.Subscribe <GlobalCommand>(this, QueueType.AskConfirmation, (cmd) => ProcessCommand(cmd));
            MessagingHub.Subscribe <string>(this, QueueType.Gesture, (msg) => ShowMessage(msg));
            //Navigation.PushModalAsync(cp);
        }
        public EnumUserPortalAuthenticationStatus ValidateAdmin(string username, string password)
        {
            MemberBLL bll = new MemberBLL();
            //ResultMessageDC response = new ResultMessageDC();
            AdminEntityDC MemberEntityDC = new AdminEntityDC();

            MemberEntityDC = bll.VerifyUser(username, password);

            if (MemberEntityDC.roleID != "0")
            {
                if (MemberEntityDC.adminID != Guid.Empty)
                {
                    GlobalModel globalModel = new GlobalModel();

                    globalModel.GlobalEmail          = MemberEntityDC.emailAddress;
                    globalModel.GlobalUserPortalText = string.Format("{0} {1}", MemberEntityDC.firstName,
                                                                     MemberEntityDC.lastName);
                    globalModel.GlobalUserID     = MemberEntityDC.adminID.ToString();
                    globalModel.SelectUserRoleID = MemberEntityDC.roleID;
                    //  globalModel.SelectUserRoleName = data.RoleName;
                    //  globalModel.UserImage = data.ProfilePhoto;
                    //   globalModel.Company = data.CompanyID;

                    return(EnumUserPortalAuthenticationStatus.Successful);
                }
            }
            else
            {
                return(EnumUserPortalAuthenticationStatus.UnauthorizedLogin);
            }


            return(EnumUserPortalAuthenticationStatus.InvalidUsernameOrPassword);
        }
Esempio n. 10
0
        protected virtual void Awake()
        {
            Gold = new Property <int>();
            Corn = new Property <int>();
            Gas  = new Property <int>();

            GlobalModel.Connect();
        }
Esempio n. 11
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            var globalModel = new GlobalModel(NetworkDelivery.ArmletDeliveryInstance, NetworkDelivery.GateDeliveryInstance);

            ArmletUI.Model        = globalModel;
            ArmletUI.GateUI.Model = globalModel;
        }
Esempio n. 12
0
        public void Setup(GlobalModel globalModel, Guid?pageSystemId)
        {
            var channel = _channelService.Get(globalModel.ChannelSystemId);

            _requestModelAccessor.RequestModel = new RequestModelImpl(_httpContextAccessor.HttpContext.GetCartContext(),
                                                                      _countryService)
            {
                _channelModel     = new Lazy <ChannelModel>(() => channel.MapTo <ChannelModel>()),
                _searchQuery      = new Lazy <SearchQuery>(() => default), //filterContext.HttpContext.MapTo<SearchQuery>()),
Esempio n. 13
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            Title = "HonorGateServer " + Assembly.GetEntryAssembly().GetName().Version;
            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            var globalModel = new GlobalModel(NetworkDelivery.ArmletDeliveryInstance, NetworkDelivery.GateDeliveryInstance, NetworkDelivery.ShipDamageServiceInstance);

            ArmletUI.Model        = globalModel;
            ArmletUI.GateUI.Model = globalModel;
        }
Esempio n. 14
0
        public App()
        {
            model    = new GlobalModel();
            MainPage = new RaceMainPage(model);
#if SYM
            simulator = new Simulator(model);
            simulator.Start();
#endif
        }
        public ActionResult Edit(GlobalModel list, [Bind(Include = "Id,Name,Date,Calories,Proteins,Carbohydrates,Fats")] Dishes dishes)
        {
            var   selectedProducts = list.Products.Where(x => x.Volume > 0).ToList <Product>();
            float calories = 0, carbo = 0, proteins = 0, fats = 0;

            foreach (Product p in selectedProducts)
            {
                calories += p.Calories * p.Volume / 100;
                carbo    += p.Carbohydrates * p.Volume / 100;
                proteins += p.Proteins * p.Volume / 100;
                fats     += p.Fats * p.Volume / 100;
            }

            dishes.Calories      = calories;
            dishes.Carbohydrates = carbo;
            dishes.Proteins      = proteins;
            dishes.Fats          = fats;
            dishes.Date          = System.DateTime.Now;
            dishes.UserId        = System.Web.HttpContext.Current.User.Identity.GetUserId();

            db.Dishes.Add(dishes);
            db.SaveChanges();

            int id = dishes.Id;



            foreach (Product p in selectedProducts)
            {
                Dishes_Products dishesProducts = new Dishes_Products();
                dishesProducts.Id_Dishes = id;

                dishesProducts.Id_Product = p.Id;
                dishesProducts.gram       = p.Volume;

                db.Dishes_Products.Add(dishesProducts);
                db.SaveChanges();
            }

            {
                var selected = db.Dishes_Products.Where(x => x.Id_Dishes == list.Id).ToList <Dishes_Products>();
                foreach (Dishes_Products d in selected)
                {
                    db.Dishes_Products.Remove(d);
                    db.SaveChanges();
                }

                Dishes dishesD = db.Dishes.Find(list.Id);
                db.Dishes.Remove(dishesD);
                db.SaveChanges();
            }



            return(RedirectToAction("Index", "Dishes_Products"));
        }
 public void Apply(GlobalModel model)
 {
     foreach (var controller in model.Controllers)
     {
         if (controller.ControllerType == _type)
         {
             controller.ApiExplorerIsVisible = false;
         }
     }
 }
Esempio n. 17
0
        public ActionResult ViewStudentProposalSupervisor(String title)
        {
            ViewBag.message = title;
            GlobalViewTitle = title;
            var model = new GlobalModel();

            model.IndexModels = GetDetails(title);

            return(View(model));
        }
        public GlobalModel GetFplJson()
        {
            var client = new RestClient("https://fantasy.premierleague.com/api/bootstrap-static/");

            var response = client.Execute <GlobalModel>(new RestRequest());

            GlobalModel fplPayload = JsonConvert.DeserializeObject <GlobalModel>(response.Content);

            return(fplPayload);
        }
 public void Apply(GlobalModel model)
 {
     foreach (var controller in model.Controllers)
     {
         if (IsConventionApplicable(controller))
         {
             Apply(controller);
         }
     }
 }
Esempio n. 20
0
        private void Awake()
        {
            this.Score       = new Property <int>();
            this.MissileAmmo = new Property <int>();

            playerController.Died += Player_Died;
            playerController.weaponController.MissileAmmoChanged += Player_MissileAmmoChanged;

            GlobalModel.Connect();
        }
        public void ApplyConventions(GlobalModel model)
        {
            // Conventions are applied from the outside-in to allow for scenarios where an action overrides
            // a controller, etc.
            foreach (var convention in _modelConventions)
            {
                convention.Apply(model);
            }

            // First apply the conventions from attributes in decreasing order of scope.
            foreach (var controller in model.Controllers)
            {
                // ToArray is needed here to prevent issues with modifying the attributes collection
                // while iterating it.
                var controllerConventions =
                    controller.Attributes
                    .OfType <IControllerModelConvention>()
                    .ToArray();

                foreach (var controllerConvention in controllerConventions)
                {
                    controllerConvention.Apply(controller);
                }

                foreach (var action in controller.Actions)
                {
                    // ToArray is needed here to prevent issues with modifying the attributes collection
                    // while iterating it.
                    var actionConventions =
                        action.Attributes
                        .OfType <IActionModelConvention>()
                        .ToArray();

                    foreach (var actionConvention in actionConventions)
                    {
                        actionConvention.Apply(action);
                    }

                    foreach (var parameter in action.Parameters)
                    {
                        // ToArray is needed here to prevent issues with modifying the attributes collection
                        // while iterating it.
                        var parameterConventions =
                            parameter.Attributes
                            .OfType <IParameterModelConvention>()
                            .ToArray();

                        foreach (var parameterConvention in parameterConventions)
                        {
                            parameterConvention.Apply(parameter);
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        private static Guid GetProductSystemIdFromSlug(string slug, GlobalModel globalModel, RoutingHelperService routingHelperService)
        {
            var systemId = Guid.Empty;
            var culture  = CultureInfo.GetCultureInfo(globalModel.CurrentUICulture);

            if (!routingHelperService.TryGetBaseProduct(slug, culture, out systemId))
            {
                routingHelperService.TryGetVariant(slug, culture, out systemId);
            }
            return(systemId);
        }
Esempio n. 23
0
 public void Apply(GlobalModel model)
 {
     foreach (var controller in model.Controllers)
     {
         if (controller.ApiExplorerIsVisible == null)
         {
             controller.ApiExplorerIsVisible = true;
             controller.ApiExplorerGroupName = controller.ControllerName;
         }
     }
 }
Esempio n. 24
0
        public void Run()
        {
            GetFplApiJson getFplApiJson = new GetFplApiJson();
            GlobalModel   fplPayload    = getFplApiJson.GetFplJson();

            HighestScoringPlayerTweet highestScoringPlayerTweet = new HighestScoringPlayerTweet();

            if (highestScoringPlayerTweet.CreateTweet(fplPayload))
            {
                Console.WriteLine("Tweet has fled the coop.");
            }
        }
Esempio n. 25
0
        public void SelectLevel(int index)
        {
            if (GlobalModel.Progress.GetCurrentChapter().Levels[index].IsLocked)
            {
                return;
            }

            GlobalModel.CurrentLevelIndex.Value = index;
            GlobalModel.Save();

            LoadDashboardScene();
        }
Esempio n. 26
0
        /// <summary>
        /// Retourne une réponse OK ou une réponse KO s'il y a une erreur de remontée par le Business
        /// </summary>
        /// <param name="model">Le model résultat du Business</param>
        /// <returns>une réponse OK ou une réponse KO</returns>
        protected IActionResult Result(GlobalModel model)
        {
            if (model.Erreur != null)
            {
                return(new ObjectResult(model.Erreur)
                {
                    StatusCode = (int)HttpStatusCode.InternalServerError
                });
            }

            return(Ok(model));
        }
Esempio n. 27
0
        private static PageModel GetPageFromSlug(string[] slug, GlobalModel globalModel, PageService pageService,
                                                 RoutingHelperService routingHelperService)
        {
            var culture   = CultureInfo.GetCultureInfo(globalModel.CurrentCulture);
            var startPage = pageService.GetChildPages(Guid.Empty, globalModel.WebsiteSystemId).FirstOrDefault();
            var pageId    = startPage.SystemId;

            foreach (var segment in slug)
            {
                routingHelperService.TryGetPage(pageId, segment, culture, out pageId, globalModel.WebsiteSystemId);
            }
            return(pageService.Get(pageId).MapTo <PageModel>());
        }
Esempio n. 28
0
        public async Task <IActionResult> Post([FromBody] GlobalModel model)
        {
            try
            {
                await _globalService.AddGlobal(model);

                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Esempio n. 29
0
        public async Task <IActionResult> Put([FromBody] GlobalModel model)
        {
            try
            {
                var result = await _globalService.UpdateGlobal(model);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
        public List <Player> GetPlayers(GlobalModel fplPayload)
        {
            List <Player> leedsPlayers = new List <Player>();

            foreach (var player in fplPayload.Players)
            {
                if (player.TeamCode == leedsTeamCode)
                {
                    leedsPlayers.Add(player);
                }
            }

            return(leedsPlayers);
        }
Esempio n. 31
0
 public Armlet CreateObject(byte armletId, GlobalModel model)
 {
     return new Armlet(armletId, model, GetName(armletId), GetRegen(armletId));
 }