예제 #1
0
        public ActionResult Index()
        {
            var id = User.Identity.GetHouseholdId();

            //Household householdId = db.Households.Find(id);


            if (id == null)
            {
                return(HttpNotFound());
            }
            //return View(household);

            var userId = User.Identity.GetUserId();
            //var acctIdByHouseId = db.Users.Find(id)/*.Accounts.ToList()*/;

            var houseAccounts = db.PersonalAccounts.Where(p => p.CreatedById == userId || p.HouseholdId == id).ToList();
            //var houseTransactions = db.Transactions.Where(t => t.AccountId == acctIdByHouseId).ToList();
            var userPersonalAccounts = db.PersonalAccounts.Where(p => p.CreatedById == userId).ToList();
            var userTransactions     = db.Transactions.Where(t => t.EnteredById == userId).ToList();



            DashViewModel model = new DashViewModel()
            {
                PersonalAccounts = userPersonalAccounts,
                Transactions     = userTransactions,
                HouseAccounts    = houseAccounts,
                //HouseTransactions = acctIdByHouseId,
                //Households = householdName
            };


            return(View(model));
        }
예제 #2
0
        [Route("Admin/Dashboard")] // GET: Admin/Dashboard
        public async Task <IActionResult> Index()
        {
            var model = new DashViewModel(db);
            await model.Init();

            return(View(model));
        }
예제 #3
0
        public IActionResult AddWedding(Wedding newWedding)
        {
            if (HttpContext.Session.GetInt32("User") == null)
            {
                ViewBag.ses = "Must be logged in";
                return(View("Index"));
            }
            if (newWedding.Date < DateTime.Now)
            {
                ViewBag.DATE = "Must have a wedding in the future";
                ViewBag.ID   = HttpContext.Session.GetInt32("User");
                return(View("addnewweddingview"));
            }

            dbContext.Add(newWedding);
            dbContext.SaveChanges();
            List <Wedding> AllWeds = dbContext.Wedding
                                     .Include(g => g.Guest)
                                     .ThenInclude(u => u.User)
                                     .ToList();
            DashViewModel newModel = new DashViewModel();

            newModel.AllWeddings = AllWeds;
            return(RedirectToAction("success"));
        }
예제 #4
0
 public MainWindow()
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     InitializeList();
     HttpService.InitializeClient();
     DataContext = new DashViewModel(sensors);
 }
예제 #5
0
 public App()
 {
     dashViewModel = new DashViewModel();
     Task.Run(async() => await dashViewModel.ExecuteLoadZonesCommand());
     DependencyService.Register <RfidApi>();
     DependencyService.Register <UserApi>();
     DependencyService.Register <ZoneApi>();
     InitializeComponent();
     MainPage = new AppShell();
 }
예제 #6
0
        public ApiModule(TelemetryLapManagerFactory managerFactory) : base("/api")
        {
            _telemetryLapManager = managerFactory.GetManager();

            Get["/packet"] = parameters =>
            {
                var speedDelta = _telemetryLapManager.GetSpeedDelta();
                var timeDelta  = _telemetryLapManager.GetTimeDelta();

                if (speedDelta == "--")
                {
                    speedDelta = "+0";
                }

                var speedPositive = speedDelta.Substring(0, 1) == "+";
                var timePositive  = timeDelta > 0;

                var speedAbs = speedDelta.Substring(1);

                var model = new DashViewModel
                {
                    CircuitName          = _telemetryLapManager.Circuit.Name,
                    LapType              = _telemetryLapManager.LapType ?? "",
                    SpeedDelta           = float.Parse(speedAbs),
                    TimeDelta            = timeDelta,
                    IsSpeedDeltaPositive = speedPositive,
                    IsTimeDeltaPositive  = timePositive,
                    WheelspinRearLeft    = _telemetryLapManager.CurrentWheelSpin(WheelspinWheel.RearLeft),
                    WheelspinRearRight   = _telemetryLapManager.CurrentWheelSpin(WheelspinWheel.RearRight),
                    WheelspinFrontLeft   = _telemetryLapManager.CurrentWheelSpin(WheelspinWheel.FrontLeft),
                    WheelspinFrontRight  = _telemetryLapManager.CurrentWheelSpin(WheelspinWheel.FrontRight),
                    Throttle             = _telemetryLapManager.CurrentThrottle,
                    Brake      = _telemetryLapManager.CurrentBrake,
                    CurrentLap = _telemetryLapManager.CurrentLapTime,
                    LastLap    = _telemetryLapManager.LastLapTime,
                    Sector1    = new SectorTimeViewModel(_telemetryLapManager.Sector1),
                    Sector2    = new SectorTimeViewModel(_telemetryLapManager.Sector2),
                    Sector3    = new SectorTimeViewModel(_telemetryLapManager.Sector3)
                };

                if (_telemetryLapManager.FastestLap == null)
                {
                    model.FastestLap = 0f.AsTimeString();
                }
                else
                {
                    model.FastestLap = _telemetryLapManager.FastestLap.LapTime.AsTimeString();
                }

                return(Response.AsJson(model));
            };
        }
예제 #7
0
 public IActionResult Dash()
 {
     if (HttpContext.Session.GetInt32("logged_user") == null)
     {
         return(Redirect("/"));
     }
     else
     {
         List <Post>   posts = dbcontext.Posts.Include(a => a.User).ToList();
         Post          p     = new Post();
         User          u     = dbcontext.Users.FirstOrDefault(f => f.UserId == HttpContext.Session.GetInt32("logged_user"));
         DashViewModel m     = new DashViewModel {
             user  = u,
             post  = p,
             posts = posts
         };
         return(View(m));
     }
 }
예제 #8
0
 public DashPage()
 {
     InitializeComponent();
     this.BindingContext = _viewModel = new DashViewModel();
     Title = "Mapa";
     MessagingCenter.Subscribe <DashPage>(this, "ErroAoBuscar", (sender) =>
     {
         Device.BeginInvokeOnMainThread(async() =>
         {
             await DisplayAlert("Deu ruim", "Erro ao buscar os agvs", "OK");
         });
     });
     MessagingCenter.Subscribe <DashPage>(this, "Reload", (sender) =>
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             OnAppearing();
         });
     });
 }
예제 #9
0
 private void BtnToMain_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     MenuToggleButton.IsChecked = false;
     DataContext = new DashViewModel(sensors);
 }
예제 #10
0
        private void RadTileList_AutoGeneratingTile(object sender, Telerik.Windows.Controls.AutoGeneratingTileEventArgs e)
        {
            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(() =>
                                                                                                  DashViewModel.AutoGenerateTile(e)
                                                                                                  ));

            //DashViewModel.AutoGenerateTile(e);
        }