public IHttpActionResult GetMeeting(string meetingId)
        {
            HealthCare.Web.Models.MeetingDetails meeting = null;
            var meetings = SharePointRepository.GetMeetingUriDetails(meetingId);

            if (meetings != null)
            {
                meeting = new HealthCare.Web.Models.MeetingDetails
                {
                    ID = Convert.ToString(meetings["ID"]),
                    OnLineMeetingId       = Convert.ToString(meetings["MeetingId"]),
                    OnlineMeetingUri      = Convert.ToString(meetings["OnlineMeetingURI"]),
                    OnlineMeetingUrl      = Convert.ToString(meetings["JoinURL"]),
                    Organizer             = Convert.ToString(meetings["Organizer"]),
                    Attendees             = Convert.ToString(meetings["Attendees"]),
                    JoinUrl               = Convert.ToString(meetings["JoinURL"]),
                    QuestionnaireRequired = Convert.ToString(meetings["QuestionnaireRequired"]),
                    PatientName           = Convert.ToString(meetings["PatientName"]),
                    Status           = Convert.ToString(meetings["Status"]),
                    AppointmentDate  = Convert.ToString(meetings["AppointmentDate"]),
                    QuestionCategory = Convert.ToString(meetings["QuestionCategory"]),
                    StartTime        = Convert.ToDateTime(meetings["StartTime"]),
                    EndTime          = Convert.ToDateTime(meetings["EndTime"]),
                    DoctorsName      = Convert.ToString(meetings["Title"])
                                       //IsDevicesTestDone = Convert.ToBoolean(meetings["IsDevicesTestDone"])
                };
            }

            return(Ok(meeting));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the meeting details from share point.
        /// </summary>
        /// <param name="itemId">The meeting identifier.</param>
        /// <returns>returns success or failure.</returns>
        public static string GetMeetingDetailsFromSharePoint(string itemId)
        {
            string         jsonstring = string.Empty;
            ListItem       item       = null;
            MeetingDetails meetings   = null;

            try
            {
                item = SharePointRepository.GetMeetingUriDetails(itemId);
                if (item != null)
                {
                    meetings = new MeetingDetails()
                    {
                        ID = Convert.ToString(item["ID"]),
                        OnLineMeetingId       = Convert.ToString(item["MeetingId"]),
                        OnlineMeetingUri      = Convert.ToString(item["OnlineMeetingURI"]),
                        OnlineMeetingUrl      = Convert.ToString(item["JoinURL"]),
                        Organizer             = Convert.ToString(item["Organizer"]),
                        Attendees             = Convert.ToString(item["Attendees"]),
                        JoinUrl               = Convert.ToString(item["JoinURL"]),
                        QuestionnaireRequired = Convert.ToString(item["QuestionnaireRequired"]),
                        PatientName           = Convert.ToString(item["PatientName"]),
                        Status           = Convert.ToString(item["Status"]),
                        AppointmentDate  = Convert.ToString(item["AppointmentDate"]),
                        QuestionCategory = Convert.ToString(item["QuestionCategory"]),
                        StartTime        = Convert.ToDateTime(item["StartTime"]),
                        EndTime          = Convert.ToDateTime(item["EndTime"]),
                        DoctorsName      = Convert.ToString(item["Title"]),
                    };
                }

                jsonstring = JsonConvert.SerializeObject(meetings);
            }
            catch (Exception)
            {
                throw;
            }

            return(jsonstring);
        }
        public async Task <IHttpActionResult> GetMeetingUri(string encryptedData)
        {
            var skypeMeeting = new SkypeMeeting();

            var userAgent      = HttpContext.Current.Request.UserAgent;
            var isMobileDevice =
                MeetingHelper.IsMobileDevice(userAgent) || HttpContext.Current.Request.Browser.IsMobileDevice;

            encryptedData = encryptedData.Replace(" ", "+");

            var values      = EncryptionHelper.Decrypt(encryptedData.Trim());
            var queryParams = values.Split('&');

            foreach (string param in queryParams)
            {
                string[] paramValue = param.Split('=');

                switch (paramValue[0].ToUpper())
                {
                case "CUSTOMID":
                    skypeMeeting.CustomId = paramValue[1];
                    break;

                case "DISPLAYNAME":
                    skypeMeeting.DisplayName = string.IsNullOrEmpty(paramValue[1])
              ? "Guest" : paramValue[1];
                    break;

                case "EMRID":
                    skypeMeeting.EmrId = paramValue[1];
                    break;

                case "STARTTIME":
                    skypeMeeting.StartTime = !string.IsNullOrEmpty(paramValue[1])
              ? Convert.ToDateTime(paramValue[1], CultureInfo.InvariantCulture) : DateTime.Now;
                    break;

                case "PATIENT":
                    bool isPatient;
                    Boolean.TryParse(paramValue[1], out isPatient);
                    skypeMeeting.IsPatient = isPatient;
                    break;

                case "MEETINGID":
                    skypeMeeting.ItemId = paramValue[1];
                    break;

                case "USERTYPE":
                    skypeMeeting.UserType  = paramValue[1];
                    skypeMeeting.IsPatient = skypeMeeting.UserType.Equals("Doctor", StringComparison.InvariantCultureIgnoreCase) ? false : true;
                    break;

                case "JOINSKYPECLIENT":
                    bool isSkypeClient;
                    Boolean.TryParse(paramValue[1], out isSkypeClient);
                    skypeMeeting.IsSkypeClient = isSkypeClient;
                    break;
                }
            }

            skypeMeeting.MeetingId = skypeMeeting.CustomId + skypeMeeting.EmrId;

            if (string.IsNullOrEmpty(skypeMeeting.UserType))
            {
                skypeMeeting.UserType = skypeMeeting.IsPatient ? "Patient" : "Doctor";
            }

            if (string.IsNullOrEmpty(skypeMeeting.ItemId))
            {
                skypeMeeting.ItemId = SharePointRepository.CheckMeetingExists(skypeMeeting.MeetingId);
            }

            dynamic jsonResponse = null;

            if (string.IsNullOrEmpty(skypeMeeting.ItemId))
            {
                if (isMobileDevice)
                {
                    string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare"));

                    jsonResponse        = JsonConvert.DeserializeObject(response);
                    skypeMeeting.ItemId = SharePointRepository.InsertMeetingData(jsonResponse, skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId);
                }
                else
                {
                    //TODO: SQL Changes
                    skypeMeeting.ItemId = InsertBlankMeetingDetails(skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId);
                }
            }
            else
            {
                ListItem meetingDetails = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]);

                if (string.IsNullOrEmpty(skypeMeeting.Url) && !(skypeMeeting.IsSkypeClient))
                {
                    string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare"));

                    jsonResponse = JsonConvert.DeserializeObject(response);
                    string onlineMeetingUri     = jsonResponse.OnlineMeetingUri;
                    string onlineMeetingJoinUrl = jsonResponse.JoinUrl;
                    SharePointRepository.UpdateMeetingUri(onlineMeetingUri, onlineMeetingJoinUrl, skypeMeeting.ItemId);
                    ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                    skypeMeeting.Url = Convert.ToString(meetingUri["JoinURL"]);
                    //ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId);
                    //skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]);
                    //skypeMeeting.Url = onlineMeetingJoinUrl;
                }
            }

            if (isMobileDevice)
            {
                if (jsonResponse != null)
                {
                    skypeMeeting.Url = jsonResponse.JoinUrl;
                }

                skypeMeeting.Url = $"{ConfigurationManager.AppSettings["MobileSiteUri"]}?uri={skypeMeeting.Url}&id={skypeMeeting.ItemId}&questReq=yes&displayName={skypeMeeting.DisplayName}";
            }
            else
            {
                if (skypeMeeting.IsSkypeClient)
                {
                    skypeMeeting.Url = "conf:sip:" + skypeMeeting.Url;
                }
            }

            return(Ok(skypeMeeting));
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the meeting join URL.
        /// </summary>
        /// <param name="itemId">The item identifier.</param>
        /// <returns>meeting join URI</returns>
        public static string GetMeetingJoinUrl(string itemId)
        {
            ListItem item = SharePointRepository.GetMeetingUriDetails(itemId);

            return(Convert.ToString(item["JoinURL"]));
        }