public static List <Schedule> selectScheduleByOrderIdFName(string OrderId, string Fname) { List <Schedule> sd = new List <Schedule>(); string sql = "select * from ScheduleInfo where OrderId='" + OrderId + "' and Fname='" + Fname + "'"; SqlDataReader dr = DBHelper.ExecuteReader(sql); while (dr.Read()) { Schedule sds = new Schedule(); sds.OrderId = dr["OrderId"].ToString(); sds.FName = dr["Fname"].ToString(); sds.FTime = dr["FTime"].ToString(); sds.FNumber = (int)dr["FNumber"]; sds.IsPay = (bool)dr["IsPay"]; sd.Add(sds); } dr.Close(); DBHelper.Closecon(); return(sd); }
public static List <Member> SelectMemberTelbyAll(string Tel) { List <Member> mbs = new List <Member>(); string sql = "select * from MemberInfo where MemTel='" + Tel + "'"; SqlDataReader dr = DBHelper.ExecuteReader(sql); if (dr.Read()) { Member mb = new Member(); mb.MemberId = (int)dr["MemberId"]; mb.MemName = (string)dr["MemName"]; mb.MemTel = (string)dr["MemTel"]; mb.MemPwd = (string)dr["MemPwd"]; mb.MemAge = (int)dr["MemAge"]; mb.MemSex = (string)dr["MemSex"]; mb.MemBirthday = (DateTime)dr["MemBirthday"]; mbs.Add(mb); } dr.Close(); DBHelper.Closecon(); return(mbs); }
//查询所有菜品信息 public static List <Foods> SelectColdFoodAll() { List <Foods> tb = new List <Foods>(); string sql = "Select f.FoodId,ft.Ftype,f.FoodName,f.Price,f.FoodTime "; sql += "From Food f,FoodType ft Where f.FoodType = ft.FoodTypeId and ft.FType='凉菜'"; SqlDataReader dr = DBHelper.ExecuteReader(sql); while (dr.Read()) { Foods tbs = new Foods(); tbs.FoodId = (int)dr["FoodId"]; tbs.FoodName = (string)dr["FoodName"]; tbs.FoodPrice = (decimal)dr["Price"]; tbs.FoodTime = (TimeSpan)dr["FoodTime"]; tbs.FoodType = (string)dr["Ftype"]; tb.Add(tbs); } dr.Close(); DBHelper.Closecon(); return(tb); }
/// <summary> /// 根据类型查询所有菜品 /// </summary> /// <returns></returns> public static List <Food> SelectFoodbyType(string type) { List <Food> fds = new List <Food>(); string sql = "select * from Food where FoodType='" + type + "'"; SqlDataReader dr = DBHelper.ExecuteReader(sql); while (dr.Read()) { string strTime = dr["FoodTime"].ToString(); DateTime date = Convert.ToDateTime(strTime); Food fd = new Food(); fd.FoodId = (int)dr["FoodId"]; fd.FoodImage = (string)dr["FoodImage"]; fd.FoodName = (string)dr["FoodName"]; fd.FoodTime = date.ToLongTimeString(); fd.FoodType = (int)dr["FoodType"]; fd.Price = (decimal)dr["Price"]; fds.Add(fd); } dr.Close(); DBHelper.Closecon(); return(fds); }
public static List <Schedule> selectScheduleValues() { List <Schedule> sd = new List <Schedule>(); string sql = "select * from OrderInfo o,Food f,Pay p where o.FName=f.FoodName and o.OrderId=p.PayId"; SqlDataReader dr = DBHelper.ExecuteReader(sql); while (dr.Read()) { Schedule sds = new Schedule(); sds.OrderId = dr["OrderId"].ToString(); sds.FName = dr["FName"].ToString(); sds.FTime = dr["FoodTime"].ToString(); sds.FNumber = (int)dr["FNumber"]; sds.IsPay = (bool)dr["IsPay"]; sds.PayTime = dr["PayTime"].ToString(); sd.Add(sds); } dr.Close(); DBHelper.Closecon(); return(sd); }