示例#1
0
 public void getAllOrders()
 {
     OrderDAO orderDAO = new OrderDAO();
     DishDAO dishDAO = new DishDAO();
     List<OrderEntity> list = orderDAO.getAllOrderByRestaurantId(1);
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < list.Count;i++ )
     {
         OrderEntity order = list[i];
         String dishString = "";
         for (int j = 0; j < order.dishList.Count-1; j++)
         {
             DishEntity dish = dishDAO.getDishById(order.dishList[j].dish_id);
             dishString += dish.dish_name + ",";
         }
         DishEntity dish2 = dishDAO.getDishById(order.dishList[order.dishList.Count-1].dish_id);
         dishString += dish2.dish_name;
         DateTime todaydate = Convert.ToDateTime(order.start_time);
         String date = todaydate.ToString("MM/dd hh:mm:ss");
             switch (order.status)
             {
                 //对订单状态进行分类,应该需要换,优化
                 case 0:
                     sb.Append("<tr>");
                     sb.Append("<td width='55' class='bl_blue'><span class='label label-info'>新订单</span></td>");
                     sb.Append("<td width='50'>#AA-325 <span class='mark'>"+date+"</span></td>");
                     //跳转位置
                     sb.Append("<td><a href='order_list.aspx?orderId="+order.order_id+"' class='cblue'>"+dishString+"</a>");
                     sb.Append("<span class='mark'>来自"+order.user_id+"号桌</span>");
                     sb.Append("<input id='" + order.order_id + "' type='button' value='完成'  OnClick='finishOrder(this)'></td>");
                     sb.Append("</tr>");
                     break;
                 case 1:
                     sb.Append("<tr>");
                     sb.Append("<td class='bl_green'><span class='label label-success'>完成</span></td>");
                     sb.Append("<td width='50'>#AA-"+order.order_id+" <span class='mark'>" + date + "</span></td>");
                     sb.Append("<td><a href='order_list.aspx?orderId=" + order.order_id + "' class='cgreen'>" + dishString + "</a>");
                     sb.Append("<span class='mark'>来自" + order.user_id + "号桌</span></td>");
                     sb.Append("</tr>");
                     break;
                 case 2:
                     sb.Append("<tr>");
                     sb.Append("<td class='bl_red'><span class='label label-important'>取消</span></td>");
                     sb.Append("<td>#VB-57 <span class='mark'>" + date + "</span></td>");
                     sb.Append("<td><a href='order_list.aspx?orderId=" + order.order_id + "' class='cred'>" + dishString + "</a>");
                     sb.Append("<span class='mark'>来自" + order.user_id + "号桌</span></td>");
                     sb.Append("</tr>");
                     break;
             }
     }
     orderPart = sb.ToString();
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int dish_id = Convert.ToInt32(Request.QueryString["dish_id"]);
     DishDAO dishDAO = new DishDAO();
     DishEntity dish = new DishEntity();
     dish = dishDAO.getDishById(dish_id);
     name = dish.dish_name;
     price = dish.price;
     description = dish.description;
 }
示例#3
0
        public String listDetailOrder(int id)
        {
            OrderDAO orderDAO = new OrderDAO();
            DishDAO dishDAO = new DishDAO();
            OrderEntity order = orderDAO.getOneOrderByOrderId(id);
            userId = order.user_id;
            StringBuilder sb = new StringBuilder();

            for (int j = 0; j < order.dishList.Count; j++)
            {
                DishEntity dish = dishDAO.getDishById(order.dishList[j].dish_id);
                total_price += order.dishList[j].count * dish.price;
                total_count += order.dishList[j].count;
                switch (order.dishList[j].status)
                {
                    //对订单状态进行分类,应该需要换,优化
                    case 0:
                        sb.Append("<div class='thumbnail'>");
                        sb.Append("<a class='fb' rel='group' href='" + dish.photo + "'><img src='" + dish.photo + "' class='img-polaroid'/></a>");
                        sb.Append("<div class='caption'>");
                        sb.Append("<h3>菜名:"+dish.dish_name+"</h3>");
                        sb.Append("<p>数量:" + order.dishList[j].count+ "</p>");
                        sb.Append("<p class='bl_blue'>状态:" + "未完成" + "</p>");
                        if (dish.discount != 0)
                        {
                            sb.Append("<p>优惠价:" + dish.discount + "</p>");
                            sb.Append("<p style='text-decoration:line-through;color:#9c9c9c'>单价:" + dish.price + "</p>");
                        }
                        else
                        {
                            sb.Append("<p>单价:" + dish.price + "</p>");
                        }
                        sb.Append("<p>备注:</p>");
                        sb.Append("<p><a class='btn btn-warning'  id='" + order.dishList[j].id + "' OnClick='finishDish(this)' href='###'>完成</a> <a class='btn' href='#'>取消</a></p>");
                        sb.Append("</div>");
                        sb.Append("</div>");  
                        break;
                    case 1:
                        sb.Append("<div class='thumbnail'>");
                        sb.Append("<a class='fb' rel='group' href='"+dish.photo+"'><img src='"+dish.photo+"' class='img-polaroid'/></a>");
                        sb.Append("<div class='caption'>");
                        sb.Append("<h3>菜名:" + dish.dish_name + "</h3>");
                        sb.Append("<p>数量:" + order.dishList[j].count + "</p>");
                        sb.Append("<p class='bl_blue'>状态:" + "完成" + "</p>");
                        if (dish.discount != 0)
                        {
                            sb.Append("<p>优惠价:"+ dish.discount+"</p>");
                            sb.Append("<p style='text-decoration:line-through;color:#9c9c9c'>单价:" + dish.price + "</p>");
                        }
                        else { 
                            sb.Append("<p>单价:" + dish.price + "</p>");
                        }
                        
                        sb.Append("<p>备注:</p>");
                    //    sb.Append("<p><a class='btn btn-warning' href='#'>完成</a> <a class='btn' href='#'>取消</a></p>");
                        sb.Append("</div>");
                        sb.Append("</div>");  
                        break;
                    case 2:
                        sb.Append("<div class='thumbnail'>");
                        sb.Append("<a class='fb' rel='group' href='" + dish.photo + "'><img src='" + dish.photo + "' class='img-polaroid'/></a>");
                        sb.Append("<div class='caption'>");
                        sb.Append("<h3>菜名" + dish.dish_name + "</h3>");
                        sb.Append("<p>数量" + order.dishList[j].count + "</p>");
                        sb.Append("<p>备注:</p>");
                        sb.Append("<p><a class='btn btn-warning' href='#'>完成</a> <a class='btn' href='#'>取消</a></p>");
                        sb.Append("</div>");
                        sb.Append("</div>");  
                        break;
                }
            }
            sb.Append("<input name='结算订单' type='submit' value='结算订单'");
            
            return sb.ToString();
        }