示例#1
0
        protected void YesButton_Click(object sender, EventArgs e)
        {
            //get account id
            string  nric = Session["nric"].ToString();
            Account a    = new Account();

            a = AccountManagementSystem.getAccountViaNRIC(nric);

            int accountID = 1;

            if (a != null)
            {
                accountID = a.accountID;
            }
            int time;

            if (AMPMDropDownList.SelectedValue.ToString() == "PM")
            {
                time = (Convert.ToInt32(HourDropDownList.SelectedValue)) * 10000 + Convert.ToInt32(MinDropDownList.SelectedValue) * 100;
            }
            else
            {
                time = Convert.ToInt32(HourDropDownList.SelectedValue) * 10000 + Convert.ToInt32(MinDropDownList.SelectedValue) * 100;
            }

            //insert values into database and redirect to patientappointment page
            Appointment ap = new Appointment();

            ap.accountID    = accountID;
            ap.facilityID   = Convert.ToInt32(HospitalDropDownList.SelectedValue);
            ap.departmentID = Convert.ToInt32(DepartmentDropDownList.SelectedValue);
            ap.time         = time.ToString();
            ap.date         = DateTextBox.Text; //this was lblActualDate.Text. is this intentional?
            ap.comments     = "Referral - " + CommentTextBox.Text.ToString();
            int result = AppointmentManagementSystem.bookAppointment(ap);

            string id = Session["id"].ToString();

            result = AppointmentManagementSystem.deleteAppointment(id);

            if (result == 1)
            {
                Response.Write("<script type=\"text/javascript\">alert('Appointment Added!');location.href='DoctorAppointmentPage.aspx'</script>");
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Account a = new Account();

            a = (Account)Session["Account"];

            if (a == null)
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (!a.accountType.Equals("Doctor"))
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (Session["nric"] == null)
            {
                Response.Redirect("DoctorAppointmentPage.aspx");
            }
            DateTextBox.Attributes.Add("readonly", "readonly");//prevents textbox from losing text after postback
            if (!IsPostBack)
            {
                //set namedropdownlist names

                string nric = Session["nric"].ToString();

                a            = AccountManagementSystem.getAccountViaNRIC(nric);
                lb_name.Text = a.name;
                lb_id.Text   = a.accountID.ToString();

                //set hospitaldropdownlist
                HospitalDropDownList.DataSource     = FacilityManagementSystem.GetAllfacility();
                HospitalDropDownList.DataTextField  = "facility_name";
                HospitalDropDownList.DataValueField = "facility_id";
                HospitalDropDownList.DataBind();

                HospitalDropDownList.Items.Insert(0, new ListItem("-Select a Hospital-", "-1"));//add blank space at top of droplist
            }
        }