protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (calendarSelectDate.SelectedDate == null || calendarSelectDate.SelectedDate.Year == 1) { calendarSelectDate.SelectedDate = DateTime.Today; _selectedDate = DateTime.Today; } else { _selectedDate = calendarSelectDate.SelectedDate; } _dao = new SchedulingDao(); UserTO user = _dao.connectAndLogin(_siteCode, _accessCode, _verifyCode); //_dao.connect("901"); //_dao.login("1programmer", "programmer1", ""); HospitalLocationTO clinic = _dao.getClinicSchedulingDetails("12"); PatientTO selectedPatient = _dao.selectPatient(_patient); _ssn = selectedPatient.ssn; labelPatientName.Text = selectedPatient.name; _dao.disconnect(); // just do this once at launch _slots = SchedulingUtils.getItemsFromAvailabilityString (clinic.clinicDisplayStartTime, Convert.ToInt32(clinic.appointmentLength), Convert.ToInt32(clinic.displayIncrements), clinic.availability); Session.Add("SLOTS", _slots); populateDropdown(_slots); } _slots = Session["SLOTS"] as IList <TimeSlot>; }
protected void Click_MakeAppointment(object sender, EventArgs e) { TimeSlot selectedSlot = (Session["FILTERED_SLOTS"] as IList <TimeSlot>)[dropdownAvailableTimes.SelectedIndex]; if (!selectedSlot.Available) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Please choose an available slot only');", true); return; } string dateString = "3" + selectedSlot.Start.ToString("yyMMdd.HHmmss"); try { //esb.appointmentResponse response = new SchedulingDao().makeAppointmentEsb(dateString, "30", "12", _patient, _ssn); //if (response != null) //{ // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Your appointment is set for " + // selectedSlot.Start.ToString("MM/dd") + " at " + selectedSlot.Start.ToString("HH:mm") + // ". Good job.');", true); //} _dao = new SchedulingDao(); UserTO user = _dao.connectAndLogin(_siteCode, _accessCode, _verifyCode); AppointmentTO result = _dao.makeAppointment(_patient, "12", dateString, "N", "", "30", "9"); _dao.disconnect(); if (result.fault == null) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Your appointment is set for " + selectedSlot.Start.ToString("MM/dd") + " at " + selectedSlot.Start.ToString("HH:mm") + ". Good job.');", true); } } catch (Exception exc) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + exc.Message + "')", true); } }