Exemplo n.º 1
0
        public static void BookMeeting(string participantEmail, string slots, string patientName,
                                       string questionCategory, string doctorName)
        {
            var dateStartDate = GetDateTime(slots);
            var itemId        = SharePointRepository.CreateMeetingDetails(dateStartDate, dateStartDate.AddHours(1),
                                                                          string.Empty, doctorName, patientName, participantEmail, string.Empty,
                                                                          questionCategory);
            var portalUrl            = "";
            var queryStringParameter = "";

            if (ConfigurationManager.AppSettings["IsAngularApp"] == "true")
            {
                portalUrl            = new Uri(ConfigurationManager.AppSettings["ida:HealthCarePortal"]).AbsoluteUri + "healthcare/guest?uri=";
                queryStringParameter = $"meetingId={itemId}&userType=Patient&displayName={patientName}";
            }
            else
            {
                portalUrl = new Uri(ConfigurationManager.AppSettings["ida:HealthCarePortal"]).AbsoluteUri +
                            "api/meeting?";
                queryStringParameter = "meetingId=" + itemId + "&userType=Patient&displayName=" + patientName;
            }

            string error;
            var    encrptedParameters = EncryptionHelper.Encrypt(queryStringParameter);
            var    meetingUrl         = portalUrl + encrptedParameters;
            var    invitation         = MeetingInvitation.SendEmail(meetingUrl, participantEmail,
                                                                    out error);
        }
        public IHttpActionResult SaveMeeting(Appointment appt)
        {
            int bookingTime = 0;

            if (!string.IsNullOrEmpty(appt.TimeSlot))
            {
                var time = appt.TimeSlot.Split(' ');
                if (time.Length == 2)
                {
                    bookingTime = (time[1].ToUpper().Equals("PM")) ? 12 + int.Parse(time[0]) : int.Parse(time[0]);
                }
            }

            var startDate = new DateTime(appt.Date.Year, appt.Date.Month, appt.Date.Day, bookingTime, 0, 0);

            if (startDate.ToUniversalTime() < DateTime.Now.ToUniversalTime())
            {
                return(BadRequest("Please provide a future date !!"));
            }

            if (string.IsNullOrEmpty(appt.DoctorName))
            {
                appt.DoctorName =
                    ClaimsPrincipal.Current.Claims.Where(c => c.Type == "name").Select(c => c.Value).SingleOrDefault();
            }

            var itemId = InsertBlankMeetingDetails(startDate, startDate.AddHours(1), User.Identity.Name, appt.DoctorName,
                                                   appt.FullName, appt.Email, string.Empty, appt.Questionnaire);

            var portalUrl            = new Uri(ConfigurationManager.AppSettings["ida:HealthCarePortal"]).AbsoluteUri + "healthcare/guest?uri=";
            var queryStringParameter = $"meetingId={itemId}&userType=Patient&displayName={appt.FullName}";
            var encrptedParameters   = EncryptionHelper.Encrypt(queryStringParameter);

            var    meetingUrl = portalUrl + encrptedParameters;
            string error;
            var    hasEmailInviteSent = MeetingInvitation.SendEmail(meetingUrl, appt.Email, out error);

            if (!hasEmailInviteSent)
            {
                Ok(false);
            }
            return(Ok(true));
        }
        public IHttpActionResult SendEmailInvite(Appointment appt)
        {
            var portalUrl = new Uri(ConfigurationManager.AppSettings["ida:HealthCarePortal"]).AbsoluteUri +
                            "healthcare/guest?uri=";

            var userType = appt.IsDoctor ? "Doctor" : "Patient";

            var queryStringParameter = $"meetingId={appt.ItemId}&userType={userType}&displayName={appt.FullName}";
            var encrptedParameters   = EncryptionHelper.Encrypt(queryStringParameter);

            var meetingUrl = portalUrl + encrptedParameters;

            string error;
            var    hasEmailInviteSent = MeetingInvitation.SendEmail(meetingUrl, appt.Email, out error);

            if (!hasEmailInviteSent)
            {
                Ok(false);
            }

            return(Ok(true));
        }