public List <Model.CommodityType> GetCommodityType() { List <Model.CommodityType> books = new List <Model.CommodityType>(); CommodityType book = null; if (DBHerpel.OpenConnection()) { SqlDataReader dr = DBHerpel.ExecReader("select * from CommodityType where State=0"); if (dr != null) { while (dr.Read()) { book = new CommodityType(); book.CommodityTypeID = (int)dr["CommodityTypeID"]; book.CommodityTypeName = dr["CommodityTypeName"] as string; book.State = (int)dr["State"]; books.Add(book); } } DBHerpel.CloseConnection(); } return(books); }
/// <summary> /// 查询学生信息 /// </summary> /// <param name="cu">学生信息</param> /// <returns></returns> public List <customer> selcustomer(string where) { List <Model.customer> cus = new List <Model.customer>(); customer sut = null; if (DBHerpel.OpenConnection()) { SqlDataReader dr = DBHerpel.ExecReader("select * from customer where State=0 " + where); if (dr != null) { while (dr.Read()) { sut = new customer(); sut.ID = (int)dr["ID"]; sut.Name = dr["Name"] as string; sut.Account = dr["Account"] as string; sut.Pssword = dr["password"].ToString(); sut.Headportrait = dr["Headportrait"] as string; sut.Phone = dr["Phone"] as string; sut.Email = dr["Email"] as string; sut.Adress = dr["Adress"] as string; sut.State = (int)dr["State"]; cus.Add(sut); } } if (cus.Count == 0) { sut = new customer(); sut.ID = -1; cus.Add(sut); } DBHerpel.CloseConnection(); } return(cus); }