public int AppointmentRejected(AppointmentModel appointmentModel) { int result = 0; try { //Change Appointment Status to rejected PractitionerData dataLayer = new PractitionerData(); AppointmentModel model = new AppointmentModel(); //model is with appointmentdatestring and appointmenttimestring and PatientId + RejectReasons + PracitionerId model = dataLayer.AppointmentRejected(appointmentModel); if (!model.PatientId.Equals(Guid.Empty)) { //Get PatientId to retrieve email PatientData patientDataLayer = new PatientData(); string patientEmailAddress = patientDataLayer.GetPatientEmail(model.PatientId); PractitionerBaseViewModel companyDetails = new PractitionerBaseViewModel(); PractitionerBaseViewModel temp = new PractitionerBaseViewModel(); temp.AccId = appointmentModel.PractitionerId; companyDetails = dataLayer.GetProfile(temp); result = SentAppointmentRejectedNotificationEmail(patientEmailAddress, model.AppointmentDateString, model.AppointmentTimeString, model.RejectReasons, companyDetails); } } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.AppointmentAccepted : " + err); } return(result); }
public PractitionerBaseViewModel GetProfile(PractitionerBaseViewModel vm) { PractitionerBaseViewModel result = new PractitionerBaseViewModel(); try { PractitionerData dataLayer = new PractitionerData(); result = dataLayer.GetProfile(vm); } catch (Exception err) { new LogHelper().LogMessage("PractitionerBusiness.GetProfile : " + err); } return(result); }
public NewPatientRecordViewModel CreateNewRecord(PatientRecordModel vm) { NewPatientRecordViewModel result = new NewPatientRecordViewModel(); PractitionerData practitionerData = new PractitionerData(); PatientData patientData = new PatientData(); //Retrieve practitioner and company information PractitionerBaseViewModel practitionerId = new PractitionerBaseViewModel(); practitionerId.AccId = vm.PractitionerId; result.PractitionerDetails = practitionerData.GetProfile(practitionerId); // Retrieve patient information result.PatientDetails = patientData.PatientProfile(vm.PatientId); vm.CreatedOn = DateTime.UtcNow; RecordFileSystem fileRecord = new RecordFileSystem(); fileRecord.ContentType = ConstantHelper.AppSettings.RecordFileType; fileRecord.FileContents = new byte[1]; fileRecord.FileDownloadname = DateTime.Now.Date.ToString() + "-" + result.PractitionerDetails.CompanyId; fileRecord.PatientId = result.PatientDetails.AccId; fileRecord.PractitionerId = result.PractitionerDetails.AccId; //Get medicines list in the company result.NewPatientRecord = practitionerData.GetMedicinesList(result.PractitionerDetails.CompanyId); result.NewPatientRecord.AppointmentId = vm.AppointmentId; result.NewPatientRecord.PatientId = vm.PatientId; result.NewPatientRecord.PractitionerId = vm.PractitionerId; //Creating a record in the database result.NewPatientRecord.RecordId = practitionerData.CreatePatientRecord(fileRecord); return(result); }