Exemplo n.º 1
0
        protected void FilterDept(object sender, EventArgs e) //action fired after selecting facility
        {
            DepartmentDropDownList.DataSource = DepartmentManagementSystem.getDepartmentsFromThisFacility(FacilityDropDownList.SelectedItem.Value);
            DepartmentDropDownList.DataBind();

            DepartmentDropDownList.Items.Insert(0, new ListItem("(Select a Department)", "-1"));
        }
        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)
            {
                int id = Int32.Parse((string)Session["doc_id"]);

                a = AccountManagementSystem.GetAccount(id);
                txtNric.Attributes.Add("placeholder", a.nric);
                txtName.Attributes.Add("placeholder", a.name);
                txtPassword.Attributes.Add("placeholder", a.password);
                txtEmail.Attributes.Add("placeholder", a.email);
                txtAddress.Attributes.Add("placeholder", a.address);

                Department D = new Department();
                D = DepartmentManagementSystem.GetDepartmentByUserID(id);


                Facility F = new Facility();
                F = FacilityManagementSystem.GetFacility(D.facilityId);

                FacilityDropDownList.DataSource = FacilityManagementSystem.GetAllfacility();
                FacilityDropDownList.DataBind();

                FacilityDropDownList.SelectedValue = F.facilityID.ToString();


                DepartmentDropDownList.DataSource = DepartmentManagementSystem.getDepartmentsFromThisFacility(FacilityDropDownList.SelectedItem.Value);
                DepartmentDropDownList.DataBind();


                DepartmentDropDownList.SelectedValue = D.departmentID.ToString();
            }
        }