public void ResetGroups() { ListGroups.Items.Clear(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset(String.Format("SELECT * FROM GROUPS WHERE ID<>{0} ORDER BY DESCRIPTION;", UC.UserGroupId)); ListGroups.DataBind(); }
private void FillListGroups() { ListGroups.Items.Clear(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY ID"); ListGroups.DataBind(); }
public void Page_Load(object sender, EventArgs e) { if (!Login()) { Response.Redirect("/login.aspx"); } else { DeleteGoBack(); if (!Page.IsPostBack) { FillGrid(); ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY ID;"); ListGroups.DataBind(); ViewState["IDGroup"] = "-1"; HelpLabel.Text = FillHelp("HelpMenu"); Submit.Text = Root.rm.GetString("Amntxt2"); } } }
public void SetGroups(string value) { string[] arryD = value.ToString().Split('|'); string query = String.Empty; ListGroups.Items.Clear(); if (ListGroups.Items.Count <= 0) { ListGroups.DataTextField = "Description"; ListGroups.DataValueField = "id"; ListGroups.DataSource = DatabaseConnection.CreateDataset("SELECT * FROM GROUPS ORDER BY DESCRIPTION;"); ListGroups.DataBind(); } foreach (string ut in arryD) { if (ut.Length > 0) { query += "ID=" + ut + " OR "; } } if (query.Length > 6) { query = "AND (" + query.Substring(0, query.Length - 4) + ")"; } string gquery; if (query.Length > 0) { gquery = "SELECT * FROM GROUPS WHERE " + query.Substring(4) + " ORDER BY DESCRIPTION;"; } else { gquery = "SELECT * FROM GROUPS ORDER BY DESCRIPTION;"; } DataSet ds = DatabaseConnection.CreateDataset(gquery); if (ds.Tables[0].Rows.Count > 0) { ListDip.Items.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { ListItem li = new ListItem(); li.Value = dr["Id"].ToString(); li.Text = dr["Description"].ToString(); ListDip.Items.Add(li); } ListItem liglobal = new ListItem(); liglobal.Value = "0"; liglobal.Text = "Global"; ListDip.Items.Add(liglobal); if (ListDip.Items.Count > 0) { foreach (ListItem lg in ListGroups.Items) { foreach (ListItem ld in ListDip.Items) { if (ld.Value == lg.Value) { lg.Selected = true; } } } Remove_ListBox(ListGroups); } } else { foreach (ListItem li in ListGroups.Items) { if (li.Value == UC.UserGroupId.ToString()) { li.Selected = true; Transfer_Listbox(ListGroups, ListDip); break; } } } string dep = "|"; foreach (ListItem im in ListDip.Items) { dep += im.Value.ToString() + "|"; } if (dep.Length < 2) { dep = "|" + UC.UserGroupId.ToString() + "|"; } if (dep.IndexOf("|" + UC.AdminGroupId + "|") < 0) { dep = "|" + UC.AdminGroupId + dep; } GroupValue.Value = dep; }