public byte[] GetAppointmentReport(AppointmentFilterDTO appointmentFilter) { try { AppointmentDSL appointmentDSL = new AppointmentDSL(mapper); List <AppointmentReportDTO> appointmentList = appointmentDSL.GetAppointmentReport(appointmentFilter.DateFrom, appointmentFilter.DateTo, appointmentFilter.PatientId, appointmentFilter.CategoryId, appointmentFilter.ClinicId, appointmentFilter.UserId, appointmentFilter.State); appointmentFilter.TotalPaid = appointmentList.Sum(a => a.PaidAmount); appointmentFilter.ClinicName = appointmentFilter.ClinicId == 0 ? "الكل" : new ClinicDSL(mapper).GetById(appointmentFilter.ClinicId).Name; appointmentFilter.UserFullName = appointmentFilter.UserId == 0 ? "الكل" : new UserDSL(mapper).GetById(appointmentFilter.UserId).FullName; appointmentFilter.PatientFullName = appointmentFilter.PatientId == 0 ? "الكل" : new PatientDSL(mapper).GetById(appointmentFilter.PatientId).FullName; appointmentFilter.CategoryName = appointmentFilter.CategoryId == 0 ? "الكل" : new AppointmentCategoryDSL(mapper).GetById(appointmentFilter.CategoryId).Name; switch (appointmentFilter.State) { case 0: appointmentFilter.StateName = "الكل"; break; case AppointmentStateEnum.Cancelled: appointmentFilter.StateName = "ملغي"; break; case AppointmentStateEnum.Current: appointmentFilter.StateName = "جارى"; break; case AppointmentStateEnum.Finished: appointmentFilter.StateName = "انتهى"; break; case AppointmentStateEnum.Pending: appointmentFilter.StateName = "قيد الانتظار"; break; } List <AppointmentFilterDTO> parameterList = new List <AppointmentFilterDTO> { appointmentFilter }; return(GenerateReportAsync("AppointmentReport", "AppointmentList", appointmentList, parameterList)); } catch (Exception e) { throw e; } }
public AppointmentController(IMapper _mapper) { appointmentDSL = new AppointmentDSL(_mapper); }