private void Load_User() { int _type = Utils.CIntDef(ddlMenu.SelectedValue); List <int> listItems = (from a in db.USER_PERMISSIONs where a.PER_TYPE == _type select Utils.CIntDef(a.PER_USER, 0)).ToList(); db = new AppketoanDataContext(); var list = (from a in db.USERs join b in db.GROUPs on a.GROUP_ID equals b.GROUP_ID where (a.GROUP_ID != 1 && a.GROUP_ID != 2 && !listItems.Contains(a.USER_ID)) select new { a.USER_ID, a.GROUP_ID, namGroup = b.GROUP_NAME + " (" + a.USER_NAME + ")" }).OrderBy(n => n.USER_ID).OrderBy(n => n.GROUP_ID).ToList(); if (list.Count > 0) { multiselect.DataSource = list; multiselect.DataTextField = "namGroup"; multiselect.DataValueField = "USER_ID"; multiselect.DataBind(); multiselect.Multiple = true; } }
private void Load_User() { int _type = Utils.CIntDef(ddlMenu.SelectedValue); List<int> listItems = (from a in db.USER_PERMISSIONs where a.PER_TYPE == _type select Utils.CIntDef(a.PER_USER, 0)).ToList(); db = new AppketoanDataContext(); var list = (from a in db.USERs join b in db.GROUPs on a.GROUP_ID equals b.GROUP_ID where (a.GROUP_ID != 1 && a.GROUP_ID != 2 && !listItems.Contains(a.USER_ID)) select new { a.USER_ID, a.GROUP_ID, namGroup = b.GROUP_NAME + " (" + a.USER_NAME + ")" }).OrderBy(n => n.USER_ID).OrderBy(n => n.GROUP_ID).ToList(); if (list.Count > 0) { multiselect.DataSource = list; multiselect.DataTextField = "namGroup"; multiselect.DataValueField = "USER_ID"; multiselect.DataBind(); multiselect.Multiple = true; } }