void dgv_SelectionChanged(object sender, EventArgs e = null)
        {
            DataGridView dgv = sender as DataGridView;

            if (dgv.SelectedRows.Count != 1)
            {
                return;
            }

            _displayedDataRow = null; //to avoid updating while attributes are written

            RowTag dataBaseRow = dgv.SelectedRows[0].Tag as RowTag;

            //fill controls with database attributes
            txtPath.Text                 = (dataBaseRow == null) ? string.Empty : dataBaseRow.FilePath;
            txtYearCollection.Text       = (dataBaseRow == null) ? string.Empty : dataBaseRow.YearCollection;
            txtYearIncome.Text           = (dataBaseRow == null) ? string.Empty : dataBaseRow.YearInc;
            txtListStringOutVar.Text     = (dataBaseRow == null) ? string.Empty : dataBaseRow.ListStringOutVar;
            txtIndirectTaxTableYear.Text = (dataBaseRow == null) ? string.Empty : dataBaseRow.IndirectTaxTableYear;
            string currency = (dataBaseRow == null) ? string.Empty : dataBaseRow.Currency.ToLower();

            cboCurrency.SelectedIndex = 0;
            for (int i = 0; i < GetCurrencies().Count; ++i)
            {
                if (GetCurrencies().ElementAt(i).ToLower() == currency)
                {
                    cboCurrency.SelectedIndex = i;
                    break;
                }
            }
            string decimalSign = (dataBaseRow == null) ? string.Empty : dataBaseRow.DecimalSign;

            cboDecimalSign.SelectedIndex = 0;
            for (int index = 0; index < GetDecimalSigns().Count; ++index)
            {
                if (GetDecimalSigns().ElementAt(index).ToLower() == decimalSign)
                {
                    cboDecimalSign.SelectedIndex = index;
                    break;
                }
            }
            chkPrivate.Checked = (dataBaseRow != null && dataBaseRow.Private == DefPar.Value.YES);

            if (dataBaseRow != null && dataBaseRow.IsCommonDefaultNull)
            {
                OptionalWarningsManager.ShowOutdatedWarning("The parameter 'UseCommonDefault' does not exist for dataset '" + dataBaseRow.Name +
                                                            "'." + Environment.NewLine + "This is probably due to using an outdated TXT-to-XLM-converter." + Environment.NewLine + "Please make sure that the parameter is set properly.");
            }

            chkUseCommonDefault.Checked = (dataBaseRow != null && !dataBaseRow.IsCommonDefaultNull && dataBaseRow.UseCommonDefault == DefPar.Value.YES);

            chkReadXVariables.Checked = (dataBaseRow != null && dataBaseRow.ReadXVariables == DefPar.Value.YES);

            //this is to make btnRenameDatabase_Click work (see comment in function)
            dgv.SelectedRows[0].HeaderCell.Value = dataBaseRow.Name;

            _displayedDataRow = dataBaseRow;
        }
Esempio n. 2
0
        void InitialiseWarnings()
        {
            Dictionary <string, bool> optionalWarnings = OptionalWarningsManager.GetOptionalWarnings();

            foreach (string optionalWarning in optionalWarnings.Keys)
            {
                int index = lstWarnings.Items.Add(optionalWarning);
                lstWarnings.SetItemChecked(index, optionalWarnings[optionalWarning]);
            }
        }
Esempio n. 3
0
        void StoreWarnings()
        {
            string optionalWarnings = string.Empty;

            for (int index = 0; index < lstWarnings.Items.Count; ++index)
            {
                if (lstWarnings.GetItemChecked(index))
                {
                    optionalWarnings += '1';
                }
                else
                {
                    optionalWarnings += '0';
                }
            }
            OptionalWarningsManager.SetOptionalWarnings(optionalWarnings);
        }
Esempio n. 4
0
        void btnOK_Click(object sender, EventArgs e)
        {
            //outcommented, mainly because it is not true for add-ons, but also as there is no obvious reason to check for this
            //if (txtShortName.Text.Length != 2)
            //{
            //    if (Tools.UserInfoHandler.GetInfo("Short Name is supposed to have two characters. Do you want to correct?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            //        return;
            //}

            if (_countryRow.ShortName != txtShortName.Text)
            {
                if (!OptionalWarningsManager.Show(OptionalWarningsManager._changeCountryShortNameWarning))
                {
                    return;
                }
            }

            _countryRow.Name = txtLongName.Text;
            //_countryRow.ShortName = txtShortName.Text; //country short name cannot be changed (anymore) as this leads to crashes (see County.cs function CheckForCorrespondenceOfCountryShortName)
            _countryRow.Private = chkPrivate.Checked ? DefPar.Value.YES : DefPar.Value.NO;

            DialogResult = DialogResult.OK;
            Close();
        }