protected void Button2_Click(object sender, EventArgs e) { Label7.Text = ""; try { if (string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text)) { throw new Exception("First name,Last name cannot be empty"); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Doctor result = linqdbs.GetDoctorInfo(TextBox2.Text, TextBox3.Text); TextBox1.Text = result.Medical_Registration_NO_; DropDownList1.SelectedValue = result.Health_Profession; TextBox4.Text = result.Phone_number.ToString(); TextBox5.Text = result.Email; } catch (Exception ex) { TextBox1.Text = ""; DropDownList1.SelectedValue = ""; TextBox4.Text = ""; TextBox5.Text = ""; Label7.Text = ex.Message; } }
protected void Button1_Click(object sender, EventArgs e) { Label7.Text = ""; try { int n; if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(DropDownList1.SelectedValue) || string.IsNullOrWhiteSpace(TextBox4.Text)) { throw new Exception("Health Insurance NO.,First name,Last name,Health Profession,Phone number cannot be empty"); } else if (!int.TryParse(TextBox4.Text, out n)) { throw new Exception("Phone number shoule be an integer"); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Boolean result = linqdbs.DoctorRegistration(TextBox1.Text, TextBox2.Text, TextBox3.Text, DropDownList1.SelectedValue, Convert.ToInt32(TextBox4.Text), TextBox5.Text); if (result == true) { Label7.Text = "Saved successfully"; } } catch (Exception ex) { Label7.Text = ex.Message; } }
protected void Button1_Click(object sender, EventArgs e) { try { DateTime dt; string dateTime = TextBox5.Text + " " + TextBox6.Text + ":00"; if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text) || string.IsNullOrWhiteSpace(TextBox5.Text) || string.IsNullOrWhiteSpace(TextBox6.Text) || string.IsNullOrWhiteSpace(TextBox7.Text)) { throw new Exception("Patient's name, Doctor's name, Appointment Date, Appointment Time and Clinic Name cannot be empty"); } else if (!DateTime.TryParse(dateTime, out dt)) { throw new Exception("Appointment date format should be: yyyy-MM-dd and appointment time format should be: HH:mm."); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Boolean result = linqdbs.AppointmentBooking(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, Convert.ToDateTime(dateTime), TextBox7.Text); if (result == true) { Label8.Text = "Saved successfully"; } } catch (Exception ex) { Label8.Text = ex.Message; } }
protected void Button2_Click(object sender, EventArgs e) { Label8.Text = ""; try { if (string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text)) { throw new Exception("First name,Last name cannot be empty"); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Patient result = linqdbs.GetPatientInfo(TextBox2.Text, TextBox3.Text); TextBox1.Text = result.Health_Insurance_NO_; TextBox4.Text = result.Phone_number.ToString(); TextBox5.Text = result.Address; TextBox6.Text = result.Email; } catch (Exception ex) { TextBox1.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; Label8.Text = ex.Message; } }
protected void Button2_Click(object sender, EventArgs e) { Label8.Text = ""; DateTime dt; string dateTime = TextBox5.Text + " " + TextBox6.Text; try { if (string.IsNullOrWhiteSpace(TextBox5.Text) || string.IsNullOrWhiteSpace(TextBox6.Text)) { throw new Exception("Appointment Date and Appointment Time cannot be empty"); } else if (!DateTime.TryParse(dateTime, out dt)) { throw new Exception("Appointment date format should be: yyyy/MM/dd and appointment time format should be: HH:mm:ss."); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Boolean result = linqdbs.AppointmentReschedule(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, Convert.ToDateTime(dateTime)); if (result == true) { Label8.Text = "Updated successfully"; } } catch (Exception ex) { Label8.Text = ex.Message; } }
protected void Button1_Click(object sender, EventArgs e) { Label8.Text = ""; try { if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text)) { throw new Exception("Patient's name and Doctor's name cannot be empty"); } LINQDatabaseService linqdbs = new LINQDatabaseService(); Appointment result = linqdbs.GetAppointment(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text); string[] dateTime = result.Appointment_date___time.ToString().Split(' '); TextBox5.Text = dateTime[0]; TextBox6.Text = dateTime[1]; TextBox7.Text = result.Clinic_name; TextBox1.Enabled = false; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; TextBox7.Enabled = false; } catch (Exception ex) { Label8.Text = ex.Message; } }