Пример #1
0
        protected bool SelectFromMenu()
        {
            Check check = new Check();

            int input = Check.InsertAndCheckNumber(9);

            switch (input)
            {
            case 1:
                BubbleSort.ExecuteBubbleSort(Database.shirts, (x, y) => x.size > y.size);
                return(false);

            case 2:
                BubbleSort.ExecuteBubbleSort(Database.shirts, (x, y) => x.size < y.size);
                return(false);

            case 3:
                QuickSort.ExecuteQuickSort(Database.shirts, 0, Database.shirts.Count - 1, (x, y) => x.color > y.color);
                return(false);

            case 4:
                QuickSort.ExecuteQuickSort(Database.shirts, 0, Database.shirts.Count - 1, (x, y) => x.color < y.color);
                return(false);

            case 5:
                InsertionSort.ExecuteInsertionSort(Database.shirts, (x, y) => x.fabric > y.fabric);
                return(false);

            case 6:
                InsertionSort.ExecuteInsertionSort(Database.shirts, (x, y) => x.fabric < y.fabric);
                return(false);

            case 7:
                BucketSort.ExecuteBucketSort(Database.shirts, (x, y) => x.size > y.size, (x, y) => x.color > y.color, (x, y) => x.fabric > y.fabric);
                return(false);

            case 8:
                BucketSort.ExecuteBucketSort(Database.shirts, (x, y) => x.size < y.size, (x, y) => x.color < y.color, (x, y) => x.fabric < y.fabric);
                return(false);

            case 9:
                decimal amount = Shirt.CalculatePriceOfTShirts(Database.shirts);
                Shirt.DisplayThePriceOfTshirts(amount);
                PaymetnMethod payment = SelectPaymentMethod(AskForPaymentMethod());
                payment.DisplayTransactionApprouved(payment.Pay(amount));
                return(true);

            default:
                BubbleSort.ExecuteBubbleSort(Database.shirts, (x, y) => x.size > y.size);
                return(false);
            }
        }
 //============================ Pay and Display if the transaction has successed ====================================================
 public void TryToPayAndDisplayTheResult()
 {
     payMethod.DisplayTransactionApprouved(payMethod.Pay(peymentAmount));
 }