/// <summary> /// 获取用户列表 /// </summary> /// <returns></returns> public List <string> GetUserList() { List <string> users = null; string sql = string.Format("select UserName from {0}", _accountTableName); DataSet ds = _zdManager.GetSomeData(sql); if (ds != null) { users = new List <string>(); foreach (DataRow udr in ds.Tables[0].Rows) { users.Add((string)udr["UserName"]); } } return(users); }
/// <summary> /// 获取所有商品 /// </summary> /// <returns></returns> public ICollection <Product> GetProducts() { string sql = string.Format("select * from {0}", _productTableName); DataSet ds = _zdManager.GetSomeData(sql); ObservableCollection <Product> products = new ObservableCollection <Product>(); foreach (DataRow productRow in ds.Tables[0].Rows) { Product p = new Product( (int)productRow["ID"], (string)productRow["Num"], (string)productRow["ProductName"], (string)productRow["Producer"], (string)productRow["Category"], (int)productRow["LeftNum"], (int)productRow["SaleNum"] ); products.Add(p); } return(products); }