Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            VisitTime visitTime = db.VisitTimes.Find(id);

            db.VisitTimes.Remove(visitTime);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public virtual void DeleteVisitTime(int visitNumber)
        {
            VisitTime _vt = (from vt in sc.Timetables
                             where vt.Id == visitNumber
                             select vt).FirstOrDefault();

            sc.Timetables.Remove(_vt);
            sc.SaveChanges();
        }
Esempio n. 3
0
        public ActionResult PatientViewDeleteConfirmed(int id)
        {
            VisitTime visitTime = db.VisitTimes.Find(id);
            int       patientId = visitTime.PatientId;

            db.VisitTimes.Remove(visitTime);
            db.SaveChanges();
            return(RedirectToAction("Main", "Patients", new { id = patientId }));
        }
        public string CheckOrder(OrderInfo orderInfo, VisitTime visit)
        {
            string result = string.Empty;

            try
            {
                this._httpItem.URL               = "http://www.zj12580.cn/order/check";
                this._httpItem.ResultType        = ResultType.String;
                this._httpItem.Method            = "POST";
                this._httpItem.Allowautoredirect = false;
                this._httpItem.PostEncoding      = System.Text.Encoding.UTF8;
                this._httpItem.Postdata          = string.Format(this.m_orderInfo.CheckOrderPost, new object[]
                {
                    visit.NumId,
                    visit.Time,
                    visit.Index,
                    string.Concat(new string[]
                    {
                        visit.NumId,
                        ",",
                        visit.Time,
                        ",",
                        visit.Index
                    })
                });
                this._httpItem.ContentType = "application/x-www-form-urlencoded";
                HttpResult html = this._httpHelper.GetHtml(this._httpItem);
                if (html.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    this._htmlDoc.LoadHtml(html.Html);
                    HtmlNode htmlNode = this._htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[@id='middle']/div[@class='m_b']");
                    if (htmlNode != null)
                    {
                        HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("div[@class='m_r']/input");
                        if (htmlNodeCollection != null && htmlNodeCollection.Count == 15)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            for (int i = 0; i < 15; i++)
                            {
                                stringBuilder.Append(htmlNodeCollection[i].GetAttributeValue("name", ""));
                                stringBuilder.Append("=");
                                stringBuilder.Append(htmlNodeCollection[i].GetAttributeValue("value", ""));
                                stringBuilder.Append("&");
                            }
                            result = stringBuilder.ToString();
                        }
                    }
                }
            }
            catch (System.Exception err)
            {
                Log.WriteError("订单确认失败", err);
            }
            return(result);
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "Id,Date,DoctorId,PatientId")] VisitTime visitTime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visitTime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DoctorId  = new SelectList(db.Doctors, "Id", "Name", visitTime.DoctorId);
     ViewBag.PatientId = new SelectList(db.Patients, "Id", "Name", visitTime.PatientId);
     return(View(visitTime));
 }
Esempio n. 6
0
        public string FormatTime(VisitTime time)
        {
            var result = $"{time.Hour}:";

            if (time.Minute < 10)
            {
                result += $"0{time.Minute}";
            }
            else
            {
                result += time.Minute;
            }
            return(result);
        }
Esempio n. 7
0
        public ActionResult PatientViewDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitTime visitTime = db.VisitTimes.Find(id);

            if (visitTime == null)
            {
                return(HttpNotFound());
            }
            return(View(visitTime));
        }
Esempio n. 8
0
        // GET: VisitTimes/Create
        public ActionResult Create(DateTime Date, int DoctorId)
        {
            var doctor = (from d in db.Doctors
                          where d.Id == DoctorId
                          select d).First();

            VisitTime vt = new VisitTime()
            {
                Date   = Date,
                Doctor = doctor
            };

            return(View(vt));
        }
Esempio n. 9
0
        // GET: VisitTimes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitTime visitTime = db.VisitTimes.Find(id);

            if (visitTime == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DoctorId  = new SelectList(db.Doctors, "Id", "Name", visitTime.DoctorId);
            ViewBag.PatientId = new SelectList(db.Patients, "Id", "Name", visitTime.PatientId);
            return(View(visitTime));
        }
Esempio n. 10
0
        private void Callback(object state)
        {
            Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                  () =>
            {
                if (TimeStuck != null)
                {
                    var offset = TimeStuck(this);
                    if (!(VisitTime.Subtract(DateTime.Now) <= offset) || offset == TimeSpan.Zero)
                    {
                        if (!Inside)
                        {
                            var ts = VisitTime.Subtract(DateTime.Now);
                            if (ts.Ticks <= 0)
                            {
                                TimerTime = DateTime.Now.Subtract(VisitTime);
                                Inside    = true;
                                ImagePath = "Assets/doctor.jpeg";
                            }
                            else
                            {
                                TimerTime = ts;
                            }
                        }

                        if (Inside)
                        {
                            TimerTime = TimerTime.Add(TimeSpan.FromMilliseconds(TIME_INTERVAL_IN_MILLISECONDS));
                            if (TimerTime.Ticks >= Duration.Ticks)
                            {
                                PatientInfo     = "Wizyta się przedłuża";
                                BackgroundBrush = new SolidColorBrush(Colors.Orange);
                            }
                        }
                    }
                    else
                    {
                        TimerTime = offset;
                    }
                    _timer.Change(TIME_INTERVAL_IN_MILLISECONDS, Timeout.Infinite);
                }
            });
        }
Esempio n. 11
0
        public virtual void AddVisitToDoctor(DateTime _dt, string _licenceNumber, string _peselNumber)
        {
            var patient = (from pat in sc.Patients
                           where pat.PESELNumber == _peselNumber
                           select pat).FirstOrDefault();

            var doctor = (from dr in sc.Doctors
                          where dr.LicenceNumber == _licenceNumber
                          select dr).FirstOrDefault();

            VisitTime vt = new VisitTime
            {
                Date    = _dt,
                Doctor  = doctor,
                Patient = patient
            };

            sc.Timetables.Add(vt);
            sc.SaveChanges();
        }
        private List <DataGridElement> CreateDataGridSource(bool doctorsFilter, bool customersFilter)
        {
            List <DataGridElement> elements = new List <DataGridElement>();
            List <Visits>          visits   = new List <Visits>();

            if (doctorsFilter)
            {
                visits = _context.Visits
                         .Where(visit => visit.DoctorId == _doctors[FilterDropDown.SelectedIndex].DoctorId)
                         .ToList();
            }
            else if (customersFilter)
            {
                visits = _context.Visits
                         .Where(visit => visit.ClientId == _customers[FilterDropDown.SelectedIndex].ClientId)
                         .ToList();
            }
            else
            {
                visits = _context.Visits.ToList();
            }
            foreach (Visits visit in visits)
            {
                Clients   client   = _context.Clients.Where(x => x.ClientId == visit.ClientId).FirstOrDefault();
                Doctors   doctor   = _context.Doctors.Where(x => x.DoctorId == visit.DoctorId).FirstOrDefault();
                Locations location = _context.Locations.Where(x => x.LocationId == visit.LocationId).FirstOrDefault();
                VisitTime time     = _context.VisitTime.Where(x => x.VisitTimeId == visit.VisitTimeId).FirstOrDefault();
                elements.Add(new DataGridElement
                {
                    clientName = $"{client.Name} {client.LastName}",
                    doctorName = $"{doctor.Name} {doctor.LastName}",
                    location   = location.Name,
                    from       = time.From.ToString(@"hh\:mm"),
                    to         = time.To.ToString(@"hh\:mm")
                });
            }
            ;
            return(elements);
        }
Esempio n. 13
0
        public ActionResult Create([Bind(Include = "Date,DoctorId")] VisitTime visitTime)
        {
            int patientId;

            using (Verification v = new Verification(Request))
            {
                patientId = v.GetCurrentUserID();
            }

            var patient = (from p in db.Patients
                           where p.Id == patientId
                           select p).First();

            var doctor = (from d in db.Doctors
                          where d.Id == visitTime.DoctorId
                          select d).First();

            visitTime.Doctor  = doctor;
            visitTime.Patient = patient;
            db.VisitTimes.Add(visitTime);
            db.SaveChanges();

            return(RedirectToAction("Main", "Patients", new { id = patientId }));
        }
 public string CheckOrder(OrderInfo orderInfo, VisitTime visit)
 {
     string result = string.Empty;
     try
     {
         this._httpItem.URL = "http://www.zj12580.cn/order/check";
         this._httpItem.ResultType = ResultType.String;
         this._httpItem.Method = "POST";
         this._httpItem.Allowautoredirect = false;
         this._httpItem.PostEncoding = System.Text.Encoding.UTF8;
         this._httpItem.Postdata = string.Format(this.m_orderInfo.CheckOrderPost, new object[]
         {
             visit.NumId,
             visit.Time,
             visit.Index,
             string.Concat(new string[]
             {
                 visit.NumId,
                 ",",
                 visit.Time,
                 ",",
                 visit.Index
             })
         });
         this._httpItem.ContentType = "application/x-www-form-urlencoded";
         HttpResult html = this._httpHelper.GetHtml(this._httpItem);
         if (html.StatusCode == System.Net.HttpStatusCode.OK)
         {
             this._htmlDoc.LoadHtml(html.Html);
             HtmlNode htmlNode = this._htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[@id='middle']/div[@class='m_b']");
             if (htmlNode != null)
             {
                 HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("div[@class='m_r']/input");
                 if (htmlNodeCollection != null && htmlNodeCollection.Count == 15)
                 {
                     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                     for (int i = 0; i < 15; i++)
                     {
                         stringBuilder.Append(htmlNodeCollection[i].GetAttributeValue("name", ""));
                         stringBuilder.Append("=");
                         stringBuilder.Append(htmlNodeCollection[i].GetAttributeValue("value", ""));
                         stringBuilder.Append("&");
                     }
                     result = stringBuilder.ToString();
                 }
             }
         }
     }
     catch (System.Exception err)
     {
         Log.WriteError("订单确认失败", err);
     }
     return result;
 }
 public OrderInfo GetQueryRegTime(string query)
 {
     this.m_orderInfo.Clear();
     try
     {
         this._httpItem.URL = query;
         this._httpItem.ResultType = ResultType.String;
         this._httpItem.Method = "GET";
         this._httpItem.Postdata = string.Empty;
         this._httpItem.ContentType = "text/html";
         this._httpItem.Allowautoredirect = false;
         HttpResult html = this._httpHelper.GetHtml(this._httpItem);
         if (html.RedirectUrl.Length == 0)
         {
             this._htmlDoc.LoadHtml(html.Html);
             HtmlNode htmlNode = this._htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[@id='middle']/div[@class='m_b']");
             if (htmlNode != null)
             {
                 this.m_orderInfo.User = this.m_userInfo;
                 this.m_orderInfo.ResResult = ResponseReuslt.SUCCESS;
                 HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("div[@class='m_l']/div[@class='m_l_1']/div[@class='con_r']/p");
                 if (htmlNodeCollection != null && htmlNodeCollection.Count == 3)
                 {
                     this.m_orderInfo.Doctor.Name = htmlNodeCollection[0].InnerHtml.Trim();
                     this.m_orderInfo.Doctor.HospitalName = htmlNodeCollection[2].InnerHtml.Trim();
                 }
                 HtmlNode htmlNode2 = htmlNode.SelectSingleNode("input[@name='hosId']");
                 if (htmlNode2 != null)
                 {
                     this.m_orderInfo.Doctor.HospitalId = htmlNode2.GetAttributeValue("value", "");
                 }
                 HtmlNodeCollection htmlNodeCollection2 = htmlNode.SelectNodes("input");
                 if (htmlNodeCollection2 != null && htmlNodeCollection2.Count == 14)
                 {
                     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                     stringBuilder.Append("numId={0}&resTime={1}&resNumber={2}&");
                     for (int i = 3; i < 14; i++)
                     {
                         stringBuilder.Append(htmlNodeCollection2[i].GetAttributeValue("name", ""));
                         stringBuilder.Append("=");
                         stringBuilder.Append(htmlNodeCollection2[i].GetAttributeValue("value", ""));
                         stringBuilder.Append("&");
                     }
                     stringBuilder.Append("num={3}");
                     this.m_orderInfo.CheckOrderPost = stringBuilder.ToString();
                 }
                 HtmlNodeCollection htmlNodeCollection3 = htmlNode.SelectNodes("div[@class='m_l']/div[@class='m_l_2']/p/span");
                 if (htmlNodeCollection3 != null && htmlNodeCollection3.Count == 3)
                 {
                     this.m_orderInfo.Fee = htmlNodeCollection3[0].InnerHtml.Trim();
                     this.m_orderInfo.Doctor.Department = htmlNodeCollection3[1].InnerHtml.Trim();
                     this.m_orderInfo.VisitDate = htmlNodeCollection3[2].InnerHtml.Trim().Replace("&nbsp;", " ");
                 }
                 HtmlNodeCollection htmlNodeCollection4 = htmlNode.SelectNodes("div[@class='m_r']/div[@class='m_r_1']/table/tr/td/input");
                 if (htmlNodeCollection4 == null)
                 {
                     this.m_orderInfo.ResResult = ResponseReuslt.ERROR_PARSE;
                     return m_orderInfo;
                 }
                 using (System.Collections.Generic.IEnumerator<HtmlNode> enumerator = ((System.Collections.Generic.IEnumerable<HtmlNode>)htmlNodeCollection4).GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         HtmlNode current = enumerator.Current;
                         string[] array = current.GetAttributeValue("value", "").Split(new char[]
                         {
                             ','
                         });
                         if (array != null && array.Length == 3)
                         {
                             VisitTime visitTime = new VisitTime();
                             visitTime.Index = array[2];
                             visitTime.NumId = array[0];
                             visitTime.Time = array[1];
                             this.m_orderInfo.VisitTimes.Add(visitTime);
                         }
                     }
                 }
             }
         }
         else
         {
             this.m_orderInfo.ResResult = ResponseReuslt.NON_LOGIN;
         }
     }
     catch (System.Exception err)
     {
         Log.WriteError("获取预约订单信息失败", err);
         this.m_orderInfo.ResResult = ResponseReuslt.ERROR_UNKNOW;
     }
     return this.m_orderInfo;
 }
 public OrderInfo GetQueryRegTime(string query)
 {
     this.m_orderInfo.Clear();
     try
     {
         this._httpItem.URL               = query;
         this._httpItem.ResultType        = ResultType.String;
         this._httpItem.Method            = "GET";
         this._httpItem.Postdata          = string.Empty;
         this._httpItem.ContentType       = "text/html";
         this._httpItem.Allowautoredirect = false;
         HttpResult html = this._httpHelper.GetHtml(this._httpItem);
         if (html.RedirectUrl.Length == 0)
         {
             this._htmlDoc.LoadHtml(html.Html);
             HtmlNode htmlNode = this._htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[@id='middle']/div[@class='m_b']");
             if (htmlNode != null)
             {
                 this.m_orderInfo.User      = this.m_userInfo;
                 this.m_orderInfo.ResResult = ResponseReuslt.SUCCESS;
                 HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("div[@class='m_l']/div[@class='m_l_1']/div[@class='con_r']/p");
                 if (htmlNodeCollection != null && htmlNodeCollection.Count == 3)
                 {
                     this.m_orderInfo.Doctor.Name         = htmlNodeCollection[0].InnerHtml.Trim();
                     this.m_orderInfo.Doctor.HospitalName = htmlNodeCollection[2].InnerHtml.Trim();
                 }
                 HtmlNode htmlNode2 = htmlNode.SelectSingleNode("input[@name='hosId']");
                 if (htmlNode2 != null)
                 {
                     this.m_orderInfo.Doctor.HospitalId = htmlNode2.GetAttributeValue("value", "");
                 }
                 HtmlNodeCollection htmlNodeCollection2 = htmlNode.SelectNodes("input");
                 if (htmlNodeCollection2 != null && htmlNodeCollection2.Count == 14)
                 {
                     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                     stringBuilder.Append("numId={0}&resTime={1}&resNumber={2}&");
                     for (int i = 3; i < 14; i++)
                     {
                         stringBuilder.Append(htmlNodeCollection2[i].GetAttributeValue("name", ""));
                         stringBuilder.Append("=");
                         stringBuilder.Append(htmlNodeCollection2[i].GetAttributeValue("value", ""));
                         stringBuilder.Append("&");
                     }
                     stringBuilder.Append("num={3}");
                     this.m_orderInfo.CheckOrderPost = stringBuilder.ToString();
                 }
                 HtmlNodeCollection htmlNodeCollection3 = htmlNode.SelectNodes("div[@class='m_l']/div[@class='m_l_2']/p/span");
                 if (htmlNodeCollection3 != null && htmlNodeCollection3.Count == 3)
                 {
                     this.m_orderInfo.Fee = htmlNodeCollection3[0].InnerHtml.Trim();
                     this.m_orderInfo.Doctor.Department = htmlNodeCollection3[1].InnerHtml.Trim();
                     this.m_orderInfo.VisitDate         = htmlNodeCollection3[2].InnerHtml.Trim().Replace("&nbsp;", " ");
                 }
                 HtmlNodeCollection htmlNodeCollection4 = htmlNode.SelectNodes("div[@class='m_r']/div[@class='m_r_1']/table/tr/td/input");
                 if (htmlNodeCollection4 == null)
                 {
                     this.m_orderInfo.ResResult = ResponseReuslt.ERROR_PARSE;
                     return(m_orderInfo);
                 }
                 using (System.Collections.Generic.IEnumerator <HtmlNode> enumerator = ((System.Collections.Generic.IEnumerable <HtmlNode>)htmlNodeCollection4).GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         HtmlNode current = enumerator.Current;
                         string[] array   = current.GetAttributeValue("value", "").Split(new char[]
                         {
                             ','
                         });
                         if (array != null && array.Length == 3)
                         {
                             VisitTime visitTime = new VisitTime();
                             visitTime.Index = array[2];
                             visitTime.NumId = array[0];
                             visitTime.Time  = array[1];
                             this.m_orderInfo.VisitTimes.Add(visitTime);
                         }
                     }
                 }
             }
         }
         else
         {
             this.m_orderInfo.ResResult = ResponseReuslt.NON_LOGIN;
         }
     }
     catch (System.Exception err)
     {
         Log.WriteError("获取预约订单信息失败", err);
         this.m_orderInfo.ResResult = ResponseReuslt.ERROR_UNKNOW;
     }
     return(this.m_orderInfo);
 }
Esempio n. 17
0
 public override string ToString()
 {
     return($"{VisitTime.ToString("yyyy-MM-dd HH:mm")}");
 }