Ejemplo n.º 1
0
        private void AddOrderToListMethod()
        {
            Console.WriteLine("asdasdasd");
            Console.WriteLine("start");
            //Problem z dodawaniem zamówienia po raz pierwszy. Gdy Id = 1 nie chce dodać zamowienia. Za drugim razem gdy dodaje zamowienie i id zmieni sie na 2 to wszystko działa. Do naprawienia.


            Console.WriteLine($"{CurrentOrder.OrderCreate}, {CurrentOrder.DispatchDate}, {SelectedCustomer.Id}, lista : {CurrentOrderDetailList}, suma zamowienia:{CurrentOrder.TotalAmount}, status : {Enum.OrderStatus.Statuses.Nowe.ToString()}");

            try
            {
                var isAdded = orderOperationsObj.AddOrder(CurrentOrder.OrderCreate, CurrentOrder.DispatchDate, SelectedCustomer, TotalOrderValue, Enum.OrderStatus.Statuses.Nowe, CurrentOrder.DeliveryName, CurrentOrder.DeliveryStreet, CurrentOrder.DeliveryPostcode, CurrentOrder.DeliveryCity, CurrentOrder.DeliveryCountry);
                Console.WriteLine($"{orderOperationsObj.GetLastOrderIndex()}");
                orderOperationsObj.UpdateOrderIdInDetailList(CurrentOrderDetailList);
                LoadCurrentOrderDetalList();
                SelectedCustomer        = null;
                SelectedProductQuantity = 0;
                SelectedProductPrice    = 0;

                SameDeliveryAddressAsCustomerDetails(false);
                IsCheckedCheckbox = false;
                for (int i = 0; i < ProductSizesTable.Length; i++)
                {
                    ProductSizesTable[i] = 0;
                }



                if (isAdded)
                {
                    Console.WriteLine("Dodano zamówienie");
                    Message = "Dodano zamówienie";
                    Console.WriteLine($"Ostatni indeks zamowienia : {orderOperationsObj.GetLastOrderIndex()}");
                }
                else
                {
                    Console.WriteLine("Nie dodano zamówienia");
                    Message = "Nie dodano zamówienia";
                }
            }
            catch (Exception ex)
            {
                Message = ex.Message;
            }
        }