Ejemplo n.º 1
0
        private void deleteRestrictionButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("آیا از حذف مطمئن هستید؟", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialogResult == DialogResult.Yes)
            {
                try {
                    selectedRow = validationDataGridView.CurrentCell.RowIndex;

                    SqlManipulator  sql                = new SqlManipulator();
                    DataGridViewRow newDataRow         = validationDataGridView.Rows[selectedRow];
                    validationTable deletedRestriction = new validationTable();


                    deletedRestriction.City        = (long)newDataRow.Cells[2].Value;
                    deletedRestriction.startDate   = (long)newDataRow.Cells[3].Value;
                    deletedRestriction.enDate      = (long)newDataRow.Cells[4].Value;
                    deletedRestriction.id          = (long)newDataRow.Cells[0].Value;
                    deletedRestriction.description = (String)newDataRow.Cells[1].Value;
                    sql.removeRestriction(deletedRestriction);
                    var data = sql.getValidationData();
                    makeValidationTable(data);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }