protected void ButtonBookSubmit_Click(object sender, EventArgs e) { string day = this.TextboxBookDate.Text; string time = this.TextboxBookTime.Text; int id = (int)Session["id"]; //needed : check if this is booked WebApplication1.scripts.AppointmentDAO dao = new scripts.AppointmentDAO(); WebApplication1.scripts.Appointment app = new scripts.Appointment(); List <WebApplication1.scripts.Appointment> list = new List <scripts.Appointment>(); list = dao.searchByDay(day); bool booked = false; for (int i = 0; i < list.Count; i++) { if (list[i].getTime() == time) { booked = true; } } if (!booked) { int fees = 100; app.setDay(day); app.setTime(time); app.setId(id); dao.setAppointment(app); //after booking the bill inserted to bills table WebApplication1.scripts.bill Bill = new scripts.bill(); Bill.setID(id); Bill.setBDate(day); Bill.setValue(fees); Bill.setPaid(false); WebApplication1.scripts.billDAO bDao = new scripts.billDAO(); bDao.insertBill(Bill); //redirect to bills Response.Redirect(Page.ResolveClientUrl("../bill/bill.aspx")); } else { ClientScriptManager cs = Page.ClientScript; Type cstype = this.GetType(); String alert = "alert('this time is booked');"; cs.RegisterStartupScript(cstype, "PopupScript", alert, true); } }
protected void Page_Load(object sender, EventArgs e) { WebApplication1.scripts.AppointmentDAO appDao = new scripts.AppointmentDAO(); List <WebApplication1.scripts.Appointment> appointments = new List <scripts.Appointment>(); WebApplication1.scripts.AccountDAO accDao = new scripts.AccountDAO(); DateTime now = DateTime.Now; string today = now.ToString("yyyy-MM-dd"); appointments = appDao.searchByDay(today); for (int i = 0; i < appointments.Count; i++) { TableRow row = new TableRow(); TableCell phoneCell = new TableCell(); TableCell fNameCell = new TableCell(); TableCell lNameCell = new TableCell(); TableCell dayCell = new TableCell(); TableCell timeCell = new TableCell(); TableCell filesCell = new TableCell(); System.Web.UI.WebControls.HyperLink files = new HyperLink(); WebApplication1.scripts.AccountCredentials patient = new scripts.AccountCredentials(); patient = accDao.getAccountById(appointments[i].getId()); phoneCell.Text = patient.getPhoneNumber().ToString(); fNameCell.Text = patient.getFName(); lNameCell.Text = patient.getLName(); dayCell.Text = appointments[i].getDay(); timeCell.Text = appointments[i].getTime(); // see files files.Text = "see files"; files.Attributes.Add("href", "/doctor/patients_files/patients_files.aspx?phone=" + patient.getPhoneNumber()); filesCell.Controls.Add(files); row.Cells.Add(fNameCell); row.Cells.Add(lNameCell); row.Cells.Add(phoneCell); row.Cells.Add(dayCell); row.Cells.Add(timeCell); row.Cells.Add(filesCell); tableBill.Rows.Add(row); } }
protected void Button2_Click(object sender, EventArgs e) { string day = this.TextboxBookDate.Text; WebApplication1.scripts.AppointmentDAO dao = new scripts.AppointmentDAO(); WebApplication1.scripts.Appointment app = new scripts.Appointment(); List <WebApplication1.scripts.Appointment> list = new List <scripts.Appointment>(); list = dao.searchByDay(day); for (int i = 0; i < list.Count; i++) { HtmlGenericControl li = new HtmlGenericControl("li"); tabs.Controls.Add(li); HtmlGenericControl paragraph = new HtmlGenericControl("p"); paragraph.InnerText = list[i].getTime(); li.Controls.Add(paragraph); } }