Exemplo n.º 1
0
        public static string VideoSessionClose(string Id, string duration)
        {
            Hashtable htSearch = new Hashtable();
            DataSet   dsList   = new DataSet();

            double totalMin = 0;

            int hours   = 0;
            int minutes = 0;

            string[] arrDuration = duration.Split(':');

            if (arrDuration != null && arrDuration.Length > 0)
            {
                if (arrDuration.Length > 0)
                {
                    int.TryParse(arrDuration[0], out hours);
                }
                if (arrDuration.Length > 1)
                {
                    int.TryParse(arrDuration[1], out minutes);
                }

                TimeSpan tsHour = TimeSpan.FromHours(hours);
                TimeSpan tsMin  = TimeSpan.FromMinutes(minutes);

                totalMin = tsHour.TotalMinutes + tsMin.TotalMinutes;
            }
            try
            {
                htSearch.Add("flag", 5);
                htSearch.Add("AppointMentId", Id);
                htSearch.Add("Duration", totalMin);
                myonline.Biz.ADM.VideoChat objBiz = null;

                if (System.Web.HttpContext.Current.Session["TimeZone"] != null && Convert.ToString(HttpContext.Current.Session["TimeZone"]) != "-")
                {
                    htSearch.Add("Time", System.Web.HttpContext.Current.Session["TimeZone"]);
                }
                else
                {
                    htSearch.Add("Time", "+5:30");
                }
                objBiz = new myonline.Biz.ADM.VideoChat();
                dsList = objBiz.GetPatient(htSearch);

                if (dsList.Tables["ERR_TABLE"] == null || dsList.Tables["ERR_TABLE"].Rows.Count == 0)
                {
                    UpdateNextAppointment(duration);

                    if (dsList.Tables[0] != null && dsList.Tables[0].Rows.Count > 0)
                    {
                        if (dsList.Tables[0].Rows[0][0].ToString() != "0")
                        {
                            if (dtAppointmentList != null && dtAppointmentList.Rows.Count > 0)
                            {
                                return("1");
                            }
                        }
                        else
                        {
                        }
                    }
                    else if (dsList.Tables[0] == null || dsList.Tables[0].Rows.Count == 0)
                    {
                    }
                }
                else if (dsList.Tables["ERR_TABLE"] != null && dsList.Tables["ERR_TABLE"].Rows.Count != 0)
                {
                }
            }
            catch (Exception ex)
            {
                return("");
            }
            return("");
        }
Exemplo n.º 2
0
        //Manage Next Appointment when consult time cross 15 min
        public static bool UpdateNextAppointment(string duration)
        {
            bool success       = true;
            int  chatValidTime = 15;

            try
            {
                if (dtAppointmentList.Rows.Count > 1)
                {
                    DataTable dt          = dtAppointmentList;
                    string[]  arrDuration = duration.Split(':');

                    double totalMin = 0;

                    int hours   = 0;
                    int minutes = 0;

                    if (arrDuration.Length > 0)
                    {
                        int.TryParse(arrDuration[0], out hours);
                    }
                    if (arrDuration.Length > 1)
                    {
                        int.TryParse(arrDuration[1], out minutes);
                    }

                    TimeSpan tsHour = TimeSpan.FromHours(hours);
                    TimeSpan tsMin  = TimeSpan.FromMinutes(minutes);

                    totalMin = tsHour.TotalMinutes + tsMin.TotalMinutes;

                    if (totalMin > 0)
                    {
                        int nextAppoiintmenDuration = Convert.ToInt32(dt.Rows[0]["NextAppoiintmenDuration"]);

                        if (nextAppoiintmenDuration > 0)
                        {
                            totalMin = totalMin + (chatValidTime - nextAppoiintmenDuration);
                        }

                        Hashtable htSearch = new Hashtable();
                        DataSet   dsList   = new DataSet();
                        myonline.Biz.ADM.VideoChat objBiz = new myonline.Biz.ADM.VideoChat();

                        htSearch.Clear();
                        htSearch.Add("flag", 9);

                        if (totalMin >= 30 && dt.Rows.Count > 1)
                        {
                            htSearch.Add("AppointMentId", Convert.ToString(dt.Rows[1]["id"]));
                            htSearch.Add("Status", 7); //Status - 7 for Approved -Not Completed
                            dsList = objBiz.GetPatient(htSearch);
                        }
                        else if (totalMin > 15 && dt.Rows.Count > 1)
                        {
                            htSearch.Add("AppointMentId", Convert.ToString(dt.Rows[1]["id"]));
                            int      extraMin = (int)(totalMin - chatValidTime);
                            DateTime dtModifiedAppointmentDate = Convert.ToDateTime(dt.Rows[1]["appointdate"]);
                            dtModifiedAppointmentDate = dtModifiedAppointmentDate.AddMinutes(extraMin);
                            htSearch.Add("ModifiedAppointmentDate", dtModifiedAppointmentDate);
                            dsList = objBiz.GetPatient(htSearch);
                        }
                    }
                }
            }
            catch
            {
                success = false;
            }
            return(success);
        }