コード例 #1
0
        private string getdocid()
        {
            string docname = sessionManager.LastName;
            List<Doctor> doctors = new List<Doctor>();
            StringBuilder data = new StringBuilder();
            data.Append(server);
            data.Append("doctorListREST.php");
            data.Append("?u=" + WebUtility.HtmlEncode(sessionManager.UserName.ToString()));
            data.Append("&key=" + WebUtility.HtmlEncode(sessionManager.Key));

            string url = data.ToString();
            Debug.WriteLine(url);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";

            Debug.WriteLine(request.ToString());

            request.Timeout = 50000;

            try
            {
                WebResponse response = request.GetResponse();

                XmlTextReader xmlReader = new XmlTextReader(response.GetResponseStream());

                while (xmlReader.Read())
                {
                    switch (xmlReader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (xmlReader.Name == "Names")
                            {
                                Doctor doc = new Doctor();
                                xmlReader.Read();
                                while (xmlReader.Name != "Names")
                                {
                                    switch (xmlReader.Name)
                                    {

                                        case "DOCID":
                                            doc.DoctorID = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "LastName":
                                            doc.DoctorName = xmlReader.ReadElementContentAsString();
                                            break;

                                        default:
                                            break;
                                    }
                                    xmlReader.Read();
                                }
                                doctors.Add(doc);
                            }
                            break;

                    }
                }

            }
            catch (Exception exp)
            {
                if (exp.Message.Contains("404"))
                {
                    MessageBox.Show("Cannot connect to server.\n  Please try again later.", "Server connection error", MessageBoxButtons.OK);
                }
                else
                {
                    Debug.WriteLine(exp.Message);
                    MessageBox.Show("The program encountered an error.\n  Please try again later.", "Yeah... We didn't plan for this.", MessageBoxButtons.OK);
                }
            }

            foreach (Doctor doc in doctors)
            {
                if (doc.DoctorName == docname)
                {
                    return doc.DoctorID;
                }
            }

            return "";
        }
コード例 #2
0
ファイル: Appointmentcs.cs プロジェクト: cubis/electronic-mis
 public Appointment()
 {
     appTime = new DateTime();
     doc = new Doctor();
 }
コード例 #3
0
ファイル: Reschedule.cs プロジェクト: cubis/electronic-mis
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (dtDate.Value == null || cmbTimes.SelectedItem == null || cmbDocs.SelectedItem == null)
            {
                MessageBox.Show("Please fill out all fields", "Error", MessageBoxButtons.OK);
                return;
            }

            newTime = dtDate.Value;

            //string time = cmbTimes.SelectedItem.ToString().Replace(" AM", "");
            //time = time.Replace(" PM", "");
            DateTime timeObj;
            timeObj = DateTime.Parse(cmbTimes.SelectedItem.ToString());

            newTime = newTime.AddHours(timeObj.TimeOfDay.Hours);
            newTime = newTime.AddMinutes(timeObj.TimeOfDay.Minutes);

            doctor = (Doctor)cmbDocs.SelectedItem;
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
コード例 #4
0
ファイル: Reschedule.cs プロジェクト: cubis/electronic-mis
        public Reschedule(string Server, SessionManager session)
        {
            InitializeComponent();

            server = Server;
            sessionManager = session;

            dtDate.Value = DateTime.Today;

            DateTime timeEntry = DateTime.Parse("7:00");
            while (timeEntry.Hour < 19)
            {
                cmbTimes.Items.Add(timeEntry.ToShortTimeString());
                timeEntry = timeEntry.AddMinutes(15);
            }

            StringBuilder data = new StringBuilder();
            data.Append(server);
            data.Append("doctorListREST.php");
            data.Append("?u=" + WebUtility.HtmlEncode(sessionManager.UserName.ToString()));
            data.Append("&key=" + WebUtility.HtmlEncode(sessionManager.Key));

            string url = data.ToString();
            Debug.WriteLine(url);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";

            Debug.WriteLine(request.ToString());

            request.Timeout = 50000;

            try
            {
                WebResponse response = request.GetResponse();

                XmlTextReader xmlReader = new XmlTextReader(response.GetResponseStream());

                while (xmlReader.Read())
                {
                    switch (xmlReader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (xmlReader.Name == "Names")
                            {
                                Doctor doc = new Doctor();
                                xmlReader.Read();
                                while (xmlReader.Name != "Names")
                                {
                                    switch (xmlReader.Name)
                                    {

                                        case "DOCID":
                                            doc.DoctorID = xmlReader.ReadElementContentAsString();
                                            break;

                                        case "LastName":
                                            doc.DoctorName = xmlReader.ReadElementContentAsString();
                                            break;

                                        default:
                                            break;
                                    }
                                    xmlReader.Read();
                                }
                                doctors.Add(doc);
                            }
                            break;

                    }
                }

            }
            catch (Exception exp)
            {
                if (exp.Message.Contains("404"))
                {
                    MessageBox.Show("Cannot connect to server.\n  Please try again later.", "Server connection error", MessageBoxButtons.OK);
                }
                else
                {
                    Debug.WriteLine(exp.Message);
                    MessageBox.Show("The program encountered an error.\n  Please try again later.", "Yeah... We didn't plan for this.", MessageBoxButtons.OK);
                }
            }

            foreach (Doctor doc in doctors)
            {
                cmbDocs.Items.Add(doc);
            }
        }
コード例 #5
0
ファイル: Reschedule.cs プロジェクト: cubis/electronic-mis
 private void btnCancel_Click(object sender, EventArgs e)
 {
     newTime = new DateTime();
     doctor = null;
     DialogResult = System.Windows.Forms.DialogResult.Cancel;
     Close();
 }