Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     FormsAuthenticationEx.RedirectIfUserNotInRole("~/Default.aspx", "Manager");
     if (!IsPostBack)
     {
         ContractGridView.DataBind();
     }
 }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     FormsAuthenticationEx.RedirectIfUserNotInRole("~/Default.aspx", "Manager");
     if (!IsPostBack)
     {
         // Data-binding on a postback interferes with GridView updates, so don't do it!
         UsersGridView.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            FormsAuthenticationEx.RedirectIfUserNotInRole("~/Default.aspx", "Manager");

            // Only show requests for contracts managed by the currently logged-in manager
            RequestDataSource.Where = "it.Contract.Manager.Email = @email";
            RequestDataSource.WhereParameters.Clear();
            RequestDataSource.WhereParameters.Add("email", DbType.String, User.Identity.Name);

            if (!IsPostBack)
            {
                RequestsGridView.DataBind();
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FormsAuthenticationEx.RedirectIfUserNotInRole("~/Default.aspx", "Staff");

            // Only show the data for the currently logged-in staff member
            StaffDataSource.Where = "it.Email = @Email";
            StaffDataSource.WhereParameters.Clear();
            StaffDataSource.WhereParameters.Add("Email", DbType.String, User.Identity.Name);

            if (!IsPostBack)
            {
                StaffDetailsView.DataBind();
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FormsAuthenticationEx.RedirectIfUserNotInRole("~/Default.aspx", "Client");

            if (!IsPostBack)
            {
                ViewState["ChosenStaff"] = new int[] { 0, 0, 0 };

                using (TpsDbContext tps = new TpsDbContext()) {
                    foreach (var contract in tps.Contracts.Where(c => c.Client.Email == User.Identity.Name))
                    {
                        ContractDropDownList.Items.Add(new ListItem(string.Format("{0} ({1} - {2})",
                                                                                  contract.Position, contract.StartDate.ToShortDateString(), contract.EndDate.ToShortDateString()),
                                                                    contract.ContractID.ToString()));
                    }

                    if (ContractDropDownList.Items.Count == 0)
                    {
                        NoContractsLabel.Visible = true;
                        FormPanel.Visible        = false;
                    }
                }
            }
        }