コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectUtil.RedirectUnauthenticatedUserToLoginPage();
            RedirectUtil.RedirectNonAdminUserToHomePage();

            BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>()
            {
                new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"),
                new BreadCrumb(NavUtil.GetUsersPageUrl(), "Users", IsActive: true),
            });

            var items = new List <HyperlinkListPanelItem>();

            var divisionService = ServiceFactory.DivisionService;

            var accountUtil = new AccountUtil(Context);

            foreach (var user in new AccountUtil(Context).GetAllUsers().OrderBy(u => u.UserName))
            {
                string role = (accountUtil.IsUserAnAdmin(user.Id) ? "Administrator" : "");
                role = (accountUtil.IsUserASuperuser(user.Id) ? "Superuser" : role);

                items.Add(new HyperlinkListPanelItem(
                              URL: NavUtil.GetUpdateUserPageUrl(user.Id),
                              Heading: user.UserName + (!String.IsNullOrWhiteSpace(role) ? " (" + role + ")" : ""),
                              Text: user.Email));
            }

            HyperlinkListPanelRenderer.Render(usersList, new HyperlinkListPanelConfig("Users", items));
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectUtil.RedirectUnauthenticatedUserToLoginPage();
            RedirectUtil.RedirectNonAdminUserToHomePage();

            BreadCrumbUtil.DataBind(Page, new List <BreadCrumb>()
            {
                new BreadCrumb(NavUtil.GetHomePageUrl(), "Home"),
                new BreadCrumb(NavUtil.GetUsersPageUrl(), "Users"),
                new BreadCrumb(NavUtil.GetUpdateUserPageUrl(GetUserId()), "Update User", IsActive: true),
            });

            this.accountUtil = new AccountUtil(Context);

            labelCannotDeleteUser.Visible = false;

            labelPageTitle.Text       = "Update the User";
            labelPageDescription.Text = "Use the form below to update the user.";

            userForm.GetSubmitButton().Click += new EventHandler(btnUpdateUser_Click);
            userForm.GetCancelButton().Click += new EventHandler(btnCancel_Click);
        }