private void LoadList() { AccessUser clsAccessUser = new AccessUser(); DataClass clsDataClass = new DataClass(); string SortField = "a.UID"; if (Request.QueryString["sortfield"]!=null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"]!=null) { sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } string SearchKey = string.Empty; if (Request.QueryString["Search"] != null) { SearchKey = Server.UrlDecode(Common.Decrypt((string)Request.QueryString["search"],Session.SessionID)); } PageData.DataSource = clsAccessUser.ListAsDataTable(AccessGroupTypes.All, SearchKey, 0, 0, SortField, sortoption).DefaultView; clsAccessUser.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }
private void ApplyToUsers() { Int32 intGroupID = Convert.ToInt32(lblGroupID.Text); AccessRightsDetails clsDetails; AccessUser clsAccessUser = new AccessUser(); DataTable dt = clsAccessUser.ListAsDataTable(AccessGroupTypes.All, string.Empty, 0, intGroupID); AccessRights clsAccessRights = new AccessRights(clsAccessUser.Connection, clsAccessUser.Transaction); foreach (DataRow dr in dt.Rows) { long lngUID = long.Parse(dr["UID"].ToString()); foreach (DataListItem itemAccessCategory in lstAccessCategory.Items) { DataList lstItem = (DataList)itemAccessCategory.FindControl("lstItem"); foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); HtmlInputCheckBox chkRead = (HtmlInputCheckBox)item.FindControl("chkRead"); HtmlInputCheckBox chkWrite = (HtmlInputCheckBox)item.FindControl("chkWrite"); clsDetails = new AccessRightsDetails(); clsDetails.UID = lngUID; clsDetails.TranTypeID = Convert.ToInt16(chkList.Value); clsDetails.Read = chkRead.Checked; clsDetails.Write = chkWrite.Checked; clsAccessRights.Modify(clsDetails); } } } clsAccessUser.CommitAndDispose(); }