Exemplo n.º 1
0
        public IActionResult Index()
        {
            var date   = DateTime.Now;
            var userId = GetCurrentUserId();


            // needed to mark day squares with events
            var events = context.Events
                         .Where(a => a.Date.Month == DateTime.Now.Month && a.User.Id == userId)
                         .Select(a => new Event {
                Date = a.Date
            })
                         .ToList();

            var model = new MonthViewModel
            {
                Date                  = date,
                MonthName             = calendarService.GetMonthName(date),
                PrevMonthName         = calendarService.GetPrevMonthName(date),
                NextMonthName         = calendarService.GetNextMonthName(date),
                DaysToSkipInFirstWeek = calendarService.GetNumberOfDaysToSkipInMonth(date),
                Days                  = calendarService.GetListOfDays(date, events)
            };

            return(View(model));
        }
        public IActionResult Month(DateTime?datetime)
        {
            DateTime dt;

            if (!datetime.HasValue)
            {
                dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            }
            else
            {
                dt = new DateTime(datetime.Value.Year, datetime.Value.Month, 1);
            }

            var daysinmonth = DateTime.DaysInMonth(dt.Year, dt.Month);

            var monthDto = new MonthViewModel()
            {
                Month                = dt.Month,
                Year                 = dt.Year,
                StartDay             = dt.DayOfWeek,
                DaysInMonth          = daysinmonth,
                LastMonthDaysInMonth = DateTime.DaysInMonth(dt.Year, dt.Subtract(new TimeSpan(1, 0, 0, 0)).Month),
                LastMonth            = dt.Subtract(new TimeSpan(1, 0, 0, 0)),
                NextMonth            = dt.Add(new TimeSpan(daysinmonth, 0, 0, 0))
            };

            return(View(monthDto));
        }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            MonthViewModel model = new MonthViewModel();



            //private MonthRepository _repository;
            //public HomeController(MonthRepository repository)
            //{
            //	_repository = repository;
            //}
            //public ActionResult Index()
            //{
            //	// We only want a list of months in a single array.
            //	var model = new dbMonthViewModel
            //	{
            //		MonthData = _repository
            //			.GetAll()
            //			.Select(item => item.MonthName).ToArray()
            //	};
            //	return View(model);
            //}

            return(View(model));
        }
Exemplo n.º 4
0
        protected override void OnAppearing()
        {
            MonthViewModel ViewModel = new MonthViewModel();

            ViewModel.Navigation = Navigation;
            this.BindingContext  = ViewModel;
        }
Exemplo n.º 5
0
 public MonthView()
 {
     InitializeComponent();
     BindingContext  = viewModel = new MonthViewModel();
     viewModel.Month = (Monate)(DateTime.Now.Month - 1);
     Monatsname.Text = ((Monate)viewModel.Month).ToString();
     reloadInTime(2000);
 }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            // We only want a list of months in a single array.
            var model = new MonthViewModel
            {
                MonthData = _repository
                            .GetAll()
                            .Select(item => item.MonthName).ToArray()
            };

            return(View(model));
        }
Exemplo n.º 7
0
        public async Task <ActionResult> Month()
        {
            var charts = new List <Highcharts>();

            for (int i = 1; i <= 12; i++)
            {
                charts.Add(await _chart.GetClientsPerMonth(i));
            }
//            var charts = await _chart.GetClientsPerMonth(5);
            var model = new MonthViewModel {
                Charts = charts
            };

            return(View(model));
        }
Exemplo n.º 8
0
        private void dataGridMonths_SelectionChanged(object sender, EventArgs e)
        {
            MonthViewModel selectedMonth = this.GetSelectedMonth();

            if (selectedMonth != null)
            {
                dataGridExpenses.DataSource = modelController.ExpensesByMonthIdAsExpenseViewModel(selectedMonth.Model.Id);

                lblMonthTotal.Text         = selectedMonth.ExpensesTotalCost.ToString("#,00");
                lblMonthFixedTotal.Text    = selectedMonth.FixedExpensesTotalCost.ToString("#,00");
                lblMonthNonFixedTotal.Text = selectedMonth.NonFixedExpensesTotalCost.ToString("#,00");

                nMonthLimit.Value          = selectedMonth.Model.ExpenseMax;
                nMonthContinuosLimit.Value = selectedMonth.Model.ContinuosExpenseMax;
            }
        }
Exemplo n.º 9
0
        public List <MonthViewModel> MonthList()
        {
            List <MonthModel> months = _commonListRepository.MonthList();

            List <MonthViewModel> monthVM = new List <MonthViewModel>();

            foreach (MonthModel m in months)
            {
                MonthViewModel mVM = new MonthViewModel();
                mVM.MonthId   = m.MonthId;
                mVM.Month     = m.Month;
                mVM.MonthAbbr = m.MonthAbbr;

                monthVM.Add(mVM);
            }
            return(monthVM);
        }
Exemplo n.º 10
0
        public async Task <ActionResult> MonthAccessPoint()
        {
            var charts = new List <Highcharts>
            {
                await _chart.GetClientsPerMonth(3, 345),
                await _chart.GetClientsPerMonth(3, 252),
                await _chart.GetClientsPerMonth(3, 282),
                await _chart.GetClientsPerMonth(3, 291),
                await _chart.GetClientsPerMonth(3, 342),
                await _chart.GetClientsPerMonth(3, 306),
                await _chart.GetClientsPerMonth(3, 273),
                await _chart.GetClientsPerMonth(3, 285),
                await _chart.GetClientsPerMonth(3, 303)
            };

            var model = new MonthViewModel {
                Charts = charts
            };

            return(View(model));
        }
Exemplo n.º 11
0
        public IActionResult PrevMonth(DateTime date)
        {
            var userId = GetCurrentUserId();

            date = date.AddMonths(-1);

            var events = context.Events
                         .Where(a => a.Date.Month == date.Month && a.User.Id == userId)
                         .ToList();

            var model = new MonthViewModel
            {
                Date                  = date,
                MonthName             = calendarService.GetMonthName(date),
                PrevMonthName         = calendarService.GetPrevMonthName(date),
                NextMonthName         = calendarService.GetNextMonthName(date),
                DaysToSkipInFirstWeek = calendarService.GetNumberOfDaysToSkipInMonth(date),
                Days                  = calendarService.GetListOfDays(date, events)
            };

            return(View("Index", model));
        }
Exemplo n.º 12
0
        public async Task <ActionResult> MonthVlan()
        {
            var charts = new List <Highcharts>
            {
                await _chart.GetClientsPerMonth(3, 0, 4),
                await _chart.GetClientsPerMonth(3, 0, 7),
                await _chart.GetClientsPerMonth(3, 0, 10),
                await _chart.GetClientsPerMonth(3, 0, 13),
                await _chart.GetClientsPerMonth(3, 0, 16),
                await _chart.GetClientsPerMonth(3, 0, 19),
                await _chart.GetClientsPerMonth(3, 0, 22),
                await _chart.GetClientsPerMonth(3, 0, 25),
                await _chart.GetClientsPerMonth(3, 0, 28),
                await _chart.GetClientsPerMonth(3, 0, 30),
                await _chart.GetClientsPerMonth(3, 0, 33),
                await _chart.GetClientsPerMonth(3, 0, 36)
            };

            var model = new MonthViewModel {
                Charts = charts
            };

            return(View(model));
        }
Exemplo n.º 13
0
 public CalendarViewModel()
 {
     CurrentMonth = (Models.Month)DateTime.Now.Month;
     CurrentYear  = DateTime.Now.Year;
     Month        = new MonthViewModel(CurrentMonth, CurrentYear);
 }
Exemplo n.º 14
0
 private async void DateSelected(MonthViewModel obj)
 {
     await LoadData();
 }
Exemplo n.º 15
0
 private void CreateDateLists(int selectedMonth, int selectedYear)
 {
     ViewData[Resource.MonthsViewData] = MonthViewModel.GetAll(selectedMonth);
     ViewData[Resource.YearsViewData]  = new SelectList(_service.GetAllYears(), selectedYear);
 }
Exemplo n.º 16
0
 private void GoToDayView(MonthViewModel obj)
 {
     this.CurrentPage = this.Children[1];
 }
Exemplo n.º 17
0
        public MonthViewModel GetMonthView(int year, PersianMonth month)
        {
            var monthView            = new MonthViewModel(year, month);
            int dayNumber            = 1;
            int prevMonthStartNumber = monthView.PreviousMonthStartDayNumber;

            monthView.Days = new List <DayViewModel>();

            bool started = false, finished = false;

            for (int j = 0; j < 6; j++)
            {
                for (int i = 6; i >= 0; i--)
                {
                    if (j == 0)  //means it's first week
                    {
                        if (i == 7 - monthView.FirstDayWeekDayNumber)
                        {
                            started = true;
                        }
                        else
                        {
                            if (!started)
                            {
                                var day = DayViewModel.Init(
                                    monthView.PreviousMonth.GetDate(
                                        monthView.PreviousMonthYear,
                                        prevMonthStartNumber));
                                day.Disabled = true;
                                monthView.Days.Add(day);
                                prevMonthStartNumber++;
                            }
                        }
                    }

                    if (finished)
                    {
                        var day = DayViewModel.Init(
                            monthView.NextMonth.GetDate(monthView.NextMonthYear, dayNumber));
                        day.Disabled = true;
                        monthView.Days.Add(day);
                        dayNumber++;
                    }

                    if (started && !finished)
                    {
                        var day = DayViewModel.Init(
                            month.GetDate(year, dayNumber));
                        monthView.Days.Add(day);
                        if (dayNumber == monthView.LastDayNumber)
                        {
                            finished  = true;
                            dayNumber = 0;
                        }
                        dayNumber++;
                    }
                }
            }

            int           idx    = 0;
            int           w      = 1;
            int           wOrder = 1;
            WeekViewModel week   = new WeekViewModel();

            foreach (var day in monthView.Days)
            {
                if (w == 1)
                {
                    week = new WeekViewModel {
                        Order     = wOrder,
                        StartDate = day.DateValue
                    };
                }
                if (w == 7)
                {
                    week.FinishDate = day.DateValue;
                    monthView.Weeks.Add(week);
                    w = 0;
                    wOrder++;
                }

                week.Days.Add(day);
                w++;
            }

            return(monthView);
        }