private void ShowGroups() { try { user = new clsUsers(); user.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dtGroups = user.GetGroupsList(); dgGroups.DataSource = new DataView(dtGroups); dgGroups.DataBind(); } catch(Exception ex) { throw new Exception(ex.Message, ex); } finally { if(user != null) user.Dispose(); } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if(!IsPostBack) { user = new clsUsers(); user.iOrgId = OrgId; DataTable dtGroups = user.GetGroupsList(); DataRow _row = dtGroups.NewRow(); _row["Id"] = 0; _row["vchDesc"] = "All"; _row["CanDelete"] = false; dtGroups.Rows.Add(_row); DataView dwGroups = new DataView(dtGroups); dwGroups.Sort = "Id asc"; ddlGroups.DataSource = dwGroups; ddlGroups.DataBind(); if(Session["UserFilter"] != null) { uFilter = (UserFilter)Session["UserFilter"]; user.sFirstName = uFilter.sFirstName; user.sLastName = uFilter.sLastName; user.sEmail = uFilter.sEmail; user.iTypeId = uFilter.iTypeId; user.iActiveStatus = uFilter.iActiveStatus; user.iGroupId = uFilter.iGroupId; dgUserList.DataSource = new DataView(user.GetUserList_Filter()); dgUserList.DataBind(); tbFirstName.Text = uFilter.sFirstName; tbLastName.Text = uFilter.sLastName; tbEmail.Text = uFilter.sEmail; ddlUserTypes.SelectedValue = uFilter.iTypeId.ToString(); ddlActiveStatus.SelectedValue = uFilter.iActiveStatus.ToString(); ddlGroups.SelectedValue = uFilter.iGroupId.ToString(); } } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(user!=null) user.Dispose(); } }