Exemplo n.º 1
0
        /// <summary>
        /// Deletes rule from the table and database.
        /// </summary>
        /// <param name="sender"><see cref="ToolStripMenuItem"/> Clicked menu item</param>
        /// <param name="e"><see cref="EventArgs"/></param>
        public void DeleteRuleRow(object sender, EventArgs e)
        {
            Control      firstControl = GetClickedRuleElement(sender);
            TableUtility tableUtility = new TableUtility();

            tableUtility.DeleteTableRow(firstControl.DataBindings[0].DataSource as Rule);
            FormUtility.DeleteTableRow(tableLayoutPanel, firstControl);
        }
Exemplo n.º 2
0
        private void DeleteClick(object sender, EventArgs e)
        {
            TableUtility tableUtility   = new TableUtility();
            Persistable  objectToDelete = currentDataGridView.Rows[currentRowIndex].DataBoundItem as Persistable;

            currentDataGridView.Rows.RemoveAt(currentRowIndex);
            tableUtility.DeleteTableRow(objectToDelete);
        }
Exemplo n.º 3
0
        private void DeleteClick(object sender, EventArgs e)
        {
            TableUtility tableUtility   = new TableUtility(Globals.WatchdogAddIn.Application.ActiveWorkbook);
            Persistable  objectToDelete = currentDataGridView.Rows[currentRowIndex].DataBoundItem as Persistable;

            currentDataGridView.Rows.RemoveAt(currentRowIndex);
            tableUtility.DeleteTableRow(objectToDelete, objectToDelete.GetIndex());
        }
        private void DeleteFundClick(object sender, EventArgs e)
        {
            TableUtility    tableUtility   = new TableUtility();
            DataGridViewRow selectedRow    = dataGridFunds.SelectedRows[0];
            Persistable     objectToDelete = selectedRow.DataBoundItem as Persistable;

            dataGridFunds.Rows.RemoveAt(selectedRow.Index);
            tableUtility.DeleteTableRow(objectToDelete);
        }
        private void DeleteRatingAgencyClick(object sender, EventArgs e)
        {
            TableUtility  tableUtility         = new TableUtility();
            RatingAgency  ratingAgencyToDelete = dataGridViewRatingAgencies.Rows[ratingAgenciesRowIndex].DataBoundItem as RatingAgency;
            List <Rating> ratingsToDelete      = tableUtility.ConvertRangesToObjects <Rating>(tableUtility.ReadTableRow(Rating.GetDefaultValue(), new Dictionary <string, string>
            {
                { "Agency", ratingAgencyToDelete.GetIndex().ToString() }
            }, QueryOperator.OR));

            foreach (Rating rating in ratingsToDelete)
            {
                tableUtility.DeleteTableRow(rating);
            }
            tableUtility.DeleteTableRow(ratingAgencyToDelete);
            FormUtility.GetBindingSource(dataGridViewRatingAgencies).RemoveAt(ratingAgenciesRowIndex);
            LoadRatings(ratingAgenciesRowIndex);
            if (FormUtility.GetBindingSource(dataGridViewRatingAgencies).Count == 0)
            {
                currentRatingAgency = null;
            }
        }
        private void DeleteRow(object sender, KeyEventArgs e)
        {
            if (currentRow == null)
            {
                return;
            }

            if (e.KeyCode == Keys.Delete)
            {
                TableUtility tableUtility = new TableUtility();
                tableUtility.DeleteTableRow(currentRow);
                dataGridViewRatingCodes.Rows.RemoveAt(ratingsCurrentRowIndex);
            }
        }
Exemplo n.º 7
0
        private void DeleteRow(object sender, KeyEventArgs e)
        {
            if (currentRow == null)
            {
                return;
            }

            if (e.KeyCode == Keys.Delete)
            {
                TableUtility tableUtility = new TableUtility(Globals.WatchdogAddIn.Application.ActiveWorkbook);
                tableUtility.DeleteTableRow(currentRow, currentRow.GetIndex());
                dataGridViewRatingCodes.Rows.RemoveAt(ratingsCurrentRowIndex);
            }
        }
Exemplo n.º 8
0
        /// <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);
        }
Exemplo n.º 9
0
        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);
        }