/// <summary> /// condition /// </summary> /// <param name="db"></param> /// <param name="condition"></param> /// <returns></returns> public List <Dictionary <string, object> > LoadMenu(ADODB db, string condition) { List <Dictionary <string, object> > lst = new List <Dictionary <string, object> >(); string sql = String.Format("select * from sm_menu where _parent='{0}' and _permission <= {1} order by id asc", condition, this.permission); DataTable dt = db.exec_dataset(sql); if (dt != null) { foreach (DataRow dr in dt.Rows) { Dictionary <string, object> dic = new Dictionary <string, object>(); foreach (DataColumn dc in dt.Columns) { string key, value; int ivalue; key = dc.ColumnName; switch (key) { case "_text": case "_moduleName": case "_extraParams": case "_xtype": value = dr.IsNull(key) ? "" : (string)dr[key]; dic.Add(key, value); break; // 字符换为十六进制 case "_glyph": ivalue = dr.IsNull(key) ? 0 : Convert.ToInt32((string)dr[key], 16); dic.Add(key, ivalue); break; // 不为0表示有子项 case "_child": value = dr.IsNull(key) ? "" : (string)dr[key]; if (value.Length > 0 && value != "0") { dic.Add("items", this.LoadMenu(db, value)); } break; default: break; } } lst.Add(dic); } } return(lst); }
public int GetLastID(ADODB db) { int result = -1; string sql = String.Format("SELECT IDENT_CURRENT('{0}')", table); DataTable dt = db.exec_dataset(sql); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; decimal temp = row.IsNull(0) ? -1 : (decimal)row[0]; result = (int)temp; } return(result); }
static public List <FormgroupFields> getlstdata(string id, ADODB db) { List <FormgroupFields> lst = null; DataTable dt = db.exec_dataset(FormgroupFields.getquerysql(id)); if (dt != null) { lst = new List <FormgroupFields>(); foreach (DataRow row in dt.Rows) { FormgroupFields obj = new FormgroupFields(row, db); lst.Add(obj); } } return(lst); }
static public List <GridSchemeGroup> getlstdata(string id, ADODB db) { List <GridSchemeGroup> lst = null; DataTable dt = db.exec_dataset(GridSchemeGroup.getquerysql(id)); if (dt != null) { lst = new List <GridSchemeGroup>(); foreach (DataRow row in dt.Rows) { GridSchemeGroup obj = new GridSchemeGroup(row, db); lst.Add(obj); } } return(lst); }
public void LoadData( ) { ADODB db = new ADODB(); if (db.Open()) { DataTable dt = db.exec_dataset(Summary.getquerysql()); root = new List <Summary>(); if (dt != null) { foreach (DataRow row in dt.Rows) { Summary obj = new Summary(row, db); root.Add(obj); } } db.Close(); } return; }