public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (CurrencyID != null ? CurrencyID.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CurrencyCodeListVersionID != null ? CurrencyCodeListVersionID.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #2
0
 protected override string[] GetContent()
 {
     return(new[]
     {
         ID.ToString(),
         CurrencyID.ToString(),
         UnitID.ToString(),
         OriginID.ToString(),
         IncotermID.ToString(),
         PlaceID.ToString()
     });
 }
Пример #3
0
        public void Deposit(int accountNo, decimal amount, Currency currency, decimal accountExchangeRate)
        {
            if (!CurrencyID.Equals(currency.CurrencyID))
            {
                amount = AppHelper.AppHelper.CalculateAmountWithRates(amount, accountExchangeRate, currency.ExchangeRate);
            }

            var transaction = new Transaction(accountNo, amount, currency, TransactionType.DEPOSIT);

            this.Transactions.Add(transaction);
            Balance += amount;
        }
Пример #4
0
        public void Withdraw(int accountNo, decimal amount, Currency currency, decimal accountExchangeRate)
        {
            if (!CurrencyID.Equals(currency.CurrencyID))
            {
                amount = AppHelper.AppHelper.CalculateAmountWithRates(amount, accountExchangeRate, currency.ExchangeRate);
            }

            if (amount > Balance)
            {
                throw new InsufficientBalanceException("The amount to withdraw cannot be greater than your account balance!");
            }

            var transaction = new Transaction(accountNo, amount, currency, TransactionType.WITHDRAWAL);

            Transactions.Add(transaction);
            Balance -= amount;
        }
Пример #5
0
        protected void lvMDCurrency_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 CurrencyID;

            Int64.TryParse(e.CommandArgument.ToString(), out CurrencyID);

            if (CurrencyID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _CurrencyID = CurrencyID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDCurrencyEntity.FLD_NAME_CurrencyID, CurrencyID.ToString(), SQLMatchType.Equal);

                        MDCurrencyEntity mDCurrencyEntity = new MDCurrencyEntity();


                        result = FCCMDCurrency.GetFacadeCreate().Delete(mDCurrencyEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _CurrencyID       = 0;
                            _MDCurrencyEntity = new MDCurrencyEntity();
                            PrepareInitialView();
                            BindMDCurrencyList();

                            MiscUtil.ShowMessage(lblMessage, "Currency has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Currency.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
 public override void FillCongressVotingArguments(CongressVoting voting)
 {
     voting.Argument1 = Amount.ToString();
     voting.Argument2 = CompanyID.ToString();
     voting.Argument3 = CurrencyID.ToString();
 }