/// <summary> /// Logs into selected company on Enter key /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSelectCompany_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (dgvSelectCompany.CurrentRow.Index != -1) { PublicVariables._decCurrentCompanyId = Convert.ToDecimal(dgvSelectCompany.SelectedRows[0].Cells["dgvtxtCompanyId"].Value.ToString()); CurrentDate(); frmLogin frmLoginObj = new frmLogin(); frmLoginObj.MdiParent = formMDI.MDIObj; frmLoginObj.CallFromSelectCompany(this); } } else if (e.KeyCode == Keys.Escape) { if (PublicVariables.isMessageClose) { Messages.CloseMessage(this); } else { this.Close(); } } } catch (Exception ex) { MessageBox.Show("SELCMPNY :6 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On Datagridview cell double click enables to loginto that company /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSelectCompany_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvSelectCompany.CurrentRow.Index == e.RowIndex) { PublicVariables._decCurrentCompanyId = Convert.ToDecimal(dgvSelectCompany.Rows[e.RowIndex].Cells["dgvtxtCompanyId"].Value.ToString()); CurrentDate(); frmLogin frmLoginObj = new frmLogin(); frmLoginObj.MdiParent = formMDI.MDIObj; frmLoginObj.CallFromSelectCompany(this); } } catch (Exception ex) { MessageBox.Show("SELCMPNY :5 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }