Example #1
0
        /// <summary>
        /// Method that get called on Page Load
        /// </summary>
        /// <param name="sender">Event Source</param>
        /// <param name="eventArgument">Event Data</param>
        protected void Page_Load(object sender, EventArgs eventArgument)
        {
            DataProvider.AuthorizeUser();
            MasterPage masterPage = this.Page.Master;
            Header     headerPage = (Header)masterPage;

            headerPage.DisplayDataFromMasterPage(Session["UserName"].ToString());
            Session["EnableProductSelection"] = true;
            bool isPortalAdmin = (bool)Session["isPortalAdmin"];

            if (isPortalAdmin)
            {
                Session["AddAllOption"] = "yes";
            }
            GetMasterPage().FindControl("PanelActionMessage").Visible = false;

            if (!Page.IsPostBack)
            {
                GetRoles();
                GetUserRoles();
            }
            else
            {   // Register the event for Product DropDownList in Master Page.
                DropDownList dropDownListProducts = (DropDownList)headerPage.FindControl("DropDownListProducts");
                dropDownListProducts.SelectedIndexChanged += new EventHandler(DropDownListProductsInMasterPage_SelectedIndexChanged);
            }

            DropDownListRoles.Focus();
        }
        /// <summary>
        /// Gets the Roles
        /// </summary>
        private void GetRoles()
        {
            string roleCategory = "";

            //if (Session["SelectedProduct"].ToString() == "-1")
            //{
            //    roleCategory = "Portal";
            //}
            //else
            //{
            //    roleCategory = "Product";
            //}

            DropDownListRoles.DataSource     = DataProvider.GetRoles("", roleCategory);
            DropDownListRoles.DataTextField  = "ROLE_NAME";
            DropDownListRoles.DataValueField = "ROLE_ID";
            DropDownListRoles.DataBind();
        }
Example #3
0
        /// <summary>
        /// Gets the Roles
        /// </summary>
        private void GetRoles()
        {
            string selectedProduct = Session["SelectedProduct"].ToString();
            string roleCategory    = "Portal";

            if (selectedProduct != "-1")
            {
                roleCategory = "Product";
            }

            SqlDataReader drRoles = DataProvider.GetRoles(null, roleCategory);

            DropDownListRoles.DataValueField = "ROLE_ID";
            DropDownListRoles.DataTextField  = "ROLE_NAME";
            DropDownListRoles.DataSource     = drRoles;
            DropDownListRoles.DataBind();
            drRoles.Close();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Populate the roles
                DropDownListRoles.DataSource = Roles.GetAllRoles();
                DropDownListRoles.DataBind();

                if (ActionType == Constants.Update)
                {
                    UpdateAccountPageHeader.Visible = true;
                    SubmitAccountDetails.Text       = "Update Account";
                    DeleteAccount.Visible           = true;
                    UsernameTextbox.Enabled         = false;

                    if (!string.IsNullOrEmpty(UserName))
                    {
                        MembershipUser currentUser    = Membership.GetUser(UserName);
                        ProfileCommon  currentProfile = new ProfileCommon();

                        currentProfile = Profile.GetProfile(currentUser.UserName);

                        UsernameTextbox.Text            = currentUser.UserName;
                        EmailTextbox.Text               = currentUser.Email;
                        DropDownListRoles.SelectedValue = Roles.GetRolesForUser(UserName).FirstOrDefault();
                        IsActive_RadioButton.Checked    = currentUser.IsApproved;
                        FirstNameTextbox.Text           = currentProfile.FirstName;
                        LastNameTextBox.Text            = currentProfile.LastName;
                        ContactTelNoTextBox.Text        = currentProfile.Phone;
                    }
                }
                else
                {
                    CreateAccountPageHeader.Visible = true;
                    SubmitAccountDetails.Text       = "Create Account";
                }
            }
        }
Example #5
0
 /// <summary>
 /// Method that get called when the Roles DropDownList selection changes
 /// </summary>
 /// <param name="sender">Event Source</param>
 /// <param name="eventArgument">Event Data</param>
 protected void DropDownListRoles_SelectedIndexChanged(object sender, EventArgs eventArgument)
 {
     GetUserRoles();
     DropDownListRoles.Focus();
 }