コード例 #1
0
        //Upadates any information filled out other than password. Checks to make sure fields are valid.
        //Clears fields when table update completes. Refreshes current info afterwards.
        private void butUpdateInfo_Click(object sender, EventArgs e)
        {
            if (Validation.IsValidEmail(txtEmail.Text))
            {
                SQLQuery.UpdateRow("Patients", "email", txtEmail.Text, condition);
                txtEmail.Clear();
            }
            else if (Validation.IsValidEmail(txtEmail.Text) == false && txtEmail.Text != "")
            {
                MessageBox.Show("Email is not in proper format");
            }

            if (txtZIP.Text != "")
            {
                SQLQuery.UpdateRow("Patients", "zip", txtZIP.Text, condition);
                txtZIP.Clear();
            }
            if (txtAddress.Text != "")
            {
                SQLQuery.UpdateRow("Patients", "address", txtAddress.Text, condition);
                txtAddress.Clear();
            }
            if (txtAge.Text != "")
            {
                SQLQuery.UpdateRow("Patients", "age", txtAge.Text, condition);
                txtAge.Clear();
            }
            else
            {
                MessageBox.Show("You must enter new account information to make changes");
            }
            //MessageBox.Show("Information Updated");
            RefreshInfo();
        }
コード例 #2
0
 //Checks if current password matches and if password is strong enough and new passwords match. Updates table if conditions met.
 //Clears the text boxes if password is reset to prevent spam.
 private void butUpdatePass_Click(object sender, EventArgs e)
 {
     if (SQLQuery.Exists("Patients", "passWord = '******'") == 1)
     {
         if (txtNewPass.Text == txtReEnterPass.Text)
         {
             if (Validation.IsValidPassword(txtNewPass.Text))
             {
                 SQLQuery.UpdateRow("Patients", "passWord", txtNewPass.Text, condition);
                 MessageBox.Show("Password updated");
                 txtCPass.Clear();
                 txtNewPass.Clear();
                 txtReEnterPass.Clear();
             }
         }
         else
         {
             MessageBox.Show("Passwords do not match");
         }
     }
     else if (txtCPass.Text == "")
     {
         MessageBox.Show("Must enter your current password");
     }
     else
     {
         MessageBox.Show("Incorrect Password");
     }
 }
コード例 #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
        //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();
                }
            }
        }