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() { tableLayoutPanelAA = FormUtility.CreateTableLayoutPanel(1000, 200); 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) { textBoxCurrency.BackColor = Color.Red; return(false); } if (MergeFundProperties() && MergeAssetAllocation()) { passedForm.OnSubmit(); Close(); } return(true); }); FormUtility.AddControlsToForm(this, tableLayoutPanelAA); }
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); }
/// <summary> /// Initialization of self-added controls /// </summary> private void InitializeCustomComponents() { tableLayoutPanel = FormUtility.CreateTableLayoutPanel(50, 80, 300, 800); tableLayoutPanel.BackColor = SystemColors.Control; textBoxAssetId = FormUtility.CreateTextBox(); textBoxIsin = FormUtility.CreateTextBox(); textBoxName = FormUtility.CreateTextBox(); submitButton = FormUtility.CreateButton("Bestätigen", 80, 460); cancelButton = FormUtility.CreateButton("Abbrechen", 780, 460); FormUtility.AddValidation(submitButton, textBoxAssetId, () => { bool isInt = int.TryParse(textBoxAssetId.Text, out int assetId); if (isInt) { if (asset != null) { asset.AssetId = assetId; asset.Isin = textBoxIsin.Text; asset.Name = textBoxName.Text; TableUtility tableUtility = new TableUtility(); tableUtility.MergeTableRow(asset); Close(); return(true); } Asset createdAsset = new Asset(assetId, textBoxIsin.Text, textBoxName.Text); passedObject.OnSubmit(createdAsset); Close(); return(true); } return(false); }); cancelButton.Click += (sender, e) => Close(); tableLayoutPanel.RowCount = 3; tableLayoutPanel.ColumnCount = 2; tableLayoutPanel.Controls.Add(new Label { Text = "Asset-ID", Height = 80, Width = 200 }, 0, 0); tableLayoutPanel.Controls.Add(textBoxAssetId, 1, 0); tableLayoutPanel.Controls.Add(new Label { Text = "ISIN", Height = 80, Width = 200 }, 0, 1); tableLayoutPanel.Controls.Add(textBoxIsin, 1, 1); tableLayoutPanel.Controls.Add(new Label { Text = "Name", Height = 80, Width = 200 }, 0, 2); tableLayoutPanel.Controls.Add(textBoxName, 1, 2); FormUtility.AddControlsToForm(this, tableLayoutPanel, submitButton, cancelButton); }
private void InitializeCustomComponents() { tableLayoutPanel = FormUtility.CreateTableLayoutPanel(50, 80, 300, 800); tableLayoutPanel.BackColor = SystemColors.Control; textBoxName = FormUtility.CreateTextBox(); textBoxIsoCode = FormUtility.CreateTextBox(); submitButton = FormUtility.CreateButton("Bestätigen", 80, 460); cancelButton = FormUtility.CreateButton("Abbrechen", 780, 460); FormUtility.AddValidation(submitButton, new Dictionary <TextBox, Func <bool> > { { textBoxName, () => { if (textBoxName.Text != "") { return(true); } return(false); } }, { textBoxIsoCode, () => { if (textBoxIsoCode.Text != "") { return(true); } return(false); } } }, () => AddCountry() ); cancelButton.Click += (sender, e) => Close(); tableLayoutPanel.RowCount = 2; tableLayoutPanel.ColumnCount = 2; tableLayoutPanel.Controls.Add(new Label { Text = "Name", Height = 80, Width = 200 }, 0, 0); tableLayoutPanel.Controls.Add(textBoxName, 1, 0); tableLayoutPanel.Controls.Add(new Label { Text = "ISO-Code", Height = 80, Width = 200 }, 0, 1); tableLayoutPanel.Controls.Add(textBoxIsoCode, 1, 1); FormUtility.AddControlsToForm(this, tableLayoutPanel, submitButton, cancelButton); }
public void InitializeCustomComponents() { labelName = new Label { Text = "Name", Location = new Point(20, 20), AutoSize = true }; textBoxName = FormUtility.CreateTextBox(300, 20); labelRuleDescription = new Label { Text = "Die Asset Allocation muss innerhalb der strategischen Bandbreiten sein.", Location = new Point(20, 130), AutoSize = true }; FormUtility.AddControlsToForm(this, labelName, textBoxName, labelRuleDescription); }
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() { textBoxName = FormUtility.CreateTextBox(); textBoxRatingClass = FormUtility.CreateTextBox(); textBoxNumericValue = FormUtility.CreateTextBox(); tableLayoutPanel = FormUtility.CreateTableLayoutPanel(25, 25); tableLayoutPanel.BackColor = SystemColors.Control; tableLayoutPanel.RowCount = 3; tableLayoutPanel.ColumnCount = 2; tableLayoutPanel.Controls.Add(new Label { Text = "Name", Height = 80, Width = 200 }, 0, 0); tableLayoutPanel.Controls.Add(textBoxName, 1, 0); tableLayoutPanel.Controls.Add(new Label { Text = "Rating-Klasse", Height = 80, Width = 200 }, 0, 1); tableLayoutPanel.Controls.Add(textBoxRatingClass, 1, 1); tableLayoutPanel.Controls.Add(new Label { Text = "Maximaler Anteil", Height = 80, Width = 200 }, 0, 2); tableLayoutPanel.Controls.Add(textBoxNumericValue, 1, 2); FormUtility.AddControlsToForm(this, tableLayoutPanel); }
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); }
/// <summary> /// Initialization of components, which are added programmatically and not via Designer. /// </summary> private void InitializeCustomComponents() { title = FormUtility.CreateTitle("Regelverwaltung"); tableLayoutPanel = FormUtility.CreateTableLayoutPanel(43, 180, 1060, 2980); ToolStripMenuItem itemDelete = FormUtility.CreateContextMenuItem("Löschen", DeleteRuleRow); ToolStripMenuItem itemEdit = FormUtility.CreateContextMenuItem("Bearbeiten", EditRuleRow); contextMenu = contextMenu = FormUtility.CreateContextMenu(itemEdit, itemDelete); contextMenu.Opening += (sender, e) => { ContextMenuStrip ctxMenu = sender as ContextMenuStrip; int row = tableLayoutPanel.GetRow(ctxMenu.SourceControl); Rule rule = tableLayoutPanel.GetControlFromPosition(0, row).DataBindings[0].DataSource as Rule; if (rule.RuleKind == RuleKind.AA_MAX_DIFF_RANGES) { contextMenu.Items[0].Enabled = false; } else { contextMenu.Items[0].Enabled = true; } }; submitButton = FormUtility.CreateButton("Bestätigen"); submitButton.Location = new Point(ClientSize.Width - submitButton.Width - 500, ClientSize.Height - submitButton.Height - 30); submitButton.Click += new EventHandler(ButtonSubmitClick); cancelButton = FormUtility.CreateButton("Abbrechen"); cancelButton.Location = new Point(ClientSize.Width - cancelButton.Width - 30, ClientSize.Height - cancelButton.Height - 30); cancelButton.Click += new EventHandler(ButtonCloseClick); addNewRuleButton = FormUtility.CreateButton("Neue Regel hinzufügen"); addNewRuleButton.Location = new Point(ClientSize.Width - addNewRuleButton.Width - 30, 30); addNewRuleButton.Click += new EventHandler(AddNewRuleClick); FormUtility.AddControlsToForm(this, title, tableLayoutPanel, submitButton, cancelButton, addNewRuleButton); }
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); }