コード例 #1
0
        //Initializes the Menu Patient form and updates labels.
        public MenuPatient(string Username)
        {
            CurrentUser = Username;
            string fname = Convert.ToString(SQLQuery.SingleSelect("firstName", "Patients", "userName = '******'"));

            ID = Convert.ToInt32(SQLQuery.SingleSelect("pId", "Patients", "userName = '******'"));
            InitializeComponent();
            lblWelcome.Text = ("Welcome Back " + fname);
        }
コード例 #2
0
 //Establish connection event. Tests to make sure connection stirng works for SQL Queries.
 private void butConnect_Click(object sender, EventArgs e)
 {
     SQLQuery.servername = txtServer.Text;
     SQLQuery.dbname     = txtDB.Text;
     if (SQLQuery.IsServerConnected() == true)
     {
         this.Hide();
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
         this.Close();
     }
     else if (SQLQuery.IsServerConnected() == false)
     {
         MessageBox.Show("Unable to connect to SQL Database");
     }
 }
コード例 #3
0
        //Checks the email input by the user against the database to see if it exists. Updates the database with temporary password.
        public void CheckSend(string email)
        {
            int countP = SQLQuery.RowCount("email", "Patients", "email=" + "'" + email + "'");
            int countD = SQLQuery.RowCount("Email", "Doctor", "Email=" + "'" + email + "'");

            if (countP == 1)
            {
                string newpass = sendRecoveryEmail(email);
                SQLQuery.UpdateRow("Patients", "passWord", newpass, "email=" + "'" + email + "'");
            }
            if (countD == 1)
            {
                string newpass = sendRecoveryEmail(email);
                SQLQuery.UpdateRow("Doctor", "passWord", newpass, "Email=" + "'" + email + "'");
            }
        }
コード例 #4
0
 //Updates the email and checks for validity in the process
 private void butUpdateEmail_Click(object sender, EventArgs e)
 {
     if (Validation.IsValidEmail(txtEmail.Text))
     {
         SQLQuery.UpdateRow("Doctor", "Email", txtEmail.Text, condition);
         MessageBox.Show("Email updated");
         txtCEmail.Text = Convert.ToString(SQLQuery.SingleSelect("Email", "Doctor", condition));
     }
     else if (Validation.IsValidEmail(txtEmail.Text) == false && txtEmail.Text != "")
     {
         MessageBox.Show("Email is not in proper format");
     }
     else if (txtEmail.Text != "")
     {
         MessageBox.Show("Must enter a new email to change the existing email");
     }
 }
コード例 #5
0
        //When a valid doctor last name has been entered, allow patient to pick a time
        private void txtDoctorLast_TextChanged(object sender, EventArgs e)
        {
            string LastName  = txtDoctorLast.Text;
            string condition = "lastName = '" + LastName + "'";

            if (SQLQuery.Exists("Doctor", condition) == 1)
            {
                datePicker.Enabled = true;
                dID = Convert.ToInt32(SQLQuery.SingleSelect("dID", "Doctor", condition));
            }
            else
            {
                dID = -1;
                datePicker.Enabled = false;
                boxTimes.Enabled   = false;
            }
        }
コード例 #6
0
        //Once a valid doctor, date and time have been selected, appointment will be made.
        private void butMakeAppt_Click(object sender, EventArgs e)
        {
            //Gather variables for validation and insert.
            string subject       = txtSubject.Text;
            string selectedDate  = datePicker.Value.ToShortDateString();
            var    checkedButton = boxTimes.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
            string time          = checkedButton.Text;
            string checkCon      = "date = '" + selectedDate + "' AND dID = '" + dID + "' AND pId = '" + pID + "'";

            //Check to see if the patient has an appointment with that doctor that day.
            if (SQLQuery.Exists("Appointments", checkCon) == 0)
            {
                object[] values = new object[5] {
                    (dID), (pID), (selectedDate), (time), (subject)
                };
                //Insert appointment into database
                SQLQuery.Insert("Appointments", values);

                //Notify user of their selected appointment
                string message = ("Appointment made for: " + selectedDate + ", at " + time + " with Dr." + txtDoctorLast.Text);
                MessageBox.Show(message);
                this.Hide();
                this.Close();
            }

            //Give user the option to reschedule appointment to new time.
            else
            {
                DialogResult dialogResult = MessageBox.Show(
                    "You already have an appointment with this doctor today. " +
                    "\nWould you like to change it to the newly selected time?", "Reschedule Appointment", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    SQLQuery.UpdateRow("Appointments", "time", time, checkCon);
                    string message = ("Appointment made for: " + selectedDate + ", at " + time + " with Dr." + txtDoctorLast.Text);
                    MessageBox.Show(message);
                    this.Hide();
                    this.Close();
                }
            }
        }
コード例 #7
0
 //Updates the table with the scheduled appointments the logged in patient has
 private void butViewAppt_Click(object sender, EventArgs e)
 {
     lblTable.Text = "Appointments";
     string[] ApptCol = new string[] { "lastName", "date", "time", "subject" };
     dtTable.DataSource = SQLQuery.JoinSelectTable(ApptCol, "Appointments", "Doctor", "dID", "pId = '" + ID + "'");
 }
コード例 #8
0
 //Updates the table with medical history information of logged in patient
 private void butNote_Click(object sender, EventArgs e)
 {
     lblTable.Text = "Medical History";
     string[] NoteCol = new string[] { "date", "symptom_Name", "symptom_Desc" };
     dtTable.DataSource = SQLQuery.SelectTable(NoteCol, "Medical_History", "pId = '" + ID + "'");
 }
コード例 #9
0
 //Updates the table with prescription information of logged in patient
 private void butPrescr_Click(object sender, EventArgs e)
 {
     lblTable.Text = "Prescriptions";
     string[] PrescrCol = new string[] { "date", "presc_Name", "presc_instructions" };
     dtTable.DataSource = SQLQuery.SelectTable(PrescrCol, "Prescriptions", "pId = '" + ID + "'");
 }