Exemplo n.º 1
0
    /// <summary>
    /// When the page loads first the page checks if the admin has proper authentication to access this page, and is redirected to login if not.
    /// Following that, the drop down lists on the page are populated with the appropriate information from the database.
    /// </summary>
    /// <param name="sender">Contains a reference to the control/object that raised the event.</param>
    /// <param name="e">Contains the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        // this is for the client side input values to be retained after the page loads when a validation error is triggered (so the text is not lost)
        string startingPeriodInput = Request.Form["StartingPeriodInput"];
        string endingPeriodInput   = Request.Form["EndingPeriodInput"];

        this.startingInputValue = startingPeriodInput;
        this.endingInputValue   = endingPeriodInput;

        if (Session["securityID"] == null) // Redirect admin to login if not logged in
        {
            Response.Redirect("~/Admin/Login.aspx");
        }
        else if (!IsPostBack) // this is for loading the dropdown lists on the page with the data from the database
        {
            SiteController  siteController = new SiteController();
            List <SitePOCO> siteList       = siteController.GetSiteList(); // get all sites for the sites drop down list
            HospitalDropDownList.DataSource     = siteList;
            HospitalDropDownList.DataValueField = "siteID";
            HospitalDropDownList.DataTextField  = "siteName";
            HospitalDropDownList.DataBind();
            MealController  mealController = new MealController();
            List <MealPOCO> mealList       = mealController.GetMealList(); // get all meals for the meals drop down list
            MealDropDownList.DataSource     = mealList;
            MealDropDownList.DataValueField = "mealID";
            MealDropDownList.DataTextField  = "mealName";
            MealDropDownList.DataBind();
        }
    }
Exemplo n.º 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");
            }
            facilityName = Request.QueryString["q"];
            DateTextBox.Attributes.Add("readonly", "readonly");//prevents textbox from losing text after postback
            if (!IsPostBack)
            {
                //set namedropdownlist names

                //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
                if (facilityName != null)
                {
                    HospitalDropDownList.Items.FindByText(facilityName).Selected = true;
                    HospitalDropDownList_SelectedIndexChanged(null, null);
                }
            }
        }
Exemplo n.º 3
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
            }
        }
Exemplo n.º 4
0
    /// <summary>
    /// Default Web Page Method use to initialize pages and check if the user is logged in.
    /// Initialize drop down lists alert labels
    /// </summary>
    /// <param name="sender">Contains a reference to the control/object that raised the event.</param>
    /// <param name="e">Contains the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        // this is for the client side input values to be retained after the page loads when a validation error is triggered (so the text is not lost)
        string startingPeriodInput = Request.Form["StartingPeriodInput"];
        string endingPeriodInput   = Request.Form["EndingPeriodInput"];

        this.startingInputValue = startingPeriodInput;
        this.endingInputValue   = endingPeriodInput;
        // Redirect user to login if not logged in
        if (Session["securityID"] == null)
        {
            Response.Redirect("~/Admin/Login.aspx");
        }
        else if (!IsPostBack)
        {
            // Initialize Meal Controller, Meal List, Site Controller, and SitePOCO List variable
            MealController  mealController = new MealController();
            List <MealPOCO> mealList       = mealController.GetMealList();
            SiteController  siteController = new SiteController();
            List <SitePOCO> siteList       = siteController.GetSiteList();
            // Initialize Alert Label
            Alert.Visible = false;
            Alert.Text    = "";
            // Iniitalize and setup Meal Drop down list
            MealDropDownList.DataSource     = mealList;
            MealDropDownList.DataValueField = "mealID";
            MealDropDownList.DataTextField  = "mealName";
            MealDropDownList.DataBind();
            // Iniitalize and setup Site/Hospital Drop down list
            HospitalDropDownList.DataSource     = siteList;
            HospitalDropDownList.DataValueField = "siteID";
            HospitalDropDownList.DataTextField  = "siteName";
            HospitalDropDownList.DataBind();
        }
        // Initialize Alert Label
        Alert.Text    = "";
        Alert.Visible = false;
    }