private void InitializeCustomComponents() { dataGridFunds = FormUtility.CreateDataGridView(typeof(Fund), 80, 580); ToolStripMenuItem itemDelete = FormUtility.CreateContextMenuItem("Löschen", DeleteFundClick); ToolStripMenuItem itemEditFund = FormUtility.CreateContextMenuItem("Fonds bearbeiten", EditFundClick); FormUtility.AddContextMenu(dataGridFunds, itemDelete, itemEditFund); FormUtility.GetBindingSource(dataGridFunds).Clear(); FormUtility.AddValidation(buttonSubmit, textBoxCurrency, () => { TableUtility tableUtility = new TableUtility(); List <Range> currencyRange = tableUtility.ReadTableRow(Currency.GetDefaultValue(), new Dictionary <string, string> { { "IsoCode", textBoxCurrency.Text.ToUpper() } }, QueryOperator.OR); if (currencyRange.Count == 0 || currencyRange.Count > 1) { return(false); } Currency currency = tableUtility.ConvertRangesToObjects <Currency>(currencyRange)[0]; Fund newFund = new Fund(textBoxFundName.Text, textBoxIsin.Text, textBoxCustodyNr.Text, currency); tableUtility.InsertTableRow(newFund); FormUtility.GetBindingSource(dataGridFunds).Add(newFund); return(true); }); FormUtility.AddControlsToForm(this, dataGridFunds); }
private void InitializeCustomComponents() { dataGridViewAssetClasses = FormUtility.CreateDataGridView(typeof(AssetClass), 80, 246, 600, 400); dataGridViewCurrencies = FormUtility.CreateDataGridView(typeof(Currency), 700, 246, 600, 200); ToolStripMenuItem itemDeleteAssetClass = FormUtility.CreateContextMenuItem("Löschen", DeleteAssetClass); ToolStripMenuItem itemDeleteCurreny = FormUtility.CreateContextMenuItem("Löschen", DeleteCurrency); FormUtility.AddContextMenu(dataGridViewAssetClasses, itemDeleteAssetClass); FormUtility.AddContextMenu(dataGridViewCurrencies, itemDeleteCurreny); FormUtility.AddControlsToForm(this, dataGridViewCurrencies, dataGridViewAssetClasses); }
private void InitializeCustomComponents() { dataGridViewRatingAgencies = FormUtility.CreateDataGridView(typeof(RatingAgency), 55, 308, 600, 400); dataGridViewRatingCodes = FormUtility.CreateDataGridView(typeof(Rating), 650, 308, 600, 600); dataGridViewRatingCodes.AllowUserToAddRows = true; ToolStripMenuItem deleteAgency = FormUtility.CreateContextMenuItem("Löschen", DeleteRatingAgencyClick); FormUtility.AddContextMenu(dataGridViewRatingAgencies, deleteAgency); FormUtility.AddDataGridViewEditingHandlers(dataGridViewRatingCodes, CatchCurrentRowState, RowValidatedRatings, DeleteRow); dataGridViewRatingAgencies.MouseClick += (sender, e) => { ClickRatingAgencies(sender, e); }; dataGridViewRatingAgencies.MouseDown += (sender, e) => { DataGridRatingAgenciesMouseDown(sender, e); }; FormUtility.AddControlsToForm(this, dataGridViewRatingAgencies, dataGridViewRatingCodes); }
/// <summary> /// Initializes the programmatically added controls. /// </summary> private void InitializeCustomComponents() { save = FormUtility.CreateButton("Speichern", 50, 230); addNewRecord = FormUtility.CreateButton("Neuen Eintrag hinzufügen", 630, 0); addNewRecord.Click += (sender, e) => new AddDurationRecordForm(this).Visible = true; dataGridView = FormUtility.CreateDataGridView(typeof(DurationRecord), 630, 140, 300, 600); ToolStripMenuItem contextMenuItemDelete = FormUtility.CreateContextMenuItem("Löschen", (sender, e) => { TableUtility tableUtility = new TableUtility(); tableUtility.DeleteTableRow(GetSelectedRecord()); dataGridView.Rows.Remove(dataGridView.SelectedRows[0]); }); ToolStripMenuItem contextMenuItemEdit = FormUtility.CreateContextMenuItem("Bearbeiten", (sender, e) => { _ = new AddDurationRecordForm(GetSelectedRecord(), this) { Visible = true }; }); FormUtility.AddContextMenu(dataGridView, contextMenuItemEdit, contextMenuItemDelete); FormUtility.AddControlsToForm(this, dataGridView, save, addNewRecord); }
private void InitializeCustomComponents() { ruleName = FormUtility.CreateTextBox(20, 5); addNewCountry = FormUtility.CreateButton("Neues Land hinzufügen", 20, 65); addNewCountry.Click += (sender, e) => new AddCountryForm(this).Visible = true; dataGridView = FormUtility.CreateDataGridView(typeof(Country), 20, 210, 400, 1050); ToolStripMenuItem contextMenuItemDelete = FormUtility.CreateContextMenuItem("Löschen", (sender, e) => { TableUtility tableUtility = new TableUtility(); tableUtility.DeleteTableRow(GetSelectedCountry()); dataGridView.Rows.Remove(dataGridView.SelectedRows[0]); }); ToolStripMenuItem contextMenuItemEdit = FormUtility.CreateContextMenuItem("Bearbeiten", (sender, e) => { _ = new AddCountryForm(GetSelectedCountry(), this) { Visible = true }; }); FormUtility.AddContextMenu(dataGridView, contextMenuItemEdit, contextMenuItemDelete); FormUtility.AddControlsToForm(this, dataGridView, addNewCountry, ruleName); }
private void InitializeCustomComponents() { ruleName = FormUtility.CreateTextBox(20, 5); addNewAssetKind = FormUtility.CreateButton("Neue Titelart hinzufügen", 20, 65); addNewAssetKind.Click += (sender, e) => new OneAttributeForm(this, "Titelart", "asset_kind").Visible = true; dataGridView = FormUtility.CreateDataGridView(typeof(AssetKind), 20, 210, 400, 1050); ToolStripMenuItem contextMenuItemDelete = FormUtility.CreateContextMenuItem("Löschen", (sender, e) => { TableUtility tableUtility = new TableUtility(); tableUtility.DeleteTableRow(GetSelectedAssetKind()); dataGridView.Rows.Remove(dataGridView.SelectedRows[0]); }); ToolStripMenuItem contextMenuItemEdit = FormUtility.CreateContextMenuItem("Bearbeiten", (sender, e) => { selectedAssetKind = GetSelectedAssetKind(); _ = new OneAttributeForm(this, "Titelart", "asset_kind_edit", selectedAssetKind.Description) { Visible = true }; }); FormUtility.AddContextMenu(dataGridView, contextMenuItemEdit, contextMenuItemDelete); FormUtility.AddControlsToForm(this, dataGridView, addNewAssetKind, ruleName); }