public ActionResult YearCalendar(int year) { var yearViewModel = new YearViewModel { YearName = year.ToString(), Months = BuildMonthsViewModel(year) }; return PartialView(yearViewModel); }
public ActionResult Charts() { YearViewModel vm = new YearViewModel(); vm.PopulateDropDowns(DateTime.Now.Year); return(View(vm)); }
public ActionResult ViewReportSummaryByYears(int companyId) { var model = new CompanyByYearsViewModel { CompanyId = companyId, Years = new List <YearViewModel>() }; model.Company = db.Companies.Find(companyId); var companyItems = db.ReportItems.Where(x => x.Report.HumDistributionPlan.CompanyId == companyId).Include(x => x.HumDistributionPlanItem).ToList(); if (companyItems.Count > 0) { foreach (var yearItems in companyItems.GroupBy(x => x.Report.Year)) { var yearModel = new YearViewModel { Year = yearItems.Key ?? 0, Quarters = new List <QuarterViewModel>() }; foreach (var quarterItems in yearItems.GroupBy(x => x.Report.Quarter ?? 0)) { var quarterModel = new QuarterViewModel { Quarter = quarterItems.Key }; quarterModel.FactSum = quarterItems.Sum(x => x.FactSum ?? 0); quarterModel.PlanSum = quarterItems.Sum(x => x.HumDistributionPlanItem.Sum ?? 0); yearModel.Quarters.Add(quarterModel); } model.Years.Add(yearModel); } } return(View(model)); }
private async void calculateYearButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(desireAgeText.Text)) { errorMessageYearLabel.Text = "La edad es requerida."; return; } if (desireAgeText.Text == "0") { errorMessageYearLabel.Text = "La edad debe ser mayor a 0."; return; } errorMessageYearLabel.Text = string.Empty; var entidad = new YearViewModel { Birthdate = birthdateText.Value, QuantityYear = Convert.ToInt32(desireAgeText.Text), }; calculateYearButton.Enabled = false; resultYearLabel.Text = "Procesando datos..."; var result = await yearService.Request(entidad); result = result.Substring(1, result.Length - 2); calculateYearButton.Enabled = true; resultYearLabel.Text = string.Format("El resultado es: {0}", result); }
protected override void OnAppearing() { YearViewModel ViewModel = new YearViewModel(); ViewModel.Navigation = this.Navigation; this.BindingContext = ViewModel; }
public ActionResult Year(int year) { var viewModel = new YearViewModel(year) { Images = _contentDelivery.GetImages(year) }; return(View(viewModel)); }
public void Update(YearViewModel vm) { Year year = new Year(); year.Id = vm.Id; year.Name = vm.Name; year.Status = true; _context.Year.Update(year); _context.SaveChanges(); }
public ActionResult Index(YearViewModel lam) { int?monthId = lam.MonthId; int?year = lam.YearName; IEnumerable <LeaveApplicationViewModel> leaveList = _leaveServices .GetLeaveApplicationsListAdmin(Convert.ToInt32(ViewBag.Empcode), monthId, year); ViewBag.Years = _leaveServices.GetLeaveApplicationsYear(); ViewBag.YVM = lam; return(View(leaveList)); }
public int Add(YearViewModel year) { var p = new Year(); p.Name = year.Name; p.Status = true; var a = _context.Year.Add(p); _context.SaveChanges(); return(a.Entity.Id); }
public ActionResult Charts(YearViewModel vm) { var profiler = MiniProfiler.Current; using (profiler.Step("CountsByRequestEntity")) ViewBag.CountsByRequestEntity = this.screeningStatisticTasks.GetFinalDecisionCountByRequestEntity(vm.Year); using (profiler.Step("CountsByResult")) ViewBag.CountsByResult = this.screeningStatisticTasks.GetFinalDecisionCountByResult(vm.Year); vm.PopulateDropDowns(DateTime.Now.Year); return(View(vm)); }
/** Yearly ER - Fetch SUB-groups **/ public async Task <List <AccountYearViewModel> > FetchSubGroupsForYearlyEr(AccountYearViewModel ayear, StructureType selectedType, int mostRecentFinancialYear) { List <AccountYearViewModel> accountYearModel = null; // If user is in mixed-structureTypes mode: if (selectedType == StructureType.SubjectsThenFunctions || selectedType == StructureType.FunctionsThenSubjects) { // If user was on top-level when he clicked on account: IdOfParentInSuperordinateStructure == null // If user clicked on an account below the top-level-structure: IdOfParentInSuperordinateStructure will have a value string idOfParentInSuperordinateStructure = ayear.IdOfParentInSuperordinateStructure ?? ayear.AccountId; int levelOfAccountsToFetch = ayear.IdOfParentInSuperordinateStructure == null ? 1 : (ayear.AccountLevel + 1); List <int> years = new List <int> { (ayear.Year - 1), ayear.Year }; var query = GetQueryForErSubAccountsInMixedStructure(selectedType, ERAccountType.ExpensesAndIncomes, idOfParentInSuperordinateStructure, ayear.AccountId, levelOfAccountsToFetch, years); List <AccountYearViewModel> accountsForPreviousYear = await query.Where(a => a.Year == (ayear.Year - 1)).ToListAsync(); List <AccountYearViewModel> accountsForSelectedYear = await query.Where(a => a.Year == ayear.Year).ToListAsync(); SetPercentChangesBetweenTwoYears(accountsForPreviousYear, accountsForSelectedYear, mostRecentFinancialYear, ayear.Year); // Add id of superordinate subject-account: foreach (var acc in accountsForSelectedYear) { acc.IdOfParentInSuperordinateStructure = idOfParentInSuperordinateStructure; } accountYearModel = accountsForSelectedYear; } // If user is in subjects-mode or in functions-mode: else if (selectedType == StructureType.Functions || selectedType == StructureType.Subjects) { YearViewModel m = await FetchMainGroupsForYearlyER(selectedType, mostRecentFinancialYear, ayear.Year, (ayear.AccountLevel) + 1); accountYearModel = m.Accounts.Where(a => a.AccountId.Substring(0, ayear.AccountLevel) == ayear.AccountId).ToList(); } return(accountYearModel); }
public async Task <List <YearViewModel> > GetAll() { var listItems = await _context.Year.Where(x => x.Status == true).OrderByDescending(x => x.Name).ToListAsync(); List <YearViewModel> listVM = new List <YearViewModel>(); foreach (var item in listItems) { YearViewModel vm = new YearViewModel(); vm.Id = item.Id; vm.Name = item.Name; vm.Status = item.Status; listVM.Add(vm); } return(listVM); }
public YearViewModel GetById(int id) { var c = _context.Year.Find(id); if (c == null) { throw new Exception("Year isn't in data."); } YearViewModel vm = new YearViewModel(); vm.Id = c.Id; vm.Name = c.Name; vm.Status = c.Status; return(vm); }
public List <YearViewModel> YearList() { List <YearModel> years = _commonListRepository.YearList(); List <YearViewModel> yearVM = new List <YearViewModel>(); foreach (YearModel y in years) { YearViewModel yVM = new YearViewModel(); yVM.YearId = y.YearId; yVM.Year = y.Year; yearVM.Add(yVM); } return(yearVM); }
public IActionResult SaveEntity(YearViewModel vm) { if (!ModelState.IsValid) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(allErrors)); } else { int id = 0; if (vm.Id == 0) { id = _yearService.Add(vm); } else { _yearService.Update(vm); id = vm.Id; } return(new OkObjectResult(id)); } }
public async Task <IHttpActionResult> GetDependencies(int id) { if (id == default(int)) { return(BadRequest(ErrorMessage.Make.InvalidMakeId)); } YearViewModel yearViewModel = new YearViewModel(); try { var year = await _yearApplicationService.GetAsync(id); yearViewModel.Id = year.Id; yearViewModel.BaseVehicleCount = year.BaseVehicleCount; } catch (Exception) { //no dependencies } return(Ok(yearViewModel)); }
public YearPage() { InitializeComponent(); // BindingContext = new YearViewModel(); viewModel = new YearViewModel(); }
public YearPage(string pageTitle, string idTopic) { InitializeComponent(); // BindingContext = new YearViewModel(); viewModel = new YearViewModel(pageTitle, idTopic); }