public async Task<ActionResult> GetAll () { var model = new HomeViewModel(); model.Centers = db.Centers.ToList(); model.Tonalities = db.Tonalities.ToList(); model.HarmonicGroups = db.HarmonicGroups.ToList(); model.SocialStyles = db.SocialStyles.ToList(); model.Personalities = db.Personalities.ToList(); string userId = User.Identity.GetUserId(); var userReports = await ( from report in db.Reports where report.UserId == userId && report.Trashed == false orderby report.CreateDate descending select report ).ToListAsync(); model.Reports = userReports.Take(10).ToList(); model.TotalReports = userReports.Count(); model.TotalToday = userReports.Where(p=> DateTime.Today.Date <= p.CreateDate.Date).Count(); return Json(model, JsonRequestBehavior.AllowGet); }
public virtual ActionResult Index() { HomeViewModel model = new HomeViewModel(); this.PopulateModel(model); return View(model); }
public void TestTimer() { TestScheduler scheduler = new TestScheduler(); HomeViewModel vm = new HomeViewModel (null, scheduler); //vm.GetObservable() }
public ActionResult Index() { HomeViewModel vm = new HomeViewModel(); Meeting result = RavenSession.Query<Meeting>().OrderByDescending(x => x.MeetingDate).FirstOrDefault(); vm.NextMeeting = result; return View(vm); }
public MainPage() { this.InitializeComponent(); #if DEBUG Log.ClearLog(); #endif ViewModel = new HomeViewModel(); StartAuthentication(); }
// // GET: /Home/ public ActionResult Index() { var urlHelper = GetUrlHelper(); var viewModel = new HomeViewModel { SearchOptions = GetSearchOptions(), }; return View(viewModel); }
public LoadCustomers(HomeViewModel model) { if (!DesignerProperties.IsInDesignTool) { WebContext.Current.Authentication.LoggedIn += AuthenticationLoggedIn; WebContext.Current.Authentication.LoggedOut += AuthenticationLoggedOut; } this.model = model; }
private void App_OnStartup(object sender, StartupEventArgs e) { var viewModel = new HomeViewModel(); var window = new HomeWindow { DataContext = viewModel }; window.Show(); }
public UpdateSelectedCustomer(HomeViewModel viewModel) { if (!DesignerProperties.IsInDesignTool) { WebContext.Current.Authentication.LoggedIn += AuthenticationLoggedIn; WebContext.Current.Authentication.LoggedOut += AuthenticationLoggedOut; viewModel.PropertyChanged += ViewModelPropertyChanged; } this.viewModel = viewModel; }
public HomeViewModel GetViewModel() { var response = new HomeViewModel { Session = SessionAs<CustomUserSession>() }; if (response.Session.UserAuthId != null) { var userAuthId = int.Parse(response.Session.UserAuthId); response.UserAuths = Db.Select<UserAuth>(x => x.Id == userAuthId); response.UserAuthDetails = Db.Select<UserAuthDetails>(x => x.UserAuthId == userAuthId); } return response; }
public ActionResult Index() { TempData["Selected_Home"] = "selected"; HomeViewModel hvm = new HomeViewModel(); var surveys = _repository.GetApprovedSurveys(); hvm.ImageSurveys = surveys.Where(i => i.Image != null).ToList(); hvm.TextSurveys = surveys.Where(i => i.Image == null).ToList(); return View(hvm); }
public ActionResult Index() { service.ResetSession(); var model = new HomeViewModel() { PizzaGroups = service.GetPizzaGroups() }; return View(model); }
public async Task<ActionResult> Index () { var model = new HomeViewModel(); model.Centers = await db.Centers.ToListAsync(); model.Tonalities = await db.Tonalities.ToListAsync(); model.HarmonicGroups = await db.HarmonicGroups.ToListAsync(); model.SocialStyles = await db.SocialStyles.ToListAsync(); model.Personalities = await db.Personalities.ToListAsync(); return View(model); }
// GET: Admin/AdminHome public ActionResult Index() { HomeViewModel model = new HomeViewModel(); model.nextGigs = _gigRepository.List().Where(g => g.Date > DateTime.Now).OrderBy(g => g.Date).Take(3).ToList(); while (model.nextGigs.Count < 3) { model.nextGigs.Add(null); } return View(model); }
public ActionResult Index() { var model = new HomeViewModel(); model.TopEvents = this.eventsService.GetTop() .To<EventDetailsViewModel>() .ToList(); model.NewEvents = this.eventsService.GetNew() .To<EventDetailsViewModel>() .ToList(); return this.View(model); }
public RootViewModel(IFNewsService service, IMvxDeviceInfo deviceInfoPlugin):base(service,deviceInfoPlugin) { if (Settings.USE_RECENT_POSTS ){ Home = new RecentPostsViewModel(service, deviceInfoPlugin); ((RecentPostsViewModel)Home).Init(Settings.RECENT_POST_CATEGORY_ID, "Home"); } else { Home = new HomeViewModel(service, deviceInfoPlugin); } Menu = new MenuViewModel(); Service = service; Settings.RootViewModel = this; Mvx.Trace ("Init RootViewModel"); }
// GET: Default public ActionResult Index() { var model = new HomeViewModel(); model.Metadata.Title = "Translation service"; model.Metadata.Description = "Information on how to get Adult Social Care publications and web pages translated into other languages."; model.Metadata.DateCreated = "2004-08-06"; model.Metadata.DateIssued = "2004-08-06"; model.Metadata.Keywords = "Translation, interpreting, languages, language, publications, leaflet"; model.Metadata.IpsvPreferredTerms = "Health, well-being and care; Languages"; model.Metadata.LgslNumbers = "169"; model.ShowEastSussex1SpaceWidget = true; return View(model); }
public ActionResult HomeSearch(HomeViewModel model) { if (model != null && this.ModelState.IsValid) { model.PriceFrom = model.PriceFrom ?? 0; model.PriceTo = model.PriceTo ?? 0; var searchTextToLower = model.SearchText.ToLower(); var advertisements = this.advertisements .GetAll(); if (model.CategoryId == 1 && model.TownId == 1) { advertisements = advertisements .Where(a => (a.Title.ToLower().Contains(searchTextToLower) || a.Description.ToLower().Contains(searchTextToLower)) && (a.Price >= model.PriceFrom && ((model.PriceTo != 0) ? (a.Price <= model.PriceTo) : (a.Price <= decimal.MaxValue)))); } else if (model.CategoryId == 1) { advertisements = advertisements .Where(a => (a.Title.ToLower().Contains(searchTextToLower) || a.Description.ToLower().Contains(searchTextToLower)) && (a.TownId == model.TownId) && (a.Price >= model.PriceFrom && ((model.PriceTo != 0) ? (a.Price <= model.PriceTo) : (a.Price <= decimal.MaxValue)))); } else if (model.TownId == 1) { advertisements = advertisements .Where(a => (a.Title.ToLower().Contains(searchTextToLower) || a.Description.ToLower().Contains(searchTextToLower)) && (a.CategoryId == model.CategoryId) && (a.Price >= model.PriceFrom && ((model.PriceTo != 0) ? (a.Price <= model.PriceTo) : (a.Price <= decimal.MaxValue)))); } else { advertisements = advertisements .Where(a => (a.Title.ToLower().Contains(searchTextToLower) || a.Description.ToLower().Contains(searchTextToLower)) && (a.CategoryId == model.CategoryId) && (a.TownId == model.TownId) && (a.Price >= model.PriceFrom && ((model.PriceTo != 0) ? (a.Price <= model.PriceTo) : (a.Price <= decimal.MaxValue)))); } var viewModel = advertisements .To<AdvertisementViewModel>() .ToList(); return this.View(viewModel); } throw new HttpException(400, "Invalid search query"); }
public ActionResult Index() { var viewModel = new HomeViewModel { Packages = this.packages.GetAll().Count(), Issues = this.issues.GetAll().Count(), Users = this.users.GetAll().Count(), LatestPackages = this.packages.GetLatest(10).To<ListedLatestPackageViewModel>().ToList(), LatestIssues = this.issues.GetLatest(10).To<ListedLatestIssueViewModel>().ToList(), LatestComments = this.packages.GetLatestComments(10).To<ListedLatestCommentViewModel>().ToList(), LatestIssueReplies = this.issues.GetLatestReplies(10).To<ListedLatestIssueReplyViewModel>().ToList() }; return this.View(viewModel); }
private void App_OnStartup(object sender, StartupEventArgs e) { var window = new HomeWindow(); var viewModel = new HomeViewModel(); window.DataContext = viewModel; window.Show(); Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(AppDispatcherUnhandledException); if (HasRun() == false) { FirstRun(); } }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (viewModel != null) { viewModel.ScanComplete -= ScanComplete; } // Wire up the sections viewModel = (HomeViewModel)BindingContext; viewModel.ScanComplete += ScanComplete; root.Clear(); }
public HomeViewModel Execute() { var homeModel = new HomeViewModel() { Calls = new List<string>(), Outputs = new List<string>(), Filters = new List<string>() }; if (currentChain.Current != null) { ViewModelHelper.PopulateModelWithChain(currentChain.Current, homeModel); } return homeModel; }
public async Task<ActionResult> Index() { var vm = new HomeViewModel(); // Attempt to load meetup events try { await LoadUpcomingEvents(vm); } catch { vm.Error = "There was a problem retrieving events. Please visit our meetup."; } return View(vm); }
public HomeView() { this.pages = new Dictionary<MenuType, NavigationPage>(); BindingContext = new HomeViewModel(); Master = master = new HomeMasterView(ViewModel); var homeNav = new NavigationPage(master.PageSelection) { BarBackgroundColor = Color.FromHex("#D1C4E9"), BarTextColor = Color.White, }; Detail = homeNav; pages.Add(MenuType.Overview, homeNav); master.PageSelectionChanged = async (menuType) => { if (Detail != null && Device.OS == TargetPlatform.WinPhone) { await Detail.Navigation.PopToRootAsync(); } NavigationPage newPage; if (pages.ContainsKey(menuType)) { newPage = pages[menuType]; } else { newPage = new NavigationPage(master.PageSelection) { BarBackgroundColor = Color.FromHex("#D1C4E9"), BarTextColor = Color.White }; pages.Add(menuType, newPage); } Detail = newPage; //Detail.Title = master.PageSelection.Title; if (Device.Idiom != TargetIdiom.Tablet) IsPresented = false; }; this.Icon = "slideout.png"; }
/// <summary> /// Indexes this instance. /// </summary> /// <param name="currentPage">The current page.</param> /// <returns></returns> public ActionResult Index(Home currentPage) { var quotePage = currentPage.QuoteLink.Id != null ? _documentSession.Load<BaseModel>(currentPage.QuoteLink.Id) : null; var viewModel = new HomeViewModel { CurrentPage = currentPage, Pages = _structureInfo.Pages, QuotePage = quotePage, RootPage = _structureInfo.StartPage }; ViewBag.Class = "home"; return View(viewModel); }
/// <summary> /// Indexes this instance. /// </summary> /// <param name="currentPage">The current page.</param> /// <returns></returns> public ActionResult Index(Home currentPage) { var quotePage = currentPage.QuoteLink.Id != null ? _documentSession.Load<IPageModel>(currentPage.QuoteLink.Id) : null; var viewModel = new HomeViewModel { CurrentPage = currentPage, NavigationContext = _structureInfo.NavigationContext, QuotePage = quotePage }; ViewBag.Class = "home"; return View(viewModel); }
public HomeMasterView(HomeViewModel viewModel) { //this.Icon = "slideout.png"; BindingContext = viewModel; Title = "Prevoz"; var layout = new StackLayout { Spacing = 5 }; layout.Padding = 5; var label = new ContentView { Padding = new Thickness(10, 5, 0, 5), BackgroundColor = Color.Transparent, Content = new Label { Text = "Prevoz", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) } }; layout.Children.Add(label); layout.Children.Add(new BoxView() { HeightRequest = 1, Color = Color.FromHex("#3498DB") }); foreach (var item in viewModel.MenuItems) { var menuItem = new Label() { Text = item.Title, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; var labelTap = new TapGestureRecognizer(); labelTap.Command = new Command(() => { PageSelection = item.GetPage(); }); menuItem.GestureRecognizers.Add(labelTap); layout.Children.Add(menuItem); } PageSelection = viewModel.MenuItems[0].GetPage(); Content = layout; }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { Resources.MergedDictionaries.Add(new DeviceResources()); var rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { rootFrame = new Frame(); rootFrame.Navigated += OnNavigated; // Place the frame in the current Window OnInitializeRunner(); Initialized = true; RunnerOptions.Current.TerminateAfterExecution = TerminateAfterExecution; RunnerOptions.Current.AutoStart = AutoStart; var nav = new Navigator(rootFrame); var runner = new DeviceRunner(testAssemblies, nav, new ResultListener(Writer)); var hvm = new HomeViewModel(nav, runner); nav.NavigateTo(NavigationPage.Home, hvm); Window.Current.Content = rootFrame; } // Ensure the current window is active Window.Current.Activate(); // Hook up the default Back handler SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) => { if (rootFrame.CanGoBack) { args.Handled = true; rootFrame.GoBack(); } }; }
public IActionResult Index() { var confId = (int)HttpContext.Items[SiteConstants.CurrentConferenceKey]; var conference = _conferenceRepository .GetById(confId); if(conference == null) { throw new Exception("No conference found"); } var viewmodel = new HomeViewModel() { ConferenceName = conference.Name, StartDate = conference.ConferenceStart }; return View(viewmodel); }
/// <summary> /// Grabs upcoming events form Meetup to display /// </summary> /// <param name="vm">The ViewModel to load the events into</param> /// <returns>Async Task</returns> private async Task LoadUpcomingEvents(HomeViewModel vm) { // Grab upcoming meetups using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://api.meetup.com/"); var response = await client.GetAsync("2/events?key=3514476181f3663732595436e1347&sign=true&group_id=4338572&status=upcoming"); if (response.IsSuccessStatusCode) { // Use a dynamic json object to get return values from var events = new List<Event>(); dynamic json = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); // Add each event from meetup foreach (var result in json.results) { // Get :: out of event name string title = result.name; if (title.Contains("::")) title = title.Split(new[] {"::"}, StringSplitOptions.None)[1].Trim(); // Convert from epoc time using milliseconds sent from API var utcDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds((double) result.time); var time = TimeZoneInfo.ConvertTimeFromUtc(utcDateTime, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")); events.Add(new Event() { Title = title, DateTime = time, Link = string.Format("http://www.meetup.com/Hampton-Roads-NET-Users-Group/events/{0}/", result.id) }); } vm.Events = events; } } }
public ActionResult Search(string id) { HomeViewModel homeviewmodel = new HomeViewModel() { ProjectItem = new ProjectListViewModel() { ProjectItems = new List <ProjectViewModel>() }, CarCarPlanItem = new CarCarPlanListViewModel() { CarCarPlanItems = new List <CarCarPlanViewModel>() } }; var resultCardProjectName = _homeService.GetSearchProjectName(id); var resultCardCategory = _homeService.GetSearchCategory(id); var resultCardCreatorName = _homeService.GetSearchCreatorName(id); var resultCardProjectDescription = _homeService.GetSearchProjectDescription(id); var resultCardProjectQuestion = _homeService.GetSearchProjectQuestion(id); var resultCardProjectAnswer = _homeService.GetSearchProjectAnswer(id); var resultCardPlanTitle = _homeService.GetSearchPlanTitle(id); var resultCardPlanDescription = _homeService.GetSearchPlanDescription(id); var resultCardPlanPrice = _homeService.GetSearchPlanPrice(id); foreach (var item in resultCardProjectName.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardCategory.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardCreatorName.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardProjectDescription.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardProjectQuestion.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardProjectAnswer.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } foreach (var item in resultCardPlanPrice.ProjectItem.ProjectItems) { homeviewmodel.ProjectItem.ProjectItems.Add(item); } //foreach (var item in resultCardPlanDescription.CarCarPlanItem.CarCarPlanItems) //{ // homeviewmodel.CarCarPlanItem.CarCarPlanItems.Add(item); //} var result = homeviewmodel.ProjectItem.ProjectItems.GroupBy(x => x.ProjectName).Select(y => y.First()); //homeviewmodel.ProjectItem.ProjectItems.Count(); //homeviewmodel.CarCarPlanItem.CarCarPlanItems.GroupBy(x => x.ProjectName).Select(y => y.First()).ToList(); return(View(result)); }
public MenuView() { InitializeComponent(); BindingContext = HomeViewModel.GetInstance(); }
public ActionResult Index() { HomeViewModel model = new HomeViewModel(); return(View()); }
public async Task <HomeViewModel> GetCatalogItems(HomeViewModel model, bool isPost) { if (model == null) { throw new ArgumentNullException(nameof(model)); } //Set user model.User = await _userRepository.GetByIdAsync(Thread.CurrentPrincipal.Identity.Name); var shops = await _shopSignRepository.ListAllAsync(); List <SelectListItem> shopItems = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (ShopSign shop in shops) { shopItems.Add(new SelectListItem() { Text = shop.Name, Value = shop.Id }); } model.ShopSigns = shopItems; var cache = await _articleRepository.ListAllAsync(); IEnumerable <Article> articles = new List <Article>(); if (isPost) { IEnumerable <PriceList> prices = await _articlePriceRepository.ListAsync(new { model.ShopSignId, model.User.Rate }); var ap = cache.Join( prices, a => a.Id, p => p.ArticleId, (a, p) => new { Article = a, PriceList = p }) .Where(f => (f.Article.IsKasanova == (model.ShopSignId == "K" ? true : false) || f.Article.IsKasanovaPiu == (model.ShopSignId == "K+" ? true : false) || (f.Article.IsCoimport == (model.ShopSignId == "COI" ? true : false)) || (f.Article.IsOutlet == (model.ShopSignId == "ODK" ? true : false)) || (f.Article.IsItalianFactory == (model.ShopSignId == "IT" ? true : false)) || (f.Article.IsCasaSullAlbero == (model.ShopSignId == "CSA" ? true : false))) && (string.IsNullOrEmpty(model.CategoryId) || f.Article.Category == model.CategoryId) && (string.IsNullOrEmpty(model.FamilyId) || f.Article.Family == model.FamilyId) && (string.IsNullOrEmpty(model.SeriesId) || f.Article.Series == model.SeriesId) && (string.IsNullOrEmpty(model.Level1Id) || f.Article.Level1 == model.Level1Id) && (string.IsNullOrEmpty(model.Level2Id) || f.Article.Level1 == model.Level2Id) && (model.WebEnabledId == "10" || f.Article.IsMagentoEnabled == (model.WebEnabledId == "20" ? true : false)) && (model.VideoAvailableId == "10" || f.Article.HasVideo == (model.VideoAvailableId == "20" ? true : false)) && (model.MandatoryDeliveryId == "10" || f.PriceList.IsMandatoryPickup == (model.VideoAvailableId == "20" ? true : false)) //&& (model.WareHouseNameId == "10" || f.wa == (model.WareHouseNameId == "20" ? true : false)) && (model.DirectDeliveryId == "10" || f.PriceList.IsDirectDelivery == (model.DirectDeliveryId == "20" ? true : false)) && (model.ChalcoId == "10" || f.Article.HasChalcoData == (model.ChalcoId == "20" ? true : false)) && (model.PhotoId == "10" || f.Article.HasPhoto == (model.PhotoId == "20" ? true : false)) && (string.IsNullOrEmpty(model.StyleId) || model.StyleId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList().Contains(f.Article.Style)) //&& (string.IsNullOrEmpty(model.StockGroupId) || f.StockGroups.Where(s => s.StockGroupId) ) ) .ToList(); ap.ForEach(f => model.Articles.Add( new ArticleLightViewModel() { Book = f.Article.Book, HasPhotoInChalco = f.Article.HasChalcoData, Description = f.Article.Description, Depth = f.Article.Depth, GrossRetailPrice = f.PriceList.GrossRetailPrice, Height = f.Article.Height, Id = f.Article.Id, IsDirectDelivery = f.PriceList.IsDirectDelivery, IsPrivateLabel = f.PriceList.IsPrivateLabel, IsMandatoryPickup = f.PriceList.IsMandatoryPickup, Line = f.Article.Line, Materials = f.Article.Materials, NameAlias = f.Article.NameAlias, NetRetailPrice = f.PriceList.NetRetailPrice, GrossSalesPrice = f.PriceList.GrossSalesPrice, RetailDiscountPercentage = f.PriceList.RetailDiscountPercentage, Weight = f.Article.Weight, Width = f.Article.Width, Youtube = f.Article.Youtube, Tag = f.PriceList.Tag, StockQuantity = f.Article.StockQuantity, VendorStockQuantity = f.Article.VendorStockQuantity })); articles = ap.Select(f => f.Article).ToList(); } else { IEnumerable <PriceList> prices = await _articlePriceRepository.ListAsync(new { model.ShopSignId, model.User.Rate }); articles = cache.Join( prices, a => a.Id, p => p.ArticleId, (a, p) => a); articles = cache; } //Categoria var categories = cache.Select(f => f.Category).Distinct() .OrderBy(f => f); //TODO add condition for filter shop sign List <SelectListItem> items = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (string category in categories) { items.Add(new SelectListItem() { Text = category, Value = category }); } model.Categories = items; SetSelectedValue(items, model.CategoryId); PrepareListItems(model, articles); //Style filter (DevExpress List) var styles = articles.Select(f => f.Style) .OrderBy(f => f) .Distinct() .ToList(); model.StyleItems = styles; //SetSelectedValue(model.StyleItems, model.StyleId); //StockGroups filter (DevExpress List) var stockGroups = articles.SelectMany(f => f.StockGroups) .OrderBy(f => f.StockGroupId) .Select(f => f.StockGroupId) .Distinct(); model.StockGroupItems = stockGroups.ToList(); //SetSelectedValue(model.StockGroupItems, model.StockGroupId); //SupplyStatus filter (DevExpress List) IEnumerable <string> supplyStatus = articles.SelectMany(f => f.StockGroups) .OrderBy(f => f.LastSupplyStatusId) .Select(s => s.LastSupplyStatusId) .Distinct(); model.SupplyStatusItems = supplyStatus.ToList(); //SetSelectedValue(model.SupplyStatusItems, model.SupplyStatusId); //Tag commerciale filter (DevExpress List) List <string> tags = model.Articles.Select(f => f.Tag) .OrderBy(f => f) .Distinct() .ToList(); model.TagItems = tags; return(model); }
public Home() { InitializeComponent(); ViewModel = new HomeViewModel(MyArtworkPivotItem.ViewModel); }
public Home() { InitializeComponent(); BindingContext = new HomeViewModel(Navigation); ListeLieux.ItemTapped += ListeLieux_ItemTapped; }
public VacationsAdapter(RecyclerView recyclerView, HomeViewModel itemsContext) : base(recyclerView) { ItemsContext = itemsContext; }
public ActionResult Lista(HomeViewModel model) { double MaxLat = -85; double MinLat = 85; double MaxLong = -180; double MinLong = 180; double M; int Z = 0; var selectedKategorie = model.Kategorie1.Where(x => x.Checked).Select(x => x.Id).ToList(); selectedKategorie.AddRange(model.Kategorie2.Where(x => x.Checked).Select(x => x.Id).ToList()); selectedKategorie.AddRange(model.Kategorie3.Where(x => x.Checked).Select(x => x.Id).ToList()); selectedKategorie.AddRange(model.Kategorie4.Where(x => x.Checked).Select(x => x.Id).ToList()); var lokale = db.Lokale.Where(x => x.LokalKategoria.Any(b => selectedKategorie.Contains(b.KategoriaId))).ToList(); List <LokaleListViewModel> vm = new List <LokaleListViewModel>(); if (model.Latitude != null & model.Longitude != null) { double Lat = Double.Parse(model.Latitude, System.Globalization.CultureInfo.InvariantCulture); double Long = Double.Parse(model.Longitude, System.Globalization.CultureInfo.InvariantCulture); var location = new Location(Lat, Long); lokale = lokale.Where(a => !a.Ukryty).OrderBy(x => new Location(Double.Parse(x.Lat, System.Globalization.CultureInfo.InvariantCulture), Double.Parse(x.Long, System.Globalization.CultureInfo.InvariantCulture)).GetDistance(location)).ToList(); foreach (Lokal lokal in lokale) { double Y = Double.Parse(lokal.Lat, System.Globalization.CultureInfo.InvariantCulture); double X = Double.Parse(lokal.Long, System.Globalization.CultureInfo.InvariantCulture); vm.Add(new LokaleListViewModel( lokal, Math.Round((new Location(Y, X).GetDistance(location)) / 1000, 2) )); if (Y > MaxLat) { MaxLat = Y; } if (Y < MinLat) { MinLat = Y; } if (X > MaxLong) { MaxLong = X; } if (X < MinLong) { MinLong = X; } } if (Lat > MaxLat) { MaxLat = Lat; } if (Lat < MinLat) { MinLat = Lat; } if (Long > MaxLong) { MaxLong = Long; } if (Long < MinLong) { MinLong = Long; } } else { foreach (Lokal lokal in lokale) { double Y = Double.Parse(lokal.Lat, System.Globalization.CultureInfo.InvariantCulture); double X = Double.Parse(lokal.Long, System.Globalization.CultureInfo.InvariantCulture); vm.Add(new LokaleListViewModel(lokal)); if (Y > MaxLat) { MaxLat = Y; } if (Y < MinLat) { MinLat = Y; } if (X > MaxLong) { MaxLong = X; } if (X < MinLong) { MinLong = X; } } } if ((MaxLat - MinLat) > (MaxLong - MinLong)) { M = MaxLat - MinLat; } else { M = MaxLong - MinLong; } if (M >= 0 && M <= 0.0037) { Z = 17; } else if (M > 0.0037 && M <= 0.0070) { Z = 16; } else if (M > 0.0070 && M <= 0.0130) { Z = 15; } else if (M > 0.0130 && M <= 0.0290) { Z = 14; } else if (M > 0.0290 && M <= 0.0550) { Z = 13; } else if (M > 0.0550 && M <= 0.1200) { Z = 12; } else if (M > 0.1200 && M <= 0.4640) { Z = 10; } else if (M > 0.4640 && M <= 1.8580) { Z = 8; } else if (M > 1.8580 && M <= 3.5310) { Z = 7; } else if (M > 3.5310 && M <= 7.3367) { Z = 6; } else if (M > 7.3367 && M <= 14.222) { Z = 5; } else if (M > 14.222 && M <= 28.000) { Z = 4; } else if (M > 28.000 && M <= 58.000) { Z = 3; } else { Z = 1; } var result = new SzukajViewModel(); result.LokaleList = vm; result.MyLat = model.Latitude; result.MyLong = model.Longitude; result.Zoom = Z; result.CenterLat = Math.Round(((MinLat + MaxLat) / 2), 4).ToString("F").Replace(",", "."); result.CenterLong = Math.Round(((MinLong + MaxLong) / 2), 4).ToString("F").Replace(",", "."); return(View(result)); }
public async Task <IActionResult> Enrol(HomeViewModel homeViewModel, string courseId) { await _thirdPartyService.Enrol(homeViewModel.StudentId, courseId); return(RedirectToAction("Index")); }
public IActionResult Index() { var viewModel = new HomeViewModel(); return(View(viewModel)); }
public HomePrincipalView() { InitializeComponent(); BindingContext = HomeViewModel.GetInstance(true); }
public MenuView() { InitializeComponent(); BindingContext = new HomeViewModel(); }
public ActionResult Index() { var vm = new HomeViewModel(); return(View(vm)); }
private void PrepareListItems(HomeViewModel model, IEnumerable <Article> articles) { //Famiglia IEnumerable <string> families = null; if (string.IsNullOrEmpty(model.CategoryId)) { families = articles.Select(f => f.Family) .OrderBy(f => f) .Distinct(); } else { families = articles.Where(f => f.Category == model.CategoryId) .Select(f => f.Family) .OrderBy(f => f) .Distinct(); } var items = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (string family in families) { items.Add(new SelectListItem() { Text = family, Value = family }); } model.Families = items; SetSelectedValue(model.Families, model.FamilyId); //Serie IEnumerable <string> series = new List <string>(); if (string.IsNullOrEmpty(model.CategoryId) && string.IsNullOrEmpty(model.FamilyId)) { series = articles.Select(f => f.Series) .OrderBy(f => f) .Distinct(); } else { series = articles.Where(f => f.Category == model.CategoryId && f.Family == model.FamilyId) .Select(f => f.Series) .OrderBy(f => f) .Distinct(); } items = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (string serie in series) { items.Add(new SelectListItem() { Text = serie, Value = serie }); } model.Series = items; SetSelectedValue(model.Series, model.SeriesId); //Livello1 var level1s = articles.Select(f => f.Level1).Distinct() .OrderBy(f => f); items = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (string level1 in level1s) { items.Add(new SelectListItem() { Text = level1, Value = level1 }); } model.Level1s = items; SetSelectedValue(model.Level1s, model.Level1Id); //Livello2 var level2s = articles.Select(f => f.Level2).Distinct() .OrderBy(f => f); items = new List <SelectListItem>() { new SelectListItem() { Value = string.Empty, Text = "--", Selected = true } }; foreach (string level2 in level2s) { items.Add(new SelectListItem() { Text = level2, Value = level2 }); } model.Level2s = items; SetSelectedValue(model.Level2s, model.Level2Id); //Disponiblità web filter model.WebEnabledItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Abilitati" }, new SelectListItem() { Value = "30", Text = "Disabilitati" }, }; SetSelectedValue(model.WebEnabledItems, model.WebEnabledId); //Youtube filter model.VideoAvailableItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Solo Youtube video" }, new SelectListItem() { Value = "30", Text = "Senza Youtube video" }, }; SetSelectedValue(model.VideoAvailableItems, model.VideoAvailableId); //Magazzino filter model.WareHouseItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Kasanova" }, new SelectListItem() { Value = "30", Text = "Mastercasa" }, new SelectListItem() { Value = "40", Text = "Baimex" } }; SetSelectedValue(model.WareHouseItems, model.WareHouseNameId); //Chalco filter model.ChalcoItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "In Chalco" }, new SelectListItem() { Value = "30", Text = "Non in Chalco" }, }; SetSelectedValue(model.ChalcoItems, model.ChalcoId); //Foto filter model.PhotoItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Solo con foto" }, new SelectListItem() { Value = "30", Text = "Senza foto" }, }; SetSelectedValue(model.PhotoItems, model.PhotoId); //Colore filter model.ColorItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "COL" }, new SelectListItem() { Value = "30", Text = "NOCOL" }, }; SetSelectedValue(model.ColorItems, model.ColorId); //Ritiro Obbligatorio Filter model.MandatoryDeliveryItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Ritiro obbligatorio" }, new SelectListItem() { Value = "30", Text = "No ritiro obbligatorio" }, }; SetSelectedValue(model.MandatoryDeliveryItems, model.MandatoryDeliveryId); //Consegna diretta Items model.DirectDeliveryItems = new List <SelectListItem>() { new SelectListItem() { Value = "10", Text = "Tutti", Selected = true }, new SelectListItem() { Value = "20", Text = "Solo consegna diretta" }, new SelectListItem() { Value = "30", Text = "No consegna diretta" }, }; SetSelectedValue(model.DirectDeliveryItems, model.DirectDeliveryId); }
/// <summary> /// Initializes a new instance of the <see cref="InstanceLocator" /> class. /// </summary> public InstanceLocator() { Media = new MediaViewModel(); Home = new HomeViewModel(); Profile = new ProfileViewModel(); }
public IActionResult Index(HomeViewModel viewModel) { var siteCollection = new SiteCollection { FantasySites = new List <FantasySite> { new FantasySite { PageUrl = viewModel.SiteUrl1, PageParseParams = new PageParseParams { TableXPath = viewModel.TableXPath1, NameCellParams = new CellParseParams { CellXPath = viewModel.NameCellXPath1, IndexPosition = viewModel.NameIndexPosition1, SplitOnValue = viewModel.NameSplitOnValue1 }, RankCellParams = new CellParseParams { CellXPath = viewModel.RankCellXPath1, IndexPosition = viewModel.RankIndexPosition1, SplitOnValue = viewModel.RankSplitOnValue1 }, PositionCellParams = new CellParseParams { CellXPath = viewModel.PositionCellXPath1, IndexPosition = viewModel.PositionIndexPosition1, SplitOnValue = viewModel.PositionSplitOnValue1 } } }, new FantasySite { PageUrl = viewModel.SiteUrl2, PageParseParams = new PageParseParams { TableXPath = viewModel.TableXPath2, NameCellParams = new CellParseParams { CellXPath = viewModel.NameCellXPath2, IndexPosition = viewModel.NameIndexPosition2, SplitOnValue = viewModel.NameSplitOnValue2 }, RankCellParams = new CellParseParams { CellXPath = viewModel.RankCellXPath2, IndexPosition = viewModel.RankIndexPosition2, SplitOnValue = viewModel.RankSplitOnValue2 }, PositionCellParams = new CellParseParams { CellXPath = viewModel.PositionCellXPath2, IndexPosition = viewModel.PositionIndexPosition2, SplitOnValue = viewModel.PositionSplitOnValue2 } } } } }; viewModel.PlayerAggregates = this.siteCollectionProcessor.Process(siteCollection); return(View(viewModel)); }
public JsonResult GetDependentUIs(HomeViewModel home) { home.dependentUIs = homeRepo.DependentUIs.Select(x => DependentUIViewModel.MapDependentUIToDependentUIViewModel(x)).ToList(); return(Json(home.dependentUIs)); }
public ActionResult Home() { HomeViewModel viewModel = new HomeViewModel(); return(View(viewModel)); }
public ActionResult Index() { DatabaseEntities db = new DatabaseEntities(); return(View(HomeViewModel.GetIndex(db))); }
public ActionResult Index() { HomeViewModel hm = new HomeViewModel(); return(View(hm)); }
public Home() { InitializeComponent(); BindingContext = new HomeViewModel(Navigation); }
public HomePage() { Title = "Home"; this.BindingContext = viewModel = new HomeViewModel(); NavigationPage.SetHasNavigationBar(this, true); var refresh = new ToolbarItem { Command = viewModel.LoadConferencesCommand, Icon = "refresh.png", Name = "refresh", Priority = 0 }; ToolbarItems.Add(refresh); var masterText = new Label { Text = "Select a conference:", Font = Font.SystemFontOfSize(NamedSize.Medium) }; masterPicker = new Picker(); masterPicker.SelectedIndexChanged += (sender, e) => { if (masterPicker.SelectedIndex == -1) { return; } conferencePicker.Items.Clear(); var selected = viewModel.MasterConferences[masterPicker.SelectedIndex]; foreach (var item in selected.Conferences) { conferencePicker.Items.Add(item.Name); } Settings.MasterConference = viewModel.MasterConferences[masterPicker.SelectedIndex].MasterConferenceId; var conference = selected.Conferences.FirstOrDefault(c => c.ConferenceId == Settings.Conference); if (conference != null) { conferencePicker.SelectedIndex = selected.Conferences.IndexOf(conference); } }; var conferenceText = new Label { Text = "Select conference date:", Font = Font.SystemFontOfSize(NamedSize.Medium) }; conferencePicker = new Picker(); conferencePicker.SelectedIndexChanged += (sender, e) => { if (conferencePicker.SelectedIndex == -1) { return; } Settings.Conference = viewModel.MasterConferences[masterPicker.SelectedIndex].Conferences[conferencePicker.SelectedIndex].ConferenceId; }; var activityIndicator = new ActivityIndicator(); activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); Content = new StackLayout { Spacing = 10, Padding = 10, VerticalOptions = LayoutOptions.FillAndExpand, Children = { activityIndicator, masterText, masterPicker, conferenceText, conferencePicker } }; }
public async Task <HomeViewModel> GetCatalogItems() { HomeViewModel model = new HomeViewModel(); return(await GetCatalogItems(model, false)); }
public async Task <IActionResult> Index() { SessionUser sessionUser = new SessionUser { UserName = User.Identity.Name, IsAdmin = User.IsInRole(AppConst.UserRole.Admin), IsGeneral = User.IsInRole(AppConst.UserRole.General), IsHelp = User.IsInRole(AppConst.UserRole.Help), IsPrivate = User.IsInRole(AppConst.UserRole.Private), IsEducation = User.IsInRole(AppConst.UserRole.Education), IsCreate = User.IsInRole(AppConst.UserRole.Create), IsDelete = User.IsInRole(AppConst.UserRole.Delete), IsReader = User.IsInRole(AppConst.UserRole.Reader) }; if (sessionUser.IsAdmin) { sessionUser.IsGeneral = sessionUser.IsHelp = sessionUser.IsPrivate = sessionUser.IsEducation = sessionUser.IsCreate = sessionUser.IsDelete = sessionUser.IsReader = true; } else if (sessionUser.IsCreate) { sessionUser.IsGeneral = sessionUser.IsHelp = sessionUser.IsPrivate = sessionUser.IsEducation = sessionUser.IsReader = true; } HttpContextAccessor.HttpContext.Session.SetObject(AppConst.UserSessionName, sessionUser); List <HomeReporBoxModel> reportBoxs = new List <HomeReporBoxModel>(); long totalPersonalCount = await _personalService.Count(x => !x.IsDelete); reportBoxs.Add(new HomeReporBoxModel { Count = totalPersonalCount, Title = "Toplam Yabancı Sayısı", SubTitle = "Yabancı Sayısı Yüzde", Icon = "icon-user", Progress = 100 }); //Okuyor Id 3 long egitimGorenCount = await _personalService.Count(x => !x.IsDelete && x.EgitimDurumu.EgitimDurumuId == 3); reportBoxs.Add(new HomeReporBoxModel { Count = egitimGorenCount, Progress = totalPersonalCount == 0 ? 0 : (100 * egitimGorenCount) / totalPersonalCount, Title = "Eğitim Gören", SubTitle = "Eğitim Gören Yüzde", Icon = "icon-user" }); long kacakCount = await _personalService.Count(x => !x.IsDelete && (x.IkametDurumu.IkametDurumuId == 4 || x.IkametDurumu.IkametDurumuId == 5)); reportBoxs.Add(new HomeReporBoxModel { Count = kacakCount, Progress = totalPersonalCount == 0 ? 0 : (100 * kacakCount) / totalPersonalCount, Title = "Kaçak Sayısı", SubTitle = "Kaçak Sayısı Yüzde", Icon = "icon-info" }); var model = new HomeViewModel { ReporBoxModels = reportBoxs }; return(View(model)); }
public HomePage() { InitializeComponent(); BindingContext = new HomeViewModel(); }
public ActionResult Index() { var viewModel = new HomeViewModel(AppStatistics.ReadStatisticsForHomePage()); return(View(viewModel)); }
public HomeView() { InitializeComponent(); DataContext = new HomeViewModel(); }
public async Task <ActionResult> Index(HomeViewModel model) { Json311 json = new Json311(); ActionResult actionResult = null; if (model.StartDate.HasValue) { model.rowHandler = new RowHandler() { Curr_min = model.CurrentFloor, Curr_max = model.CurrentCeil, total = model.CurrentMax }; try { DateTime?start, end; start = model.StartDate; if (model.EndDate.HasValue) { end = model.EndDate.Value; } else { end = DateTime.Now; } int offset = 0; if (model.NextSet) { offset = model.CurrentCeil; } else if (model.PreviousSet) { if ((offset - 500) < 0) { offset = 0; } else { offset -= 500; } } if (offset > model.CurrentMax) { offset = 0; } model.JsonData = json.GetDateFilteredList(500, offset, start.Value, end.Value); model.CurrentFloor = offset; model.StartDate = start; model.EndDate = end; model.CurrentCeil = model.CurrentFloor + model.JsonData.Count(); model.CurrentMax = json.GetCount(start.Value, end.Value); actionResult = View(model); } catch (Exception ex) { } } else { model.JsonData = json.GetFullDataset(0, 500); model.CurrentFloor = 0; model.CurrentCeil = model.JsonData.Count(); model.CurrentMax = json.GetCount(); model.ChangeUp = 500; model.ChangeDown = -500; model.ActiveSearch = false; actionResult = View(model); } return(await Task.FromResult(actionResult)); }
public IActionResult Index(HomeViewModel viewModel) { return(View(viewModel)); }
public HomeViewModelTests() { homeViewModel = new HomeViewModel(); }