public ActionResult Index() { var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); return(View(homeModel)); }
public ActionResult UpdateHomeChartTimeOption(HomeChartModel model) { if (ModelState.IsValid) { Backend.Instance.UpdateTimeOptionString(model.TimeOptionString); var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); return(View("Index", homeModel)); } return(View("Resources", model)); }
public ActionResult UpdateHomeChartClinicOption(HomeChartModel model) { if (ModelState.IsValid) { Backend.Instance.UpdateClinicOptionString(model.ClinicOptionString); ViewBag.Section = "Bili%ByClinic"; var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); return(View("Index", homeModel)); } return(View("Resources", model)); }
public HomeChartModel GetHomeData() { var myData = new HomeChartModel(); myData.BilirubinData = repository.GetBilirubinData(); myData.BilirubinLevels = repository.GetBilirubinLevels(); myData.Clinics = repository.GetHomeClinics(); myData.TimeOptionsList = repository.GetOptionsList(); myData.Timeframe = repository.GetTimeframe(); myData.TimeOption = repository.GetTimeOption(); myData.TimeOptionString = repository.GetTimeOptionString(); myData.ClinicOption = repository.GetClinicOption(); myData.ClinicOptionString = repository.GetClinicOptionString(); myData.ClinicOptionsList = repository.GetClinicOptionsList(); return(myData); }
public JsonResult GetTestNumbersForAllClinicsChart() { var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); int num = homeModel.TimeOption; List <object> iData = new List <object>(); for (int i = 0; i < homeModel.BilirubinData.Length; i++) { iData.Add(homeModel.Timeframe[num]); iData.Add(homeModel.BilirubinData[i]); iData.Add(new List <string> { "Clinic " + homeModel.Clinics[i] }); } //Source data returned as JSON return(Json(iData, JsonRequestBehavior.AllowGet)); }
public ActionResult GetBilirubinLevelChart() { var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); int num = homeModel.TimeOption; var key = new Chart(width: 900, height: 400) .AddSeries( chartType: "column", name: homeModel.Clinics[0], xValue: homeModel.Timeframe[num], yValues: homeModel.BilirubinData[0]) .AddSeries( chartType: "column", name: homeModel.Clinics[1], xValue: homeModel.Timeframe[num], yValues: homeModel.BilirubinData[1]) .AddSeries( chartType: "column", name: homeModel.Clinics[2], xValue: homeModel.Timeframe[num], yValues: homeModel.BilirubinData[2]) .AddSeries( chartType: "column", name: homeModel.Clinics[3], xValue: homeModel.Timeframe[num], yValues: homeModel.BilirubinData[3]) .AddSeries( chartType: "column", name: homeModel.Clinics[4], xValue: homeModel.Timeframe[num], yValues: homeModel.BilirubinData[4]) .SetXAxis("Months") .SetYAxis("Bilirubin Level (%)") .AddLegend() .Write(); return(null); }
public JsonResult GetClinicBilirubinLevelChart() { var homeModel = new HomeChartModel(); homeModel = Backend.Instance.GetHomeData(); int num = homeModel.ClinicOption; // Order of data in the list: // 1. X-Values (labels) // 2. Y-Values (data) // 3. X-Axis label List <object> iData = new List <object>(); iData.Add(homeModel.ConvertDataToString(homeModel.BilirubinLevels)); iData.Add(homeModel.BilirubinData[num]); iData.Add(new List <string> { "Clinic " + homeModel.Clinics[num] }); //Source data returned as JSON return(Json(iData, JsonRequestBehavior.AllowGet)); }
public async Task <ResultDataModel <List <HomeChartModel> > > GetHomeChart(int userId, int month, int year) { var result = new ResultDataModel <List <HomeChartModel> >(); var filter = new BaseFilter() { StartDate = new DateTime(year, month, 1), EndDate = new DateTime(year, month, DateTime.DaysInMonth(year, month)), UserId = userId }; var householdExpenseModel = new HomeChartModel() { Index = 0, Description = "Despesas Domésticas" }; var expensesModel = new HomeChartModel() { Index = 1, Description = "Outros Gastos" }; var vehicleModel = new HomeChartModel() { Index = 2, Description = "Combustível" }; var financingsModel = new HomeChartModel() { Index = 3, Description = "Financiamentos" }; var loanModel = new HomeChartModel() { Index = 4, Description = "Empréstimos" }; var contributionsModel = new HomeChartModel() { Index = 5, Description = "Aportes (Investimentos)" }; var educationModel = new HomeChartModel() { Index = 6, Description = "Educação" }; foreach (var item in (await _vehicleRepository.GetSome(filter))) { vehicleModel.Value += item.FuelExpenses.Sum(p => p.ValueSupplied); } foreach (var item in (await _householdExpenseRepository.GetSome(filter))) { householdExpenseModel.Value += item.Value; } var payments = await _paymentRepository.GetSome(filter); expensesModel.Value += CalculatePaymentHomeChartModel(payments, month, year, PaymentTypeEnum.Expense); contributionsModel.Value += CalculatePaymentHomeChartModel(payments, month, year, PaymentTypeEnum.Contributions); financingsModel.Value += CalculatePaymentHomeChartModel(payments, month, year, PaymentTypeEnum.Financing); educationModel.Value += CalculatePaymentHomeChartModel(payments, month, year, PaymentTypeEnum.Education); loanModel.Value += CalculatePaymentHomeChartModel(payments, month, year, PaymentTypeEnum.Loan); result.Data.Add(expensesModel); result.Data.Add(householdExpenseModel); result.Data.Add(vehicleModel); result.Data.Add(financingsModel); result.Data.Add(loanModel); result.Data.Add(contributionsModel); result.Data.Add(educationModel); return(result); }