//Validates the fields to see if patient exists. Creates SQL insert with user text and current date. private void butNote_Click(object sender, EventArgs e) { string FirstName = txtFirstName.Text; string LastName = txtLastName.Text; string condition = "firstName = '" + FirstName + "' AND lastName = '" + LastName + "'"; //If the patient specified by the doctor exists then proceed if (SQLQuery.Exists("Patients", condition) == 1) { object pID = SQLQuery.SingleSelect("pId", "Patients", condition); string Date = DateTime.Now.ToString("MM/dd/yyyy"); string SymptomName = txtSymptomName.Text; string SymptomDetails = txtSymptomDetails.Text; object[] values = new object[5] { (dID), (pID), (Date), (SymptomName), (SymptomDetails) }; SQLQuery.Insert("Medical_History", values); MessageBox.Show("Medical Note Added"); this.Hide(); this.Close(); } else { MessageBox.Show("Invalid First or Last Patient Name"); } }
//Initialize form and fills out fields public ManageDoctor(string Username) { CurrentUser = Username; InitializeComponent(); txtCUser.Text = CurrentUser; condition = ("userName = '******'"); txtCEmail.Text = Convert.ToString(SQLQuery.SingleSelect("Email", "Doctor", condition)); }
//Fills out disabled text boxes with current patient information public void RefreshInfo() { condition = ("userName = '******'"); txtCUser.Text = CurrentUser; txtCAge.Text = Convert.ToString(SQLQuery.SingleSelect("age", "Patients", condition)); txtCEmail.Text = Convert.ToString(SQLQuery.SingleSelect("email", "Patients", condition)); txtCAddress.Text = Convert.ToString(SQLQuery.SingleSelect("address", "Patients", condition)); txtCZIP.Text = Convert.ToString(SQLQuery.SingleSelect("zip", "Patients", condition)); }
//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); }
//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"); } }
//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; } }