예제 #1
0
        /// <summary>
        /// Form keydown for quick access
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmSalesReturn_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Escape)
                {
                    if (PublicVariables.isMessageClose)
                    {
                        Messages.CloseMessage(this);
                    }
                    else
                    {
                        this.Close();
                    }
                }

                if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control)
                {
                    if (cmbCashOrParty.Focused)
                    {
                        cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDownList;
                    }
                    else
                    {
                        cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDownList;
                    }
                    btnSave_Click(sender, e);
                }

                if (btnDelete.Enabled == true)
                {
                    if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control)
                    {
                        if (cmbCashOrParty.Focused)
                        {
                            cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDown;
                        }
                        else
                        {
                            cmbCashOrParty.DropDownStyle = ComboBoxStyle.DropDownList;
                        }
                        btnDelete_Click(sender, e);
                    }
                }

                if (dgvSalesReturn.RowCount > 0)
                {
                    if (dgvSalesReturn.CurrentCell != null)
                    {
                        if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt)
                        {
                            if (dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductName" || dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductCode")
                            {
                                if (cmbInvoiceNo.Visible == false)
                                {
                                    SendKeys.Send("{F10}");
                                    if (dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductName" || dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductCode")
                                    {
                                        frmProductCreation frmProductCreationObj = new frmProductCreation();
                                        frmProductCreationObj.MdiParent = formMDI.MDIObj;
                                        frmProductCreationObj.CallFromSalesReturn(this);
                                    }
                                }
                            }
                        }
                    }
                }

                if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control)
                {
                    if (dgvSalesReturn.CurrentCell != null)
                    {
                        if (dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductName" || dgvSalesReturn.Columns[dgvSalesReturn.CurrentCell.ColumnIndex].Name == "dgvTextProductCode")
                        {
                            if (cmbInvoiceNo.Visible == false)
                            {
                                SendKeys.Send("{F10}");
                                frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup();
                                frmProductSearchPopupObj.MdiParent = formMDI.MDIObj;
                                if (dgvSalesReturn.CurrentRow.Cells["dgvTextProductName"].Value != null || dgvSalesReturn.CurrentRow.Cells["dgvTextProductCode"].Value != null)
                                {
                                    frmProductSearchPopupObj.CallFromSalesReturn(this, dgvSalesReturn.CurrentRow.Index, dgvSalesReturn.CurrentRow.Cells["dgvTextProductCode"].Value.ToString());
                                }
                                else
                                {
                                    frmProductSearchPopupObj.CallFromSalesReturn(this, dgvSalesReturn.CurrentRow.Index, string.Empty);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SR116:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }