Пример #1
0
        public void TestAddDiscount(Order order)
        {
            int  discount     = 100000;
            byte discountType = 1;

            orderBLL.AddDiscount(order, discount, discountType);

            List <Area>  areas        = areaBLL.ListArea();
            List <Table> allTables    = tableBLL.ListTablesByArea(areas[0]);
            Order        currentOrder = orderBLL.GetCurrentOrderByTable(allTables[0]);

            Assert.AreEqual(currentOrder.ID, order.ID);
            Assert.AreEqual(currentOrder.Discount, discount);
            Assert.AreEqual(currentOrder.DiscountType, discountType);

            TestChangeTableForOrder(currentOrder);
        }
Пример #2
0
 private void addDiscount()
 {
     if (rbCash.Checked == false && rbPercent.Checked == false)
     {
         MessageBox.Show("Please, Select a valid discount!", "Warning", MessageBoxButtons.OK);
     }
     else
     {
         if (tvDiscount.Value == 0)
         {
             MessageBox.Show("Please, Enter the value for the discount!", "Warning", MessageBoxButtons.OK);
         }
         else
         {
             if (rbPercent.Checked == true)
             {
                 if (tvDiscount.Value <= 100 && tvDiscount.Value > 0)
                 {
                     typeDiscount = 2;
                     OrderBLL orderBLL = new OrderBLL();
                     this.order = orderBLL.AddDiscount(order, Convert.ToInt32(tvDiscount.Value), typeDiscount);
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("The value you entered is not valid for a percentage!", "Warning", MessageBoxButtons.OK);
                 }
             }
             else
             {
                 typeDiscount = 1;
                 OrderBLL orderBLL = new OrderBLL();
                 this.order = orderBLL.AddDiscount(order, Convert.ToInt32(tvDiscount.Value), typeDiscount);
                 this.Close();
             }
         }
     }
 }