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); }