public static void FillList(ref WindowsFormsAero.ListView list, string mode = "全部", string text = "") { if (text != "") { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select * from ClassTable where name like '%{0}%'", text)), ref list); } else { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select * from ClassTable")), ref list); } }
static public void BanList(ref WindowsFormsAero.ListView list, string type = "0", string text = "") { if (type == "0") { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select a.id,b.name,c.name from RecordTable as a left join ClassTable as b on a.classid = b.id left join UserTable as c on a.stuid = c.id")), ref list); } if (type == "1") { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select a.id,b.name,c.name from RecordTable as a left join ClassTable as b on a.classid = b.id left join UserTable as c on a.stuid = c.id where b.name like '%{0}%'", text)), ref list); } if (type == "2") { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select a.id,b.name,c.name from RecordTable as a left join ClassTable as b on a.classid = b.id left join UserTable as c on a.stuid = c.id where c.name like '%{0}%'", text)), ref list); } }
static public void FillList(DataTable tb, ref WindowsFormsAero.ListView list) { list.Items.Clear(); if (tb != null) { foreach (DataRow item in tb.Rows) { ListViewItem Listitem = new ListViewItem(item[tb.Columns[0]].ToString()); for (int i = 1; i < tb.Columns.Count; i++) { Listitem.SubItems.Add(item[tb.Columns[i]].ToString()); } list.Items.Add(Listitem); } } }
public static void FillList2(ref WindowsFormsAero.ListView list, string id) { SqlHelper.FillList(SqlHelper.ExecuteDt(string.Format("select a.id,b.name,b.credit,b.starttime,b.classtime,b.teacher from RecordTable as a left join ClassTable as b on a.classid = b.id left join UserTable as c on a.stuid = c.id where c.id = {0}", id)), ref list); }