protected void Page_Load(object sender, EventArgs e) { txtadminname.Text = MyAppointment.username; try { client = new FireSharp.FirebaseClient(config); if (client != null) { //Response.Write("<script>alert('Connection is established')</script>"); } } catch (Exception ex) { Response.Write(ex.Message); } if (MyAppointment.username == null) { Response.Redirect("WebForm4.aspx"); } if (!IsPostBack) { var res1 = client.Get(@"Doctors/"); MyAppointment ResAppointment = res1.ResultAs <MyAppointment>(); if (ResAppointment != null) { counter = ResAppointment.counter; } for (int ii = 1; counter >= ii; ii++) { var res = client.Get(@"Doctors/" + ii); MyAppointment ResAppointment1 = res.ResultAs <MyAppointment>(); DropDownList1.Items.Add(new ListItem(ResAppointment1.Fullname)); } } }
protected void Button1_Click(object sender, EventArgs e) { #region Condition if (string.IsNullOrWhiteSpace(txtusername.Text) || string.IsNullOrWhiteSpace(txtpassword.Text)) { Response.Write("<script>alert('Please Fill All The Field')</script>"); return; } #endregion try { FirebaseResponse res = client.Get(@"Admin/" + txtusername.Text); MyAppointment ResAdmin = res.ResultAs <MyAppointment>(); //database result MyAppointment CurAdmin = new MyAppointment() //USER GIVEN INFO { Username = txtusername.Text, Password = txtpassword.Text }; if (MyAppointment.IsEqual(ResAdmin, CurAdmin)) { Response.Write("<script>alert('Successfully login!')</script>"); Response.Redirect("WebForm5.aspx"); } else { Response.Write("<script>alert('Username and password does not match!')</script>"); } } catch { Response.Write("<script>alert('User does not exist!')</script>"); } }
private void book() { if (email == null)//Prevent unlogged booking { Response.Write("<script>alert('Invalid Booking!')</script>"); } else { timestatus(); if (t91 || t101 || t111 || t121 || t21 || t31 || t41 || t51 == true) { MyAppointment appointment = new MyAppointment() { Doctor = DropDownList1.Text, Date = txtShow.Text, t9 = t9, t10 = t10, t11 = t11, t12 = t12, t2 = t2, t3 = t3, t4 = t4, t5 = t5, }; if (t91 == true) { appointment.t9 = email; slot = "9am"; } else if (t101 == true) { appointment.t10 = email; slot = "10am"; } else if (t111 == true) { appointment.t11 = email; slot = "11am"; } else if (t121 == true) { appointment.t12 = email; slot = "12pm"; } else if (t21 == true) { appointment.t2 = email; slot = "2pm"; } else if (t31 == true) { appointment.t3 = email; slot = "3pm"; } else if (t41 == true) { appointment.t4 = email; slot = "4pm"; } else if (t51 == true) { appointment.t5 = email; slot = "5pm"; } //get counter string cleanEmail = email.Replace(".", string.Empty); var res = client.Get(@"Records/" + cleanEmail); MyRecord ResRecord = res.ResultAs <MyRecord>(); if (ResRecord != null) { counter = ResRecord.counter; counter++; } else { counter = 1; } //record for user string date = DateTime.Now.ToString("dddd, dd MMM yyy HH:mm:ss"); MyRecord record = new MyRecord() { doctor = DropDownList1.Text, date = date, time = slot, email = email, counter = counter, appointment = txtShow.Text }; client.Set(@"Records/" + cleanEmail + "/" + counter, record); client.Set(@"Records/" + cleanEmail + "/" + "counter", counter); Response.Write("<script>alert('Debug save record for user!')</script>"); var set = client.Update(@"Appointments/" + DropDownList1.Text + "/" + txtShow.Text, appointment); Response.Write("<script>alert('Booking Successfully!')</script>"); timestatus(); } else { Response.Write("<script>alert('Pick a timeslot!')</script>"); } } }
protected void Button3_Click(object sender, EventArgs e) { DateTime timeSelect = Calendar1.SelectedDate; string astimeSelect = timeSelect.ToString("dd MMMM yyyy"); information(); if (t91 || t101 || t111 || t121 || t21 || t31 || t41 || t51 == true) { MyAppointment appointment = new MyAppointment() { Doctor = DropDownList1.Text, Date = astimeSelect, t9 = t9, t10 = t10, t11 = t11, t12 = t12, t2 = t2, t3 = t3, t4 = t4, t5 = t5, }; if (t91 == true) { if (t9 == "Available") { appointment.t9 = TextBox2.Text; } else { appointment.t9 = "Available"; } } else if (t101 == true) { if (t10 == "Available") { appointment.t10 = TextBox2.Text; } else { appointment.t10 = "Available"; } } else if (t111 == true) { if (t11 == "Available") { appointment.t11 = TextBox2.Text; } else { appointment.t11 = "Available"; } } else if (t121 == true) { if (t12 == "Available") { appointment.t12 = TextBox2.Text; } else { appointment.t12 = "Available"; } } else if (t21 == true) { if (t2 == "Available") { appointment.t2 = TextBox2.Text; } else { appointment.t2 = "Available"; } } else if (t31 == true) { if (t3 == "Available") { appointment.t3 = TextBox2.Text; } else { appointment.t3 = "Available"; } } else if (t41 == true) { if (t4 == "Available") { appointment.t4 = TextBox2.Text; } else { appointment.t4 = "Available"; } } else if (t51 == true) { if (t5 == "Available") { appointment.t5 = TextBox2.Text; } else { appointment.t5 = "Available"; } } var set = client.Update(@"Appointments/" + DropDownList1.Text + "/" + astimeSelect, appointment); Response.Write("<script>alert('Successfully update!')</script>"); retrieveData(); TextBox2.Text = null; } else { Response.Write("<script>alert('Please select one timeslot!')</script>"); } }