Пример #1
0
 private void LoadUsers()
 {
     try
     {
         ds = _User.SelectAllUsers();
         GvUsers.DataSource = ds.Tables["Users"];
         GvUsers.DataBind();
     }
     catch (Exception ex)
     {
         _Security.ErrorDesscription = ex.Message;
         _Security.ErrorModule       = "Loading users";
         _Security.SaveError();
     }
 }
Пример #2
0
 protected void DsUserInfo_Updated(object sender, SqlDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         e.Command.Transaction.Rollback();
         LblError.Text      = "An error has occured during the updating, username and email cannot be null and must be unique.";
         LblError.Visible   = true;
         e.ExceptionHandled = true;
     }
     else
     {
         e.Command.Transaction.Commit();
         GvUsers.DataBind();
         LblError.Text    = "Record successfully updated.";
         LblError.Visible = true;
     }
 }
Пример #3
0
        protected void txtHalaman_TextChanged(object sender, EventArgs e)
        {
            GridViewRow rowPager   = GvUsers.BottomPagerRow;
            TextBox     txtHalaman = (TextBox)(rowPager.Cells[0].FindControl("txtHalaman"));

            try
            {
                if (int.Parse(txtHalaman.Text) <= GvUsers.PageCount + 1 && int.Parse(txtHalaman.Text) > 0)
                {
                    GvUsers.PageIndex = (int.Parse(txtHalaman.Text)) - 1;
                    GvUsers.DataBind();
                }
            }
            catch (Exception)
            {
                txtHalaman.Text = (GvUsers.PageIndex + 1).ToString();
            }
        }
Пример #4
0
        private void FillUserDetails()
        {
            DataSet _dsUser = new DataSet();
            string  filter  = " ORDER BY " + SortExpression + " " + SortDirect;

            _dsUser = objDml.GetUserInfo(filter);

            if (_dsUser.Tables["user"].Rows.Count > 0)
            {
                GvUsers.DataSource = _dsUser.Tables["user"];
                GvUsers.DataBind();
            }
            else
            {
                GvUsers.DataSource = null;
                GvUsers.DataBind();
            }
        }
Пример #5
0
    protected void RblRoles_SelectedIndexChanged(object sender, EventArgs e)
    {
        string newRole  = RblRoles.SelectedValue;
        string userName = GvUsers.SelectedDataKey.Values[1].ToString();

        Roles.AddUserToRole(userName, newRole);

        if (RblRoles.SelectedIndex == 0)
        {
            Roles.RemoveUserFromRole(userName, RblRoles.Items[1].Value);
        }
        else
        {
            Roles.RemoveUserFromRole(userName, RblRoles.Items[0].Value);
        }
        DsUsers.DataBind();
        GvUsers.DataBind();
        LblError.Text    = "Role successfully updated.";
        LblError.Visible = true;
    }
Пример #6
0
 protected void btnRefresh_Click(object sender, EventArgs e)
 {
     doFiltering();
     GvUsers.DataBind();
 }