Esempio n. 1
0
        public int AppointmentAbsent(AppointmentModel appointmentModel)
        {
            int result = 0;

            try
            {
                //Change Appointment Status to absent
                PractitionerData dataLayer = new PractitionerData();
                AppointmentModel model     = new AppointmentModel();
                model = dataLayer.AppointmentAbsent(appointmentModel);

                if (!model.PatientId.Equals(Guid.Empty))
                {
                    //Get PatientId to retrieve email
                    PatientData patientDataLayer    = new PatientData();
                    string      patientEmailAddress = patientDataLayer.GetPatientEmail(model.PatientId);
                    result = SentAppointmentAbsentNotificationEmail(patientEmailAddress, model.AppointmentDateString, model.AppointmentTimeString);
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PractitionerBusiness.AppointmentAbsent : " + err);
            }

            return(result);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void SentEmailNotification(AppointmentModel model, PractitionerBaseViewModel ptResult)
        {
            string mailFrom = ConstantHelper.AppSettings.MailFrom;
            string userName = ConstantHelper.AppSettings.UserName;
            string password = ConstantHelper.AppSettings.Password;

            try
            {
                PatientData patientDataLayer = new PatientData();
                string      patientEmail     = patientDataLayer.GetPatientEmail(model.PatientId);
                if (!String.IsNullOrEmpty(patientEmail))
                {
                    //Sent notification email to patient
                    string patientEmailSubject = ConstantHelper.Email.AppointmentVerification.AppointmentMadeSubject;
                    string patientEmailBody    = ConstantHelper.Email.AppointmentVerification.AppointmentMadeBody;
                    //replace with appointment details
                    DateTime tempAppointmentDateTime = Convert.ToDateTime(model.AppointmentDate.ToString());
                    string   appointmentDetailsTable = "<table><caption>Appointment Details</caption><tr><th>Appointment Date</th><td>" + tempAppointmentDateTime.ToString("dd/MM/yyyy") + "</td></tr><tr><th>Appointment Time</th><td>" + tempAppointmentDateTime.ToString("hh:mm tt") + "</td></tr><tr><th>Company</th><td>" + ptResult.CompanyName + "</td></tr><tr><th>City</th><td>" + ptResult.City + "</td></tr><tr><th>Postal Code</th><td>" + ptResult.PostalCode + "</td></tr><tr><th>State</th><td>" + ptResult.State + "</td></tr><tr><th>Appointment Description</th><td>" + model.Description + "</td></tr><tr><th>Appointment Remarks</th><td>" + model.Remarks + "</td></tr></table>";
                    patientEmailBody = patientEmailBody.Replace(ConstantHelper.Email.Keyword.AppointmentDetails, appointmentDetailsTable);
                    EmailHelper.SentMail(mailFrom, patientEmail, patientEmailSubject, patientEmailBody, userName, password);
                }

                PractitionerData practitionerDataLayer = new PractitionerData();
                string           practitionerEmail     = practitionerDataLayer.GetPractitionerEmail(model.PractitionerId);
                if (!String.IsNullOrEmpty(practitionerEmail))
                {
                    //Sent notification email to practitioner
                    string practitionerEmailSubject = ConstantHelper.Email.AppointmentVerification.NewAppointmentSubject;
                    string practitionerEmailBody    = ConstantHelper.Email.AppointmentVerification.NewAppointmentBody;
                    //replace maybe link to practitionerLogin
                    string practitionerLoginPage = "<a href='" + ConstantHelper.AppSettings.RootSiteUrl + ConstantHelper.API.Practitioner.PractitionerLogin + "'>Practitioner Login Page</a>";
                    practitionerEmailBody = practitionerEmailBody.Replace(ConstantHelper.Email.Keyword.PractitionerLoginPage, practitionerLoginPage);
                    EmailHelper.SentMail(mailFrom, practitionerEmail, practitionerEmailSubject, practitionerEmailBody, userName, password);
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PatientBusiness.SentEmailNotification : " + err);
            }
        }