/// <summary> /// Bind dannh sách Công văn đi /// </summary> private void BindDataUser() { BUser ctl = new BUser(); string _fullname = ""; string _username = ""; string _email = ""; string _status = UserStatus.Approve.ToString("D"); int _departmentid = int.Parse(ddlDepartment.SelectedValue); //--Set key tìm kiếm if (txtKeySearch.Text.Trim().Length > 0) { _username = txtKeySearch.Text.Trim(); _fullname = txtKeySearch.Text.Trim(); _email = txtKeySearch.Text.Trim(); } int count = ctl.GetCount(_fullname, _username, _email, _departmentid, _status, "", ""); if (count > 0) { lbsUserSearch.Visible = true; lbsUserSearch.DataSource = ctl.Get(_fullname, _username, _email, _departmentid, _status, "DESC", "UserId", 1, 100); lbsUserSearch.DataBind(); } else { lbsUserSearch.Visible = false; } }
/// <summary> /// Bind dannh sách người dùng /// </summary> private void BindData() { BUser ctl = new BUser(); string _fullname = ""; string _username = ""; string _email = ""; string _status = ""; int _departmentid = int.Parse(ddlDepartment.SelectedValue); //--Set key tìm kiếm if (txtKey.Text.Trim().Length > 0) { switch (ddlColumnName.SelectedValue) { case "Username": _username = txtKey.Text.Trim(); break; case "Fullname": _fullname = txtKey.Text.Trim(); break; case "Email": _email = txtKey.Text.Trim(); break; } } int count = ctl.GetCount(_fullname, _username, _email, _departmentid, _status, "", ""); ctlPagging.PageSize = int.Parse(ddlPageSize.SelectedValue); spResultCount.InnerHtml = "Tìm thấy <b>" + count.ToString() + "</b> kết quả"; if (count > ctlPagging.PageSize) { ctlPagging.Visible = true; } else { ctlPagging.Visible = false; } grvListUsers.DataSource = ctl.Get(_fullname, _username, _email, _departmentid, _status, "DESC", "UserId", CurrentPage, ctlPagging.PageSize); grvListUsers.DataBind(); ctlPagging.CurrentIndex = CurrentPage; ctlPagging.ItemCount = count; ctlPagging.QueryStringParameterName = GenarateParam(); }