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

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

                        Int32.TryParse(Convert.ToString(row.Cells["UserId"].Value), out userId);
                        frmUserMasterAddUpdate form = new frmUserMasterAddUpdate(userId);
                        form.FormClosed -= Form_FormClosed;
                        form.FormClosed += Form_FormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 private void btnAddNewUser_Click(object sender, EventArgs e)
 {
     try
     {
         frmUserMasterAddUpdate frm = new frmUserMasterAddUpdate();
         frm.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            try
            {
                LoadUserGrid();

                if (dgvUser.Rows.Count == 0)
                {
                    if (DialogResult.Yes == MessageBox.Show(string.Format(Constants.Messages.NotExists, "User"), Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        frmUserMasterAddUpdate form = new frmUserMasterAddUpdate(txtSearch.Text);
                        form.FormClosed += Form_FormClosed;
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }