Exemplo n.º 1
0
 /// <summary>
 /// For enter key and backspace navigation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbItem_KeyDown(object sender, KeyEventArgs e)
 {
     string strProductName;
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         if (e.KeyCode == Keys.Enter)
         {
             if (BllSettings.SettingsStatusCheck("AllowGodown") == "Yes")
             {
                 cmbGodown.Focus();
                 cmbGodown.SelectionStart = 0;
             }
             else if (BllSettings.SettingsStatusCheck("AllowBatch") == "Yes")
             {
                 cmbBatch.Focus();
             }
             else
             {
                 txtQuantity.Focus();
                 txtQuantity.Select();
             }
         }
         else if (e.KeyCode == Keys.Back)
         {
             if (txtProductCode.Visible)
             {
                 if (txtProductCode.Text.Trim() != string.Empty || txtProductCode.SelectionLength == 0)
                 {
                     txtProductCode.SelectionStart = 0;
                     txtProductCode.Focus();
                 }
             }
             else
             {
                 txtBarcode.Focus();
                 txtBarcode.Select();
             }
         }
         else if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up
         {
             if (cmbItem.Focused)
             {
                 cmbItem.DropDownStyle = ComboBoxStyle.DropDown;
             }
             else
             {
                 cmbItem.DropDownStyle = ComboBoxStyle.DropDownList;
             }
             if (cmbItem.SelectedIndex != -1)
             {
                 frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup();
                 frmProductSearchPopupObj.MdiParent = formMDI.MDIObj;
                 frmProductSearchPopupObj.CallFromPOS(this, cmbItem.SelectedIndex, txtProductCode.Text);
             }
             else
             {
                 frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup();
                 frmProductSearchPopupObj.MdiParent = formMDI.MDIObj;
                 frmProductSearchPopupObj.CallFromPOS(this, cmbItem.SelectedIndex, string.Empty);
             }
         }
         else if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Creation
         {
             frmProductCreation frmProductCreationObj = new frmProductCreation();
             bool isFromItemCombo = true;
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmProductCreation", "Save"))
             {
                 if (cmbItem.SelectedValue != null)
                 {
                     strProductName = cmbItem.SelectedValue.ToString();
                 }
                 else
                 {
                     strProductName = string.Empty;
                 }
                 frmProductCreationObj.MdiParent = formMDI.MDIObj;
                 frmProductCreationObj.CallFromPOSForProductCreation(this, isFromItemCombo);
             }
             else
             {
                 MessageBox.Show("You don’t have privilege", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS: 116" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }