/// <summary> /// Get Service information based on appointmentId /// </summary> /// <param name="a"></param> /// <returns></returns> private static Models.ServiceModel GetServiceInformation(Data.Appointment a) { try { string CustomFieldObjectName = string.Empty; if (a.ServiceId != null) { return(new Models.ServiceModel() { ServiceId = a.Service.ServiceId, CreatedBy = a.Service.CreatedBy, CreatedDate = a.Service.CreatedDate, ModifiedBy = a.Service.ModifiedBy, ModifiedDate = a.Service.ModifiedDate, ClientId = a.Service.ClientId, ProcedureCodeId = a.Service.ProcedureCodeId, DateOfService = a.Service.DateOfService, EndDateOfService = a.Service.EndDateOfService, Unit = a.Service.Unit, UnitType = a.Service.UnitType, Status = a.Service.Status, ClinicianId = a.Service.ClinicianId, ClinicianName = DataService.GetClinicianName((int)a.Service.ClinicianId), AttendingId = a.Service.AttendingId, ProgramId = a.Service.ProgramId, LocationId = a.Service.LocationId, Billable = a.Service.Billable, SpecificLocation = a.Service.SpecificLocation, DateTimeIn = a.Service.DateTimeIn, DateTimeOut = a.Service.DateTimeOut, Diagnosis = AppointmentRepository.GetDiagnosis(a.Service), CustomFields = AppointmentRepository.GetCustomFields(a.Service, ref CustomFieldObjectName), CustomFieldObjectName = CustomFieldObjectName, Document = AppointmentRepository.CreateModelDocument(a.Service.Documents.FirstOrDefault()), ProcedureCodeName = AppointmentRepository.GetProcedureCodeName(a.Service.ProcedureCodeId), LocationName = AppointmentRepository.GetLocationName(a.Service.LocationId), ProgramName = AppointmentRepository.GetProgramName(a.Service.ProgramId) }); } else { return(null); } } catch (Exception ex) { Exception excep = new Exception("Exception occured in BriefcaseRepositiry.GetServiceInformation method." + ex.Message); throw excep; } }