示例#1
0
 public FoodTest()
 {
     //
     //TODO: 在此处添加构造函数逻辑
     //
     _food = new FoodData();
 }
示例#2
0
 public BespeakMealTest()
 {
     _session = new NHibernateHelper().GetSession();
     _order = new OrderData(_session);
     _user = new UserData(_session);
     _food = new FoodData(_session);
     _orderFood = new OrderFoodData(_session);
 }
示例#3
0
 public OrderTest()
 {
     //
     //TODO: 在此处添加构造函数逻辑
     //
     _session = new NHibernateHelper().GetSession();
     _order = new OrderData(_session);
     _user = new UserData(_session);
     _food = new FoodData(_session);
     _orderFood = new OrderFoodData(_session);
 }
示例#4
0
 /// <summary>
 /// 获取当天销售额
 /// </summary>
 /// <param name="datetime"></param>
 /// <returns></returns>
 public double GetTodayTotal(DateTime datetime)
 {
     IList<Order> orderlist = Session.CreateQuery("from Order where status = 2 or status = 3 or status =4")
         .List<Order>();
     IList<Order> todayorder = new List<Order>();
     double total = 0;
     foreach (var v in orderlist)
     {
         if (v.PayTime.Date == datetime.Date)
             todayorder.Add(v);
     }
     foreach (var v in todayorder)
     {
         IList<OrderFood> orderfood = new OrderFoodData().GetOrderFoodListByOrderId(v.OrderId);
         foreach (var u in orderfood)
         {
             double price = new FoodData().GetFoodPriceByFoodId(u.FoodId);
             total += u.FoodNum * price;
         }
     }
     return total;
 }
示例#5
0
    protected void StatusLinkButton_Click(object sender, EventArgs e)
    {
        int foodstatus = 0;
        if ("上菜" == StatusLinkButton.Text)
        {
            foodstatus = 1;
        }
        else foodstatus = 0;

        FoodData _food = new FoodData();
        int foodid = Convert.ToInt32(Session["FoodId"]);
        Food tempfood = _food.GetFoodById(foodid);
        tempfood.Status = foodstatus;
        _food.UpdateFood(tempfood);

        if (1 == foodstatus)
        {
            StatusLabel.Text = "已上架";
            StatusLinkButton.Text = "下架";
        }
        else
        {
            StatusLabel.Text = "已下架";
            StatusLinkButton.Text = "上菜";
        }
    }
示例#6
0
 protected void ConfirmType_Click(object sender, EventArgs e)
 {
     FoodData _food = new FoodData();
     int foodid = Convert.ToInt32(Session["FoodId"]);
     Food tempfood = _food.GetFoodById(foodid);
     tempfood.FoodType = TypeTextBox.Text;
     _food.UpdateFood(tempfood);
     TypeLabel.Visible = true;
     ChangeType.Visible = true;
     TypeTextBox.Visible = false ;
     ConfirmType.Visible = false;
     TypeLabel.Text = TypeTextBox.Text;
 }
示例#7
0
 protected void ConfirmPrice_Click(object sender, EventArgs e)
 {
     FoodData _food = new FoodData();
     int foodid = Convert.ToInt32(Session["FoodId"]);
     Food tempfood = _food.GetFoodById(foodid);
     PriceLabel.Visible = true;
     ChangeType.Visible = true;
     PriceTextBox.Visible = false;
     ConfirmPrice.Visible = false;
     try { tempfood.FoodPrice = Convert.ToDouble(PriceTextBox.Text); }
     catch { return; }
     _food.UpdateFood(tempfood);
     PriceLabel.Text = PriceTextBox.Text;
 }