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("admin"))
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (!IsPostBack)
            {
                String id = (String)Session["fac_id"];

                Facility f = new Facility();
                f = FacilityManagementSystem.GetFacility(id);
                txtName.Attributes.Add("placeholder", f.facilityName);
                txtInfo.Attributes.Add("placeholder", f.generalInfo);
                txtPhoneNumber.Attributes.Add("placeholder", f.phoneNumber.ToString());

                string[] OpeningTimeArray = f.openingHrs.Split(':');
                UpdateOpeninghr.SelectedValue = OpeningTimeArray[0] + ":" + OpeningTimeArray[1];


                string[] ClosingTimeArray = f.closingHrs.Split(':');
                UpdateClosinghr.SelectedValue = ClosingTimeArray[0] + ":" + ClosingTimeArray[1];


                txtAddress.Attributes.Add("placeholder", f.address);
                txtRegion.Attributes.Add("placeholder", f.region);


                listFacility.SelectedValue = f.facilityType;

                List <Department> Deptlist = DepartmentManagementSystem.getDepartments(id);

                //////////////////////////////////////Department can't be deleted because doctor is tied to the department
                for (int i = 0; i < Deptlist.Count; i++)
                {
                    foreach (ListItem listItem in UpdateDepartmentList.Items)
                    {
                        if (listItem.Value.Equals(Deptlist.ElementAt(i).departmentName))
                        {
                            listItem.Selected = true;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void HospitalDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            //set opening and closing label to visible
            if (HospitalDropDownList.SelectedItem.ToString() != "-Select a Hospital-")
            {
                lb_openingHrs.Visible = true;
                lb_closingHrs.Visible = true;
                lblHospital.Visible   = false;
            }
            else
            {
                lb_openingHrs.Visible = false;
                lb_closingHrs.Visible = false;
            }
            lblTime.Text = "";

            DepartmentDropDownList.DataSource     = DepartmentManagementSystem.getDepartments(HospitalDropDownList.SelectedValue.ToString());
            DepartmentDropDownList.DataTextField  = "departmentName";
            DepartmentDropDownList.DataValueField = "departmentID";
            DepartmentDropDownList.DataBind();


            DepartmentDropDownList.Items.Insert(0, new ListItem("(Select a Department)", "-1"));

            //get opening hours and set it
            if (HospitalDropDownList.SelectedValue.ToString() != "-1")
            {
                Facility f = FacilityManagementSystem.getOpeningHrs(HospitalDropDownList.SelectedValue.ToString());
                HourChange("AM");

                AMPMDropDownList.ClearSelection();
                AMPMDropDownList.Items.FindByText(f.openingHrs.Substring(4, 2)).Selected = true;

                lb_actualOpening.Text    = f.generalInfo;
                lb_actualClosing.Text    = f.region;
                lb_actualClosing.Visible = true;
                lb_actualOpening.Visible = true;
            }
            else
            {
                HourDropDownList.Items.Clear();
                HourDropDownList.Items.Insert(0, new ListItem("-Hr-", "-1"));
                MinDropDownList.Items.Clear();
                MinDropDownList.Items.Insert(0, new ListItem("-Min-", "-1"));

                AMPMDropDownList.ClearSelection();

                lb_actualClosing.Visible = false;
                lb_actualOpening.Visible = false;
            }
        }