//List<Reservation> timeoutReservationList = new List<Reservation>(); //List<Delivery> timeoutDelivery = new List<Delivery>(); //Function: initiate the all the dishes, by query the configure information in db //从数据库吧dish信息读出来,dish是Admin通过adddish加的 public static void InitAllDish() { dishList = new List<Dish>(); DataContextDataContext dc = new DataContextDataContext(); ISingleResult<select_all_dishResult> rs = dc.select_all_dish(); foreach (select_all_dishResult r in rs) { List<Tag> tagList = new List<Tag>(); List<Comment> commentList = new List<Comment>(); ISingleResult<get_tag_by_dishResult> rs2 = dc.get_tag_by_dish(r.name); foreach (get_tag_by_dishResult r2 in rs2) { Tag tag = new Tag(r2.name, (int)r2.popularity); tagList.Add(tag); } ISingleResult<get_comment_by_dishResult> rs3 = dc.get_comment_by_dish(r.name); foreach (get_comment_by_dishResult r3 in rs3) { Comment comment = new Comment(r3.id,r3.content,r3.about_dish,r3.user_from); commentList.Add(comment); } Dish dish = new Dish( r.name, r.description, (double)r.price, r.pict_path, (int)r.popularity, tagList, commentList); dishList.Add(dish); } }