private void _CheckExchangeRate() { var selectedCur = cbCurrencies.SelectedItem as Currency; if (!ServicesProvider.GetInstance().GetCurrencyServices().GetPivot().Equals(selectedCur)) { _rate = ServicesProvider.GetInstance().GetExchangeRateServices().SelectExchangeRate(DateTime.Now, selectedCur); while (_rate == null) { var xrForm = new ExchangeRateForm(DateTime.Now, selectedCur); xrForm.ShowDialog(); if (xrForm.ExchangeRate != null) { if (xrForm.ExchangeRate.Currency.Equals(selectedCur) && xrForm.ExchangeRate.Date.Day.Equals(DateTime.Now.Day)) { _rate = xrForm.ExchangeRate; } } } } else { _rate = new ExchangeRate() { Rate = 1 }; } }
private void menuItemExchangeRate_Click(object sender, System.EventArgs e) { ExchangeRateForm exchangeRate = new ExchangeRateForm(); exchangeRate.Show(); }
private void ButtonAddExchangeRateClick(object sender, EventArgs e) { ExchangeRateForm exchangeRate = new ExchangeRateForm(_newStartDate, _loan.Product.Currency); exchangeRate.ShowDialog(); _exchangeRate = exchangeRate.ExchangeRate; InitializeExternalCurrency(); buttonSave.Enabled = _exchangeRate != null; }
private bool CheckDateChange() { _exchangeRate = null; if (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies().Count == 1) { _exchangeRate = new ExchangeRate { Currency = _loan.Product.Currency, Date = _newStartDate, Rate = 1 }; } buttonSave.Enabled = false; try { if (!ServicesProvider.GetInstance().GetExchangeRateServices().RateExistsForEachCurrency (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies(), _newStartDate)) { buttonAddExchangeRate.Enabled = lblPivotCurrency.Enabled; var xrForm = new ExchangeRateForm(new DateTime(_newStartDate.Year, _newStartDate.Month, _newStartDate.Day), _loan.Product.Currency); xrForm.ShowDialog(); } _exchangeRate = ServicesProvider.GetInstance().GetAccountingServices().FindExchangeRate(_newStartDate, _loan.Product. Currency); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } finally { if (_exchangeRate != null) { buttonSave.Enabled = true; lblPivotCurrency.Visible = ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies().Count > 1 && !_loan.Product.Currency.IsPivot; lblFeesCurrencyPivot.Visible = lblPivotCurrency.Visible; buttonAddExchangeRate.Visible = false; } else { buttonSave.Enabled = false; buttonAddExchangeRate.Enabled = true; lblPivotCurrency.Visible = true; lblFeesCurrencyPivot.Visible = true; } } bool lde = InitializeLoanDisburseEvent(); return lde; }
private bool MaxAmountExceed() { OCurrency maxGuarantorAmount = ServicesProvider.GetInstance().GetGeneralSettings().MaxGuarantorAmount; OCurrency tempAmount; if (code.IsPivot) tempAmount = _guarantor.Amount; else { ExchangeRateServices rateServices = ServicesProvider.GetInstance().GetExchangeRateServices(); ExchangeRate currentRate = rateServices.SelectExchangeRate(TimeProvider.Now, code); if (currentRate == null) { ExchangeRateForm xrForm = new ExchangeRateForm(TimeProvider.Now.Date, code); xrForm.ShowDialog(); currentRate = xrForm.ExchangeRate; } tempAmount = _guarantor.Amount/currentRate.Rate; } if (tempAmount > maxGuarantorAmount) return true; return false; }
private void SetExchangeRate() { _exchangeRate = null; if (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies().Count == 1) { _exchangeRate = new ExchangeRate { Currency = _loan.Product.Currency, Date = TimeProvider.Today, Rate = 1 }; } try { if (!ServicesProvider.GetInstance().GetExchangeRateServices().RateExistsForEachCurrency (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies(), _date.Date)) { _btAddExchangeRate.Enabled = panelEC.Enabled = true; ExchangeRateForm _xrForm = new ExchangeRateForm(new DateTime(_date.Year, _date.Month, _date.Day), _loan.Product.Currency); _xrForm.ShowDialog(); } _exchangeRate = ServicesProvider.GetInstance().GetAccountingServices().FindExchangeRate(_date.Date, _loan.Product.Currency); } catch(Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } finally { if (_exchangeRate != null) { panelEC.Visible = ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies().Count > 1 && !_loan.Product.Currency.IsPivot; _btAddExchangeRate.Visible = false; } else { panelEC.Visible = false; _btAddExchangeRate.Enabled = true; } DisplayAmountLabel(); DisplayInstallmentsAndEvent(); if(!_manualAmountWasEntered) nudICAmount.Value = _loan.CalculateAmountToRepaySpecifiedInstallment(_instalmentNumber, _date.Date, _disableFees, _manualPenalties, _manualCommission, _disableInterests, _manualInterests, _keepExpectedInstallment).Value; SetAmount(nudICAmount, _loan.UseCents); } }
private void SetExchangeRate() { _exchangeRate = null; if (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies().Count == 1) { _exchangeRate = new ExchangeRate { Currency = _FundingLine.Currency, Date = dateTimePickerEvent.Value, Rate = 1 }; } buttonSave.Enabled = false; DateTime _date = dateTimePickerEvent.Value; try { if (!ServicesProvider.GetInstance().GetExchangeRateServices().RateExistsForEachCurrency (ServicesProvider.GetInstance().GetCurrencyServices().FindAllCurrencies(), _date.Date) /*&& (User.CurrentUser.HasAdminRole || User.CurrentUser.HasSuperAdminRole)*/) { buttonAddRate.Enabled = true; var _xrForm = new ExchangeRateForm(new DateTime(dateTimePickerEvent.Value.Year, _date.Month, _date.Day), _FundingLine.Currency); _xrForm.ShowDialog(); } _exchangeRate = ServicesProvider.GetInstance().GetAccountingServices().FindExchangeRate(_date.Date, _FundingLine.Currency); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } finally { if (_exchangeRate != null) { buttonSave.Enabled = true; buttonAddRate.Visible = false; } else { buttonSave.Enabled = false; //buttonAddRate.Enabled = User.CurrentUser.isAdmin || User.CurrentUser.isSuperAdmin; buttonAddRate.Enabled = true; } } }
private void _CheckExchangeRate() { var selectedCur = cbCurrencies.SelectedItem as Currency; if (!ServicesProvider.GetInstance().GetCurrencyServices().GetPivot().Equals(selectedCur)) { _rate = ServicesProvider.GetInstance().GetExchangeRateServices().SelectExchangeRate(DateTime.Now, selectedCur); while (_rate == null) { var xrForm = new ExchangeRateForm(DateTime.Now, selectedCur); xrForm.ShowDialog(); if (xrForm.ExchangeRate != null) { if (xrForm.ExchangeRate.Currency.Equals(selectedCur) && xrForm.ExchangeRate.Date.Day.Equals(DateTime.Now.Day)) _rate = xrForm.ExchangeRate; } } } else { _rate = new ExchangeRate(){Rate = 1}; } }