private void PrepareForm() { cboBillingPeriod.DataSource = BillingPeriod.GetBillingPeriods(); cboBillingPeriod.DisplayMember = "Name"; cboBillingPeriod.ValueMember = "PeriodId"; cboCurrency.DataSource = CurrenciesRepo.GetAll(); cboCurrency.DisplayMember = "Name"; cboCurrency.ValueMember = "Id"; cboSettlementModel.DataSource = SettlementModelsRepo.GetAll(); cboSettlementModel.DisplayMember = "Name"; cboSettlementModel.ValueMember = "Id"; }
private void gridExCurrencies_AddingRecord(object sender, System.ComponentModel.CancelEventArgs e) { bool currencyExists = CurrenciesRepo.CheckIfCurrencyExists(gridExCurrencies.CurrentRow.Cells["Waluta"].Value.ToString()); if (currencyExists) { MessageBox.Show(string.Format("Waluta '{0}' już istnieje.", gridExCurrencies.CurrentRow.Cells["Waluta"].Value.ToString()), "Nowa waluta", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; } else { this.isCurrencyUpdatePending = true; gridExCurrencies.RootTable.AllowAddNew = Janus.Windows.GridEX.InheritableBoolean.False; } }
private void GetNBPRates() { FrmDictCurrenciesNBPPicker frmDictCurrenciesNBPPicker = new FrmDictCurrenciesNBPPicker(); if (frmDictCurrenciesNBPPicker.ShowDialog() == DialogResult.OK) { DateTime dateFrom = frmDictCurrenciesNBPPicker.dateFrom; DateTime dateTo = frmDictCurrenciesNBPPicker.dateTo; dateFrom = new DateTime(dateFrom.Year, dateFrom.Month, 1); dateTo = new DateTime(dateTo.Year, dateTo.Month, 1); if (dateTo.Month == DateTime.Now.Month && dateTo.Year == DateTime.Now.Year) { dateTo.AddMonths(-1); } foreach (GridEXRow row in gridExCurrencies.GetRows()) { string currencyName = row.Cells["Waluta"].Value.ToString(); if (currencyName != "PLN") { if (NBPHelper.CurrencyExists(currencyName)) { DateTime dateIterator = dateFrom; do { CurrencyRate currencyRate = NBPHelper.GetRate(currencyName, dateIterator); CurrenciesRepo.Insert(currencyRate, (int)row.Cells["Id"].Value); dateIterator = dateIterator.AddMonths(1); }while (dateIterator <= dateTo); } else { MessageBox.Show(string.Format("Waluta {0} nie została odnaleziona w NBP!", currencyName), "Kurs NBP", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } this.LoadRates((int)gridExCurrencies.CurrentRow.Cells["id"].Value); MessageBox.Show(string.Format("Pobrano kursy dla zadanego okresu."), "Kurs NBP", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void LoadScheduleTab() { GridEXColumn colCurrency = gridExSchedule.RootTable.Columns["WalutaId"]; colCurrency.HasValueList = true; GridEXValueListItemCollection valuesCboCurrency = colCurrency.ValueList; List <Currency> lstCurrencies = CurrenciesRepo.GetAll(); foreach (var currency in lstCurrencies) { valuesCboCurrency.Add(currency.Id, currency.Name); } colCurrency.EditType = Janus.Windows.GridEX.EditType.DropDownList; colCurrency.CompareTarget = Janus.Windows.GridEX.ColumnCompareTarget.Text; colCurrency.DefaultGroupInterval = Janus.Windows.GridEX.GroupInterval.Text; this.gridScheduleRepo.BindDataSet(gridExSchedule, agreement.Id); }