Example #1
0
        static void ShowProductSale()
        {
            #region Number
            Console.WriteLine("\nCixarilacaq satishin nomresini daxil edin :");
            string numberInput = Console.ReadLine();
            int    number;

            while (!int.TryParse(numberInput, out number))
            {
                Console.WriteLine("Reqem daxil etmelisiniz!");
                numberInput = Console.ReadLine();
            }
            try
            {
                _marketableService.GetSaleByNo(number);
            }
            catch (SaleNotFoundException e)
            {
                Console.WriteLine("bele satis {0} nomresi yoxdu", number);
                ShowProductSale();
            }
            #endregion

            #region Product Code
            Console.WriteLine("\nCixarilacaq satishin mehsul kodunu daxil edin:");
            string productCode = Console.ReadLine();

            try
            {
                _marketableService.RemoveProduct(productCode);

                #region Quantity
                Console.WriteLine("Satishin sayini daxil edin :");
                string quantityInput = Console.ReadLine();
                int    quantity;

                while (!int.TryParse(quantityInput, out quantity))
                {
                    Console.WriteLine("Reqem daxil etmelisiniz!");
                    quantityInput = Console.ReadLine();
                }
                #endregion

                #region Result
                try
                {
                    _marketableService.CancelProductFromSale(number, productCode, quantity);
                    Console.WriteLine("-------------- Mehsul ugurla satishdan legv edildi --------------");
                }
                #endregion
                catch (ProductQuantityExceededException e)
                {
                    Console.WriteLine("Bu satishda secdiyiniz mehsulun bu qeder sayi yoxdur !");
                }
            }
            catch (ProductNotFoundException e)
            {
                Console.WriteLine("Bu kodda satish yoxdur !");
            }
            #endregion
        }