Example #1
0
        private void DgvPrivledge_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dgvUser.SelectedRows.Count > 0)
                {
                    DataGridViewRow row = dgvPrivledge.SelectedRows[0];

                    if (row != null)
                    {
                        int privledgeId = 0;

                        Int32.TryParse(Convert.ToString(row.Cells["PrivledgeId"].Value), out privledgeId);
                        frmPrivledgeAddUpdate form = new frmPrivledgeAddUpdate(privledgeId);
                        form.FormClosed -= Form_PrivledgeFormClosed;
                        form.FormClosed += Form_PrivledgeFormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 private void btnAddPrivledge_Click(object sender, EventArgs e)
 {
     try
     {
         frmPrivledgeAddUpdate form = new frmPrivledgeAddUpdate();
         form.FormClosed += Form_PrivledgeFormClosed;
         form.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void txtPrivledgeSearch_TextChanged(object sender, EventArgs e)
        {
            try
            {
                LoadPrivledgeGrid();

                if (dgvPrivledge.Rows.Count == 0)
                {
                    if (DialogResult.Yes == MessageBox.Show(string.Format(Constants.Messages.NotExists, "Privledge"), Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        frmPrivledgeAddUpdate form = new frmPrivledgeAddUpdate(txtPrivledgeSearch.Text);
                        form.FormClosed += Form_PrivledgeFormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }