public static List <SalaryStatistics> GetDoctorSalaryStatistics(string str) { var values = str.Split('*'); var list = new List <SalaryStatistics>(); DateTime?dt; for (int i = 0; i < (values.Length - 1); i += 5) { if (string.IsNullOrEmpty(values.GetValue(i).ToString())) { dt = null; } else { dt = Convert.ToDateTime(values.GetValue(i)); } SalaryStatistics salaryPerDay = new SalaryStatistics() { Day = dt, WorkedHours = Convert.ToDouble(values.GetValue(i + 1)), SalaryRate = Convert.ToDouble(values.GetValue(i + 2)), SalaryCoefficient = Convert.ToDouble(values.GetValue(i + 3)), EarnedMoney = Convert.ToDouble(values.GetValue(i + 4)) }; list.Add(salaryPerDay); } return(list); }
public static SalaryStatistics GetDoctorGeneralSalaryStatistics(string str) { var values = str.Split('*'); SalaryStatistics statistics = new SalaryStatistics() { Day = null, WorkedHours = Convert.ToDouble(values.GetValue(1)), SalaryRate = Convert.ToDouble(values.GetValue(2)), SalaryCoefficient = Convert.ToDouble(values.GetValue(3)), EarnedMoney = Convert.ToDouble(values.GetValue(4)) }; return(statistics); }
public IHttpActionResult GetDoctorGeneralSalaryStatistics(int doctorId, DateTime dateStart, DateTime dateFinish) { SalaryStatistics statistics = _doctorService.GetDoctorGeneralSalaryStatistics(doctorId, dateStart, dateFinish); return(Ok(statistics)); }