private void GetBill()
    {
        var controller = new WaiterController();
        var data = controller.GetBill(int.Parse(ActiveBills.SelectedValue));
        BillToSplit.Value = data.BillID.ToString();

        // Set the original bill items
        OriginalBillItems.DataSource = data.Items;
        OriginalBillItems.DataBind();

        // empty out other bill
        NewBillItems.DataSource = null;
        NewBillItems.DataBind();
    }
        public void Should_Split_Bill()
        {
            // Arrange
            WaiterController sut = new WaiterController();
            var aBill = GetActiveBills().First();
            var actualBill = sut.GetBill(aBill.KeyValue);
            int midPoint = actualBill.Items.Count / 2;
            //List<

            // Act
            //sut.SplitBill(aBill.KeyValue, originals, newItems);

            // Assert
        }
    private void SplitTheBill()
    {
        var originalItems = GetRowsFrom(OriginalBillItems);
        var newItems = GetRowsFrom(NewBillItems);
        int billId = int.Parse(BillToSplit.Value);

        WaiterController controller = new WaiterController();
        controller.SplitBill(billId, originalItems, newItems);
    }
 private static List<Entities.DTOs.ListDataItem> GetActiveBills()
 {
     WaiterController sut = new WaiterController();
     var actives = sut.ListActiveBills();
     return actives;
 }
Ejemplo n.º 5
0
    private void SplitTheBill()
    {
        var originalItems = GetRowsFrom(OriginalBillItems);
        //var newItems = GetRowsFrom(NewBillItems);
        // The long version of the line above....
        List<OrderItem> newItems = new List<OrderItem>();
        foreach (GridViewRow row in NewBillItems.Rows)
        {
            var qtyLabel = row.FindControl("Quantity") as Label;
            var nameLabel = row.FindControl("ItemName") as Label;
            var priceLabel = row.FindControl("Price") as Label;
            var data = new OrderItem()
            {
                Quantity = int.Parse(qtyLabel.Text),
                ItemName = nameLabel.Text,
                Price = decimal.Parse(priceLabel.Text)
            };

            newItems.Add(data);
        }

        int billId = int.Parse(BillToSplit.Value);

        WaiterController controller = new WaiterController();
        controller.SplitBill(billId, originalItems, newItems);
    }