private void LoadOptions() { long lngID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); lblUID.Text = lngID.ToString(); DataClass clsDataClass = new DataClass(); AccessUser clsAccessUser = new AccessUser(); int intGroupID = clsAccessUser.Details(lngID).GroupID; AccessGroup clsAccessGroup = new AccessGroup(clsAccessUser.Connection, clsAccessUser.Transaction); cboGroup.DataTextField = "GroupName"; cboGroup.DataValueField = "GroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List("GroupName", SortOption.Ascending)).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(intGroupID.ToString())); clsAccessUser.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Country clsCountry = new Country(); cboCountry.DataTextField = "CountryName"; cboCountry.DataValueField = "CountryID"; cboCountry.DataSource = clsDataClass.DataReaderToDataTable(clsCountry.List("CountryName", SortOption.Ascending)).DefaultView; cboCountry.DataBind(); cboCountry.SelectedIndex = cboCountry.Items.Count - 1; clsCountry.CommitAndDispose(); AccessGroup clsAccessGroup = new AccessGroup(); cboGroup.DataTextField = "GroupName"; cboGroup.DataValueField = "GroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List("GroupName", SortOption.Ascending)).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; clsAccessGroup.CommitAndDispose(); }
private void LoadList() { AccessGroup clsAccessGroup = new AccessGroup(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "GroupID"; 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); } if (Request.QueryString["Search"] == null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List(SortField, sortoption)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.Search(SearchKey, SortField, sortoption)).DefaultView; } clsAccessGroup.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 LoadList() { AccessGroup clsAccessGroup = new AccessGroup(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "GroupID"; 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); } if (Request.QueryString["Search"]==null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List(SortField,sortoption)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.Search(SearchKey, SortField, sortoption)).DefaultView; } clsAccessGroup.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; }