コード例 #1
0
        private void submit_Click(object sender, EventArgs e)
        {
            if (speciality.Text == "" || textBox1.Text == "")//validation part
            {
                MessageBox.Show("Please, insert all values");
            }
            else
            {
                patientlogin p    = new patientlogin();
                int          pid  = p.getPID();
                var          date = DateTime.Now;
                var          day  = DateTime.Today;
                string       a    = "ddsf";

                int r = controllerObj.Addquestion(QID, pid, speciality.Text.ToString(), day, Convert.ToInt16(date.ToString("hh")), Convert.ToInt16(date.ToString("mm")), textBox1.Text.ToString());
                if (r > 0)
                {
                    MessageBox.Show("question added successfully");
                    Patient_Functionalities menu = new Patient_Functionalities();
                    menu.Show();
                }
                else
                {
                    MessageBox.Show("Insertion Failed");
                }
            }
        }
コード例 #2
0
ファイル: Reserve.cs プロジェクト: SpartanLines/Projects
        private void button1_Click(object sender, EventArgs e)
        {
            patientlogin p = new patientlogin();

            int         PID     = p.getPID();
            string      theDate = datePicker.Value.ToString("yyyy-MM-dd");
            string      time    = TimePicker.Value.ToString("hh:mm");
            string      day     = datePicker.Value.DayOfWeek.ToString();
            int         h       = Convert.ToInt16(TimePicker.Value.ToString("hh"));
            int         m       = Convert.ToInt16(TimePicker.Value.ToString("mm"));
            reservation r       = new reservation();
            int         docID   = r.getDocID();
            DataTable   Ddays   = controllerObj.docdays(docID, Convert.ToString(hospitals.Text));
            DataTable   Dhrs    = controllerObj.dochours(docID, days.Text, hospitals.Text);
            int         c       = Ddays.Rows.Count;
            bool        inday   = false;

            for (int i = 0; i < c; i++)
            {
                if (day == Ddays.Rows[i][0].ToString())
                {
                    inday = true;
                    break;
                }
            }
            if (inday == false)
            {
                MessageBox.Show("Unavailable day");
            }
            else
            {
                if (h >= Convert.ToInt16(Dhrs.Rows[0][0]) && m >= Convert.ToInt16(Dhrs.Rows[0][1]) && h <= Convert.ToInt16(Dhrs.Rows[0][2]))
                {
                    //MessageBox.Show("available slot");
                    int rno = controllerObj.Rnumber();
                    rno++;
                    int res = controllerObj.Reserve(rno, theDate, time, PID, controllerObj.HospID(hospitals.Text), docID, controllerObj.getfees(docID));
                    if (res > 0)
                    {
                        MessageBox.Show("Reservation Successful");
                        patient_main main = new patient_main();
                        main.Show();
                    }
                    else
                    {
                        MessageBox.Show("Sorry this time slot is already reserved");
                    }
                }
                else
                {
                    MessageBox.Show("chosen time not in doctor's working hours");
                }
            }
        }