Exemplo n.º 1
0
 public static ResultViewModel GetResultViewModel(float year, InputViewModel input)
 {
     var r = new ResultViewModel();
     r.year = year;
     var hoursPerYear = input.weeks*input.days*input.hours;
     var annual = Getannual(year, input);
     r.annual = Math.Round(annual, 0);
     r.weekly = Math.Round(annual / input.weeks, 0);
     r.daily = Math.Round(r.weekly / input.days, 2);
     r.percent = Math.Round((annual * 100) / hoursPerYear, 2);
     return r;
 }
Exemplo n.º 2
0
 private IQueryable<ResultViewModel> GetResults(InputViewModel input)
 {
     var l = new List<ResultViewModel>();
     l.Add(CalcService.GetResultViewModel(year: 1.0f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 1.5f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 2.0f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 2.5f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 3.0f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 3.5f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 4.0f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 4.5f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 5.0f, input: input));
     l.Add(CalcService.GetResultViewModel(year: 5.5f, input: input));
     return l.Where(x => true).AsQueryable();
 }
Exemplo n.º 3
0
 private static float Getannual(float years, InputViewModel input)
 {
     var totalkw = input.kw * input.qty;
     float annual = input.cost / (years * totalkw * input.rate);
     return annual;
 }
Exemplo n.º 4
0
 public JsonResult Calc(InputViewModel input)
 {
     Thread.Sleep(300);
     return Json(this.GetResults(input), JsonRequestBehavior.AllowGet); //Content(r);
 }