コード例 #1
0
        private void DgvRole_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dgvRole.SelectedRows.Count > 0)
                {
                    DataGridViewRow row = dgvRole.SelectedRows[0];

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

                        Int32.TryParse(Convert.ToString(row.Cells["RoleId"].Value), out roleId);
                        frmRoleAddUpdate form = new frmRoleAddUpdate(roleId);
                        form.FormClosed -= Form_RoleFormClosed;
                        form.FormClosed += Form_RoleFormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
 private void btnAddRole_Click(object sender, EventArgs e)
 {
     try
     {
         frmRoleAddUpdate form = new frmRoleAddUpdate();
         form.FormClosed += Form_RoleFormClosed;
         form.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #3
0
        private void txtRoleSearch_TextChanged(object sender, EventArgs e)
        {
            try
            {
                LoadRoleGrid();

                if (dgvRole.Rows.Count == 0)
                {
                    if (DialogResult.Yes == MessageBox.Show(string.Format(Constants.Messages.NotExists, "Role"), Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        frmRoleAddUpdate form = new frmRoleAddUpdate(txtRoleSearch.Text);
                        form.FormClosed += Form_RoleFormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }