示例#1
0
        static void Main()
        {
            Console.WriteLine("Select currency: £ = 1, $ = 2");

            ICurrency currency = CurrencySelector.CurrencySelect(Console.ReadLine());

            if (currency != null)
            {
                Console.WriteLine("What is the till's float?");

                if (int.TryParse(Console.ReadLine(), out int cashFloat))
                {
                    currency = CurrencyCalc.SetFloat(cashFloat, currency);
                }

                foreach (int denomination in currency.Denominations)
                {
                    Console.WriteLine(currency.SpecifiedCurrency + denomination);

                    if (int.TryParse(Console.ReadLine(), out int numberOfdenominations))
                    {
                        currency = CurrencyCalc.CalculateCurrency(numberOfdenominations, denomination, currency);
                    }
                }

                currency = CurrencyCalc.CalculateBankingTotal(currency);

                Console.WriteLine("Total cash in the till: " + currency.SpecifiedCurrency + currency.CashTotal);
                Console.WriteLine("Total Amount of cash to be banked: " + currency.SpecifiedCurrency + currency.BankingTotal);
            }
            else
            {
                Console.WriteLine("No Valid currency selected");
            }
        }
示例#2
0
 /// <summary>
 /// Reloads selectors.
 /// </summary>
 private void ReloadUniselectors()
 {
     CurrencySelector.Reload();
     PaymentSelector.Reload();
     ShippingSelector.Reload();
     statusSelector.Reload();
 }
    /// <summary>
    /// Assigns FilterSiteID to all selectors and reloads them
    /// </summary>
    private void ReloadUniselectors()
    {
        CurrencySelector.SiteID = FilterSiteID;
        PaymentSelector.SiteID  = FilterSiteID;
        ShippingSelector.SiteID = FilterSiteID;

        RefreshStatusSelector();
        CurrencySelector.Reload();
        PaymentSelector.Reload();
        ShippingSelector.Reload();
    }
示例#4
0
        private static void RunOptions(Options obj)
        {
            string inputFile  = obj.InputFile;
            string outputFile = obj.OutputFile;

            if (outputFile == null)
            {
                outputFile = Path.GetDirectoryName(inputFile) + @"\" + Path.GetFileNameWithoutExtension(inputFile) + "_processed.txt";
            }

            if (obj.GenerateInputFile)
            {
                int rowsToGenerate = obj.RowsToGenerate == 0 ? 500 : obj.RowsToGenerate;
                TestFileGeneration.GenerateTestFile(inputFile, rowsToGenerate);
            }


            //threshold for storing transactions in memory
            //can be much higher but 100k seemed reasonable
            //for this exercise.
            int dataDumpThreshold = 100000;


            if (TransactionProcessor.ProcessTransactions(inputFile, outputFile, dataDumpThreshold, obj.RandomizeAllChange, CurrencySelector.GetCurrency(obj.CurrencyCode)))
            {
                Console.WriteLine("Finished processing without error");
            }
            else
            {
                Console.WriteLine("Finished processing with error(s)");
            }
            Console.WriteLine("Press any key to end...");
            Console.ReadKey();
        }