Exemplo n.º 1
0
        private void btAddOperator_Click(object sender, EventArgs e)
        {
            EditOperator eo = new EditOperator(true, null);

            eo.ShowDialog(this);
            opList.Rows.Clear();
            showOperatorList();
            resizeColumns();
        }
Exemplo n.º 2
0
        private void dgvOperatorList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            //Open EditOperator form
            if (dgv.Columns[e.ColumnIndex].Name == FindingsEditor.Properties.Resources.Edit)
            {
                if (!uckyFunctions.canEdit("operator", "operator_id", "LIKE", "'" + dgv.Rows[e.RowIndex].Cells[2].Value.ToString() + "'"))
                {
                    MessageBox.Show(FindingsEditor.Properties.Resources.PermissionDenied, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                EditOperator eo = new EditOperator(false, dgv.Rows[e.RowIndex].Cells[2].Value.ToString());
                eo.ShowDialog(this);
                opList.Rows.Clear();
                showOperatorList();
                resizeColumns();
                return;
            }

            //Delete operator
            if (dgv.Columns[e.ColumnIndex].Name == FindingsEditor.Properties.Resources.Delete)
            {
                examOperator examOp = new examOperator(dgv.Rows[e.RowIndex].Cells[2].Value.ToString(), false);
                switch (examOp.examCount())
                {
                case -1:
                    MessageBox.Show(FindingsEditor.Properties.Resources.DataBaseError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case 0:
                    if (MessageBox.Show(FindingsEditor.Properties.Resources.ConfirmDel, "Information", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        examOp.deleteExamOp();
                        opList.Rows.Clear();
                        showOperatorList();
                        resizeColumns();
                        break;
                    }
                    else
                    {
                        break;
                    }

                default:
                    MessageBox.Show(FindingsEditor.Properties.Resources.CouldntDelOp, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
            }
        }
Exemplo n.º 3
0
 private void btAddOperator_Click(object sender, EventArgs e)
 {
     EditOperator eo = new EditOperator(true, null);
     eo.ShowDialog(this);
     opList.Rows.Clear();
     showOperatorList();
     resizeColumns();
 }
Exemplo n.º 4
0
        private void dgvOperatorList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            //Open EditOperator form
            if (dgv.Columns[e.ColumnIndex].Name == Properties.Resources.Edit)
            {
                if (!uckyFunctions.canEdit("operator", "operator_id", "LIKE", "'" + dgv.Rows[e.RowIndex].Cells[2].Value.ToString() + "'"))
                {
                    MessageBox.Show(Properties.Resources.PermissionDenied, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                EditOperator eo = new EditOperator(false, dgv.Rows[e.RowIndex].Cells[2].Value.ToString());
                eo.ShowDialog(this);
                opList.Rows.Clear();
                showOperatorList();
                resizeColumns();
                return;
            }

            //Delete operator
            if (dgv.Columns[e.ColumnIndex].Name == Properties.Resources.Delete)
            {
                examOperator examOp = new examOperator(dgv.Rows[e.RowIndex].Cells[2].Value.ToString(), false);
                switch (examOp.examCount())
                {
                    case -1:
                        MessageBox.Show(Properties.Resources.DataBaseError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    case 0:
                        if (MessageBox.Show(Properties.Resources.ConfirmDel, "Information", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            examOp.deleteExamOp();
                            opList.Rows.Clear();
                            showOperatorList();
                            resizeColumns();
                            break;
                        }
                        else
                        {
                            break;
                        }
                    default:
                        MessageBox.Show(Properties.Resources.CouldntDelOp, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        break;
                }
            }
        }