예제 #1
0
        public void DeleteCurrencyByName(string currencyName)
        {
            if (currencyName == string.Empty)
            {
                return;
            }
            var currency = GetCurrencyBO.GetCurrencyByName(currencyName);

            if (currency == null)
            {
                return;
            }
            Delete(currency);
        }
예제 #2
0
        public static void ExchangeCurrency(string personFirstName, string personLastName, DateTime birthDate,
                                            string passportSeries, string passportId, string currencyName, double amount, bool isSelling)
        {
            var person = GetCustomerBO.GetCustomerByPassportId(passportId);

            if (person == null)
            {
                person = new Abstract.model.Person
                {
                    FirstName      = personFirstName, LastName = personLastName, BirthDate = birthDate,
                    PassportSeries = passportSeries, PassportId = passportId
                };
                CreateCustomerBO.CreateCustomer(person);
            }

            var currency = GetCurrencyBO.GetCurrencyByName(currencyName);

            var outcomeAmount = currency.Purchase * amount;

            if (isSelling)
            {
                outcomeAmount = amount / currency.Sell;
            }


            if (!ValidateForDailyLimits(amount, currency))
            {
                ModernDialog.ShowMessage("Person can't exchange more than 1000 units \nof currency per day.", "Warning",
                                         MessageBoxButton.OK);
                return;
            }

            var outReport = new Abstract.model.Report
            {
                UserId        = SessionService.GetInstance().User.UserId,
                PersonId      = person.PersonId,
                CurrencyId    = currency.CurrencyId,
                IncomAmount   = amount,
                OutcomeAmount = outcomeAmount,
                Date          = DateTime.Now
            };

            CreateReportBO.CreateReport(outReport);

            ModernDialog.ShowMessage("The operation completed successfully. \nYou need to issue " + outcomeAmount +
                                     " units of currency.", "Success!", MessageBoxButton.OK);
        }
예제 #3
0
 public static GetCurrencyBO GetInstance()
 {
     return(_instance ?? (_instance = new GetCurrencyBO()));
 }