Пример #1
0
    protected void SearchUsers_Click(object sender, EventArgs e)
    {
        RegistrationService.RegistrationService registrationService = ServiceAccess.GetInstance().GetRegistration();


        RegistrationService.UserRole userRole = (RegistrationService.UserRole)Convert.ToInt32(RoleDropDownList.SelectedValue);
        string firstName = FirstNameTextBox.Text;
        string lastName  = LastNameTextBox.Text;
        string userName  = UserNameTextBox.Text;

        try
        {
            RegistrationService.RegistrationInfo[] searchResults = registrationService.GetUsersList(userRole, firstName, lastName, userName);
            SearchUsersResultGridView.DataSource = searchResults;
            SearchUsersResultGridView.DataBind();
            ViewState["dataSource"]     = searchResults;
            SearchCriteriaPanel.Visible = false;
            SearchResultsPanel.Visible  = true;
            ResultCountLiteral.Text     = "Users result - " + searchResults.Length + " users found";
        }
        catch (Exception ex)
        {
            log.Error("Error searching Users", ex);
            ErrorLiteral.Text = "Error searching Users";
        }
    }
Пример #2
0
    protected void SetPermissions(object sender, GridViewRowEventArgs e)
    {
        // Get the logged in account information.
        RegistrationService.LoginInfo loginInfo =
            (RegistrationService.LoginInfo)Session["loginInfo"];
        RegistrationService.RegistrationInfo regInfo  = (RegistrationService.RegistrationInfo)e.Row.DataItem;
        RegistrationService.UserRole         userRole = (RegistrationService.UserRole)Convert.ToInt32(RoleDropDownList.SelectedValue);
        string firstName = FirstNameTextBox.Text;
        string lastName  = LastNameTextBox.Text;
        string userName  = UserNameTextBox.Text;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string rowuserRole   = ((Label)e.Row.FindControl("RoleLabel")).Text;
            string rowuserStatus = ((Label)e.Row.FindControl("StatusLabel")).Text;

            ((HyperLink)e.Row.FindControl("EditUserHyperLink")).NavigateUrl =
                "~/Members/ModifyUser.aspx?UserId=" + regInfo.UserId + "&PageName=SearchUsers.aspx" +
                "&selectedCriteria=" + userRole + "|" + firstName + "|" + lastName + "|" + userName;

            ((HyperLink)e.Row.FindControl("UserNameHyperLink")).NavigateUrl =
                "~/Members/ViewUser.aspx?UserId=" + regInfo.UserId + "&PageName=SearchUsers.aspx" +
                "&selectedCriteria=" + userRole + "|" + firstName + "|" + lastName + "|" + userName;

            if (loginInfo.Role == RegistrationService.UserRole.CSR)
            {
                if (rowuserRole != RegistrationService.UserRole.Agent.ToString())
                {
                    ((HyperLink)e.Row.FindControl("EditUserHyperLink")).Enabled = false;
                    ((HyperLink)e.Row.FindControl("UserNameHyperLink")).Enabled = false;
                }
            }
            else
            if (loginInfo.Role == RegistrationService.UserRole.Printer)
            {
                SearchUsersResultGridView.Columns[0].Visible = false;
                ((HyperLink)e.Row.FindControl("UserNameHyperLink")).Visible = false;
                ((Label)e.Row.FindControl("UserNameLabel")).Visible         = true;
            }

            if (rowuserStatus == "ApprovalRequired")
            {
                ((Label)e.Row.FindControl("StatusLabel")).Text = "Approval Required";
            }
        }
    }