/// <summary> /// Clean up any resources being used. /// </summary> #endregion #region Events private void txtAdquire_Click(object sender, EventArgs e) { if (oTeacher.Find(txtTeacher.Text)) { if (oTeacher.Scanned) { if ((MessageBox.Show("Add more images?", "Add Forms...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)) { txtTeacher.Clear(); return; } } try { picnumber = 0; twainDevice.ShowUserInterface = false; twainDevice.StartSession(); twainDevice.CloseSession(); if (picnumber > 0) { oCustomer.Teachers[oCustomer.Teachers.Index].Scanned = true; oTeacher.Scanned = true; oTeacher.UpdateStatus(); if (this.SetNextTeacher()) { txtTeacher.Text = oTeacher.Name; } else { txtTeacher.Clear(); txtTeacher.Focus(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); GetError(); } } else { MessageBox.Show("This teacher doesn't exist"); } }
private void gKits_Enter(object sender, EventArgs e) { if (gKits.Rows.Count > 0) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; if (gKits.ActiveRow == null) { gridRow = gKits.Rows[0]; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.First); } else { gridRow = gKits.ActiveRow; } if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } } else { txtCustomerID.Focus(); } }
private void btSave_Click(object sender, EventArgs e) { oCustomer.Kits.Save(oCustomer); Clear(); gKits.Rows.Dispose(); txtCustomerID.Focus(); }
private void bNext_Click(object sender, EventArgs e) { if (curActivity == Discrepancy.DiscrepancyActivity.Busy) { oOrder.SetStatus(Discrepancy.DiscrepancyActivity.NoAction); } if (oOrder.GetNextOrder(txtCustomerID.Text) != 0) { oOrder.Find(oOrder.GetNextOrder(txtCustomerID.Text)); txtStudent.Text = oOrder.Student; txtTeacher.Text = oOrder.Teacher; if (oOrder.FindText(Convert.ToInt32(oOrder.ID))) { txtText.Text = oOrder.LetterText; } else { txtText.Text = ""; lbDiff.Text = oOrder.Diff.ToString(); } if (oOrder.oImage.OrderID != 0) { bPrintImage.Visible = true; } else { bPrintImage.Visible = false; } // oOrder.SetStatus(Discrepancy.DiscrepancyActivity.Busy); //groupBox3.Focus(); //txtText.Text = ""; txtText.Focus(); } else { MessageBox.Show("Discrepancy done with this school"); txtCustomerID.Focus(); } }
private void btSave_Click(object sender, EventArgs e) { oCustomer.Kits.Save(oCustomer); bPrint_Click(null, null); Clear(); oCustomer.Kits.dtKits.Rows.Clear(); gKits.DataBind(); txtCustomerID.Focus(); }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtProductID if (sender == txtProductID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oProduct.View()) { Clear(); txtProductID.Text = oProduct.ID; txtDescription.Text = oProduct.Description; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductID.Text.Trim().Length == 0) { Clear(); txtProductID.Focus(); } if (oProduct.Find(txtProductID.Text)) { Clear(); txtDescription.Text = oProduct.Description; } else { Clear(); } } } #endregion #region txtQuanity if (sender == txtQuantity) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductID.Text.Trim().Length == 0) { Clear(); txtQuantity.Focus(); } Int32 Quantity = (Int32)txtQuantity.Value; if (Quantity == 0) { txtQuantity.Focus(); return; } txtAdjDescription.Focus(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F3: { if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } else { Clear(); txtProductID.Focus(); } } break; case Keys.F7: this.Close(); break; case Keys.PageDown: Save(); txtProductID.Focus(); break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtBrochureID if (sender == txtBrochureID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oBrochure.View()) { ShowVendor(); } if (txtBrochureID.Text == "") { return; } txtDescription.Focus(); Grid.DataSource = oBrochure.Items.dtItems; Grid.DataBind(); Grid.Focus(); MoveLast(); return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtBrochureID.Text.Trim().Length == 0) { Clear(); txtBrochureID.Focus(); } if (oBrochure.Find(txtBrochureID.Text)) { ShowVendor(); Grid.DataSource = oBrochure.Items.dtItems; Grid.DataBind(); Grid.Focus(); MoveLast(); } else { Clear(); oBrochure.ID = txtBrochureID.Text; oBrochure.Items.AddEmpty(); Grid.DataSource = oBrochure.Items.dtItems; Grid.DataBind(); txtDescription.Focus(); } return; } } #endregion #region txtDescription if (sender == txtDescription) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { oBrochure.Description = txtDescription.Text; Grid.Focus(); MoveLast(); return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.F2) { UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveRow.Cells["ProductID"] == Grid.ActiveCell) { if (oProduct.View()) { if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["InvCode"].Value = oProduct.InvCode; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["Price"].Activate(); Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } else { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } } } } } if (e.KeyCode == Keys.Delete) { } if (e.KeyCode == Keys.Enter) { if (Grid.ActiveRow.Cells["ProductID"].Text != "" && !Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { if (Grid.ActiveRow.Cells["ProductID"] == Grid.ActiveCell) { if (oProduct.Find(Grid.ActiveRow.Cells["ProductID"].Text)) { if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["InvCode"].Value = oProduct.InvCode; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["Price"].Activate(); Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } else { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } } } else if (Grid.ActiveRow.Cells["Price"] == Grid.ActiveCell) { Grid.ActiveRow.Cells["Forecast"].Activate(); Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } if (Grid.GetRow(ChildRow.Last) == Grid.ActiveRow) { oBrochure.Items.AddEmpty(); Grid.DataBind(); MoveLast(); //Grid.PerformAction(UltraGridAction.LastRowInBand, false, false); } else { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } else { Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); Grid.ActiveRow.Cells["Price"].Value = 0; } return; } if (e.KeyCode == Keys.Down) { MoveDown(); return; } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } return; //SendKeys.Send("{TAB}"); } } #endregion #region txtProductID if (sender == txtProductID) { if (e.KeyCode.ToString() == "F2") { if (oProduct.View()) { txtProductID.Text = oProduct.ID; txtPDescription.Text = oProduct.Description; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductID.Text.Trim().Length == 0) { txtProductID.Focus(); } if (oProduct.Find(txtProductID.Text)) { txtProductID.Text = oProduct.ID; txtPDescription.Text = oProduct.Description; } } } #endregion #region txtProductTypeID if (sender == txtProductTypeID) { if (e.KeyCode.ToString() == "F2") { if (oPack.View()) { txtProductTypeID.Text = oPack.ID; txtPTDescription.Text = oPack.Description; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductTypeID.Text.Trim().Length == 0) { txtProductTypeID.Focus(); } if (oPack.Find(txtProductTypeID.Text)) { txtProductTypeID.Text = oPack.ID; txtPTDescription.Text = oPack.Description; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: if (MessageBox.Show("Do you really want to Delete this Brochure?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } oBrochure.Delete(); Grid.DataBind(); Clear(); txtBrochureID.Clear(); txtBrochureID.Focus(); break; case Keys.PageDown: this.Save(); Grid.DataBind(); Clear(); txtBrochureID.Clear(); txtBrochureID.Focus(); break; case Keys.Delete: if (e.Control) { DeleteItem(); } break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtProductID if (sender == txtProductID) { if (e.KeyCode.ToString() == "F8") { this.Grid.Focus(); } if (e.KeyCode.ToString() == "F2") { if (oOrder.oProduct.View(oOrder.oCustomer)) { this.txtProductID.Text = oOrder.oProduct.ID; return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductID.Text == "DONE") { txtProductID.Clear(); txtCollected.Enabled = true; txtCollected.Focus(); return; } if ((txtProductID.Text.Length == 12 && oOrder.oProduct.FindByBarcode(txtProductID.Text)) || oOrder.oProduct.Find(txtProductID.Text)) { Boolean HasBrochure = false; foreach (BrochureByCustomer bc in oOrder.oCustomer.Brochures) { if (oOrder.oProduct.IsInBrochure(bc.BrochureID)) { HasBrochure = true; break; } } if (!HasBrochure) { Global.playSimpleSound(); txtDescription.Text = "This Product Belongs to Other Brochure"; return; } this.IDetail.ProductID = oOrder.oProduct.ID; this.IDetail.Price = oOrder.oProduct.ExtendedPrice(oOrder.oCustomer); this.IDetail.Description = oOrder.oProduct.Description.ToString(); this.IDetail.Length = oOrder.oProduct.Length; this.IDetail.Width = oOrder.oProduct.Width; this.IDetail.Height = oOrder.oProduct.Height; this.txtProductID.Text = oOrder.oProduct.ID; this.txtDescription.Text = oOrder.oProduct.Description; AddItem(); ActiveRow(); txtProductID.Focus(); } else { Global.playSimpleSound(); } this.txtProductID.Focus(); this.txtProductID.Clear(); return; } } #endregion #region txtCollected if (sender == this.txtCollected) { if (oOrder.Collected != txtCollected.Number) { oOrder.Collected = txtCollected.Number; getTotals(); } if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.Return) { if (!oOrder.oCustomer.Find(CustomerID)) { MessageBox.Show("Please enter a valid Customer ID/School ID "); return; } if (Math.Abs(oOrder.Diff) > 0 && !IsDiff) { Global.playSimpleSound(); IsDiff = true; } else { IsDiff = false; } Save(); Clear(); txtCollected.Enabled = false; txtProductID.Focus(); return; } } #endregion #region Grid if (sender == this.Grid) { if (e.KeyCode == Keys.Enter) { if (Grid.ActiveRow != null) { if (Grid.ActiveCell != null) { if (!Grid.ActiveCell.IsInEditMode) { //' set ActiveCell Grid.ActiveCell = Grid.ActiveRow.Cells["Quantity"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); return; } else { Grid.PerformAction(UltraGridAction.ExitEditMode, true, true); return; } } else { Grid.ActiveCell = Grid.ActiveRow.Cells["Quantity"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); return; } } } if (e.KeyCode == Keys.Down) { Grid.PerformAction(UltraGridAction.BelowRow, false, false); return; } if (e.KeyCode == Keys.Up) { Grid.PerformAction(UltraGridAction.AboveRow, false, false); return; } /* * if (e.KeyCode.ToString()=="Delete") * { * this.DeleteItem(false); * return; * }*/ if (e.KeyCode.ToString() == "F8") { this.txtProductID.Focus(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: this.Grid.Focus(); break; case Keys.F5: { Clear(); txtProductID.Focus(); } break; case Keys.F12: { oOrder.Find(oOrder.GetLastID()); ShowOrder(); } break; case Keys.F3: deleteOrder(); break; case Keys.PageDown: this.Save(); txtProductID.Clear(); txtCollected.Enabled = true; txtCollected.Focus(); return; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { //MessageBox.Show(e.KeyCode.ToString()); #region Grid if (sender == txtEnglish) { } #endregion #region txtOrderID if (sender == txtProductID) { if (e.KeyCode == Keys.F2) { if (oProduct.View()) { txtProductID.Text = oProduct.ID; txtDescription.Text = oProduct.Description; return; } //this.txtDescription.Text = return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtProductID.Text.Trim() == "") { txtProductID.Clear(); txtProductID.Focus(); return; } if (oProduct.Find(txtProductID.Text)) { txtProductID.Text = oProduct.ID; txtDescription.Text = oProduct.Description; return; } else { return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: break; case Keys.PageDown: Save(); Clear(); txtProductID.Clear(); txtProductID.Focus(); txtProductID.Enabled = true; return; case Keys.Delete: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region Grid if (sender == Grid) { if (Grid.ActiveCell != null) { switch (Grid.ActiveCell.Column.Key) { case "Received": if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Down || e.KeyCode == Keys.Tab) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["Received"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } if (e.KeyCode == Keys.Up) { Grid.PerformAction(UltraGridAction.PrevRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["Received"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } break; } } return; } #endregion #region txtOrderID if (sender == txtOrderID) { if (e.KeyCode == Keys.F2) { if (oPurchase.View(true)) { oReceive.FindPurchase(oPurchase.ID); txtOrderID.Text = oReceive.ID; txtVendorID.Text = oReceive.VendID; oVendor.Find(oReceive.VendID); txtName.Text = oVendor.Name; if (oReceive.RItems.Count > 0) { Grid.DataSource = oReceive.RItems; Grid.DataBind(); MoveFirst(); txtOrderID.Enabled = false; } else { MessageBox.Show("This PO was already received..."); } return; } this.txtName.Text = oVendor.Name; return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtOrderID.Text.Trim() == "") { txtOrderID.Clear(); txtOrderID.Focus(); return; } if (oReceive.FindPurchase(txtOrderID.Text)) { txtVendorID.Enabled = true; txtVendorID.Text = oReceive.VendID; oVendor.Find(oReceive.VendID); txtName.Text = oVendor.Name; Grid.DataSource = oReceive.Items; MoveFirst(); txtOrderID.Enabled = false; return; } else { txtVendorID.Enabled = true; txtVendorID.Focus(); return; } } } #endregion #region txtVendorID if (sender == txtVendorID) { if (e.KeyCode.ToString() == "F2") { if (oVendor.View()) { this.txtVendorID.Text = oVendor.ID; if (!oVendor.Find(txtVendorID.Text)) { this.txtVendorID.Focus(); return; } this.txtName.Text = oVendor.Name; Grid.Focus(); return; } this.txtName.Text = oVendor.Name; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (!oVendor.Find(txtVendorID.Text)) { this.txtVendorID.Focus(); return; } this.txtName.Text = oVendor.Name; //Grid.DataSource = oVendor.ReOrders.GetDataTable(oVendor); Grid.Focus(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: Delete(); break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtAccountID if (sender == txtAccountID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oeMail.View(this.DomainID)) { txtAccountID.Text = oeMail.User; ShowVendor(); } if (txtAccountID.Text == "") { return; } txtDescription.Focus(); Grid.DataSource = oeMail.Items.dt; Grid.DataBind(); Grid.Focus(); oeMail.Items.AddEmpty(); MoveLast(); return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtAccountID.Text.Trim().Length == 0) { Clear(); txtAccountID.Focus(); } if (oeMail.Find(txtAccountID.Text)) { txtAccountID.Text = oeMail.User; ShowVendor(); Grid.DataSource = oeMail.Items.dt; Grid.DataBind(); Grid.Focus(); oeMail.Items.AddEmpty(); MoveLast(); } else { Clear(); oeMail.Items.AddEmpty(); Grid.DataSource = oeMail.Items.dt; Grid.DataBind(); txtPassword.Focus(); } return; } } #endregion #region txtDescription if (sender == txtDescription) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { //oeMail..Description = txtDescription.Text; Grid.Focus(); MoveLast(); return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.F2) { UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveRow.Cells["destination"] == Grid.ActiveCell) {/* * if (oRep.View()) * { * if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) * { * * Grid.ActiveRow.Cells["ProductID"].Value = oRep.ID; * Grid.ActiveRow.Cells["InvCode"].Value = oRep.InvCode; * Grid.ActiveRow.Cells["Description"].Value = oRep.Description; * Grid.ActiveRow.Cells["Price"].Activate(); * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * else * { * MessageBox.Show("Item already entered"); * Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * } */ } } } if (e.KeyCode == Keys.Delete) { } if (e.KeyCode == Keys.Enter) { if (Grid.ActiveRow != null) { if (Grid.ActiveRow.Cells["destination"].Text != "" && !Contain(Grid.ActiveRow.Cells["destination"].Text)) { if (Grid.ActiveRow.Cells["destination"] == Grid.ActiveCell) {/* * if (oRep.Find(Grid.ActiveRow.Cells["ProductID"].Text)) * { * if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) * { * * Grid.ActiveRow.Cells["ProductID"].Value = oRep.ID; * Grid.ActiveRow.Cells["InvCode"].Value = oRep.InvCode; * Grid.ActiveRow.Cells["Description"].Value = oRep.Description; * Grid.ActiveRow.Cells["Price"].Activate(); * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * else * { * MessageBox.Show("Item already entered"); * Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * } */ } if (Grid.GetRow(ChildRow.Last) == Grid.ActiveRow) { oeMail.Items.AddEmpty(); Grid.DataBind(); MoveLast(); //Grid.PerformAction(UltraGridAction.LastRowInBand, false, false); } else { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["destination"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } else { Grid.ActiveRow.Cells["destination"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } return; } } if (e.KeyCode == Keys.Down) { MoveDown(); return; } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell Grid.ActiveCell = Grid.ActiveRow.Cells["destination"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } return; //SendKeys.Send("{TAB}"); } } #endregion #region txtProductID if (sender == txtRepID) { if (e.KeyCode.ToString() == "F2") { if (oRep.ViewByID()) { txtRepID.Text = oRep.ID.ToString(); txtDescription.Text = oRep.Name; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtRepID.Text.Trim().Length == 0) { txtRepID.Focus(); } if (oRep.Find(txtRepID.Text)) { txtRepID.Text = oRep.ID.ToString(); txtDescription.Text = oRep.Name; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: this.Delete(); txtAccountID.Focus(); break; case Keys.PageDown: this.Save(); Grid.DataBind(); Clear(); txtAccountID.Clear(); txtAccountID.Focus(); break; case Keys.Delete: if (e.Control) { DeleteItem(); } break; //case Keys.<some key>: // ......; // break; } #endregion }
private void gKits_KeyUp(object sender, KeyEventArgs e) { if (sender == gKits) { if (e.KeyCode == Keys.Tab) { txtSearch.Focus(); return; } if (e.KeyCode == Keys.Enter) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = gKits.ActiveRow; gridRow.Appearance = gKits.DisplayLayout.Appearances["Normal"]; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); gridRow.Appearance = gKits.DisplayLayout.Appearances["Credit"]; } //SendKeys.Send("{TAB}"); } if (e.KeyCode == Keys.Down) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = gKits.ActiveRow; gridRow.Appearance = gKits.DisplayLayout.Appearances["Normal"]; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); gridRow.Appearance = gKits.DisplayLayout.Appearances["Credit"]; } //SendKeys.Send("{TAB}"); } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = gKits.ActiveRow; gridRow.Appearance = gKits.DisplayLayout.Appearances["Normal"]; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); gridRow.Appearance = gKits.DisplayLayout.Appearances["Credit"]; } //SendKeys.Send("{TAB}"); } } }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { Boolean IsF2 = false; if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { this.txtCustomerID.Text = oCustomer.ID; this.txtTeacher.Focus(); } else { this.txtCustomerID.Clear(); this.txtCustomerID.Focus(); return; } IsF2 = true; this.txtName.Text = oCustomer.Name; oOrder.CustomerID = txtCustomerID.Text; /*txtCustomerID.Enabled = false; * oOrder.LoadOrders(); * Grid.DataSource = oOrder.ScanItems; * Grid.DataBind(); * txtOrderID.Focus(); * return;*/ } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab" || IsF2) { IsF2 = false; if (!this.get_customer()) { this.txtCustomerID.Focus(); return; } //MessageBox.Show(oCustomer.Scanned +"-"+ oOrder.OrdersScanned.ToString() +"-"+oOrder.OrdersEntered.ToString()); if ((oCustomer.Scanned || oOrder.OrdersScanned == oOrder.OrdersEntered)) { //MessageBox.Show("This is already Done"); txtCustomerID.Enabled = false; txtPallets.Enabled = true; txtPallets.Text = oCustomer.NumberPallets.ToString(); txtPallets.Focus(); return; } oOrder.CustomerID = txtCustomerID.Text; if (oOrder.OrdersEntered == 0) { MessageBox.Show("This customer doesnt have any Order..."); txtCustomerID.Clear(); txtCustomerID.Focus(); return; } oOrder.LoadOrders(); txtCustomerID.Enabled = false; oOrder.CustomerID = txtCustomerID.Text; Grid.DataSource = oOrder.ScanItems; Grid.DataBind(); txtOrderID.Focus(); return; } } #endregion #region txtOrderID if (sender == txtOrderID) { if (e.KeyCode == Keys.F12) { Grid.Focus(); return; } if (e.KeyCode == Keys.F2) { if (oOrder.View()) { txtOrderID.Text = oOrder.ID; } return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtOrderID.Text.Trim() == "") { txtOrderID.Clear(); txtOrderID.Focus(); return; } if (txtCustomerID.Text != oOrder.CustomerID) { Global.playSimpleSound(1); return; } txtOrderID.Text = Convert.ToUInt32(txtOrderID.Text).ToString(); if (oOrder.FindHeader(Convert.ToInt32(txtOrderID.Text))) { if (oOrder.BoxesPacked == 0) { ActiveRow(false); Global.playSimpleSound(2); txtMessage.Text = "Order Not Packed Yet"; txtMessage.ForeColor = Color.Red; ShowMessage("Order Not Packed Yet", Color.Red); return; } if (oOrder.CustomerID != txtCustomerID.Text) { Global.playSimpleSound(3); txtTeacher.Text = oOrder.Teacher; txtStudent.Text = oOrder.Student; txtMessage.Text = "Different School"; txtMessage.ForeColor = Color.Red; ShowMessage("Different School", Color.Red); return; } if (oOrder.BoxesPacked > 0 && oOrder.BoxesPacked == oOrder.BoxesScanned) // (oOrder.Packed) { //oOrder.UpdateOrderScanned(oOrder.ID); //oOrder.LoadOrders(); Global.playSimpleSound(1); txtTeacher.Text = oOrder.Teacher; txtStudent.Text = oOrder.Student; txtBox.Text = String.Format("Boxes {0}", oOrder.BoxesScanned); txtMessage.Text = "Order Already Scanned"; txtMessage.ForeColor = Color.Red; ShowMessage("Order Already Scanned", Color.Red); return; } if (oOrder.BoxesPacked < oOrder.BoxesScanned) { ActiveRow(false); Global.playSimpleSound(2); ShowMessage("Something wrong, Modify number of boxes!!! ", Color.Red); return; } Boolean IsPacked = false; if (oOrder.BoxesPacked == oOrder.BoxesScanned) { Global.playSimpleSound(2); ShowMessage("Order Already Packed ", Color.Red); IsPacked = true; } txtTeacher.Text = oOrder.Teacher; txtStudent.Text = oOrder.Student; if (!IsPacked) { oOrder.BoxesScanned += 1; } txtBox.Text = String.Format("Box {0} of {1}", oOrder.BoxesScanned, oOrder.BoxesPacked); oOrder.UpdateScanned(oOrder.ID, oOrder.BoxesScanned); if (oOrder.BoxesScanned == oOrder.BoxesPacked) { //oOrder.ScanItems.Remove(txtOrderID.Text); oOrder.UpdateOrderScanned(oOrder.ID); ActiveRow(true); } else { ActiveRow(false); Grid.DataBind(); } if (!IsPacked) { txtMessage.Text = "GOOD!"; txtMessage.ForeColor = Color.Green; ShowMessage(txtBox.Text, Color.Green); } if (oOrder.OrdersScanned == oOrder.OrdersEntered) //oOrder.ScanItems.Count == 0) { txtPallets.Enabled = true; txtPallets.Focus(); return; } this.Focus(); txtOrderID.Focus(); txtOrderID.Clear(); return; } else { Global.playSimpleSound(0); } txtOrderID.Clear(); return; } } #endregion #region txtPallets if (sender == txtPallets) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtPallets.Text == "") { txtPallets.Focus(); return; } if (Convert.ToInt32(txtPallets.Text) > 100) { txtPallets.Clear(); txtPallets.Focus(); return; } //oOrder.BoxesScanned = Convert.ToInt16(txtPallets.Text); //oOrder.UpdatePacked(); oOrder.NumberPallets = Convert.ToInt32(txtPallets.Text); oOrder.UpdateCustomerScanned(); PrinPalletLabels(); Clear(); txtCustomerID.Enabled = true; txtPallets.Enabled = false; txtOrderID.Enabled = false; txtCustomerID.Focus(); this.Close(); return; } } #endregion #region txtGrid if (sender == this.Grid) { if (e.KeyValue >= 48 && e.KeyValue <= 57) { txtOrderID.Focus(); //SendKeys.Send("{TAB}"); // SendKeys.Send(c.ToString()); } if (e.KeyCode == Keys.F12) { txtOrderID.Focus(); return; } if (e.KeyCode.ToString() == "F8") { return; } if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown) { //return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: //this.SelectNextControl(this.ActiveControl,true,true,true,true); break; case Keys.Up: //this.SelectNextControl(this.ActiveControl,false,true,true,true); break; case Keys.F8: break; case Keys.F3: break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { Boolean IsF2 = false; if (e.KeyCode.ToString() == "F2") { if (!oCustomer.View()) { this.txtTeacher.Focus(); return; } IsF2 = true; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab" || IsF2) { if (!IsF2) { if (!oCustomer.Find(txtCustomerID.Text)) { this.txtCustomerID.Focus(); return; } } this.txtCustomerID.Text = oCustomer.CustomerID; this.txtName.Text = oCustomer.Name; IsF2 = false; oCustomer.CustomerID = oCustomer.ID; oCustomer.Teachers.Load(oCustomer.ID); if (this.SetNextTeacher()) { txtTeacher.Text = oTeacher.Name; } else { txtTeacher.Clear(); txtTeacher.Focus(); } this.txtTeacher.Focus(); return; } if (e.KeyCode == Keys.Down) { txtTeacher.Clear(); } } #endregion #region txtTeacher if (sender == txtTeacher) { if (e.KeyCode.ToString() == "F2") { oTeacher.CustomerID = txtCustomerID.Text; oTeacher.View(); if (oTeacher.Name != "") { if (oTeacher.Scanned) { if ((MessageBox.Show("Add more ?", "Add Forms...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)) { txtTeacher.Clear(); return; } } this.txtTeacher.Text = oTeacher.Name; return; } } if (e.KeyCode == Keys.Enter || e.KeyCode.ToString() == "Tab") { if (txtCustomerID.Text.Trim() != "") { if (oTeacher.Find(this.CompanyID, oCustomer.CustomerID, txtTeacher.Text)) { this.txtTeacher.Text = oTeacher.Name; return; } else { txtTeacher.Clear(); txtTeacher.Focus(); return; } } } if (e.KeyCode == Keys.Up) { txtTeacher.Clear(); } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F7: this.Close(); break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { ShowCustomer(); oTeachers.CustomerID = oCustomer.ID; oTeachers.Load(oCustomer.ID); Grid.DataSource = oTeachers.Table; Grid.DataBind(); Grid.Focus(); MoveLast(); return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtCustomerID.Text.Trim().Length == 0) { Clear(); txtCustomerID.Focus(); } if (oCustomer.Find(txtCustomerID.Text)) { ShowCustomer(); oTeachers.CustomerID = oCustomer.ID; oTeachers.Load(oCustomer.ID); Grid.DataSource = oTeachers.Table; Grid.DataBind(); Grid.Focus(); MoveLast(); } else { Clear(); Grid.DataSource = oTeachers.Table; Grid.DataBind(); txtName.Focus(); } return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.F2) { UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveRow.Cells["Teacher"] == Grid.ActiveCell) { /* * if (oProduct.View()) * { * if (!oImages.Items.Contains(Grid.ActiveRow.Cells["ProductID"].Text)) * { * * Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; * Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; * Grid.ActiveRow.Cells["Amount"].Activate(); * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * else * { * MessageBox.Show("Item already entered"); * Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; * Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); * return; * } * } */ } } } if (e.KeyCode == Keys.Delete) { } if (e.KeyCode == Keys.Enter) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveCell.Text.Trim() != "" && Grid.ActiveRow.Cells["Teacher"] == Grid.ActiveCell) { if (Contain(Grid.ActiveRow.Cells["Teacher"].Text)) { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["Teacher"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); Grid.ActiveRow.Cells["Teacher"].Value = ""; } else { this.MoveLast(); } } return; } } if (e.KeyCode == Keys.Down) { MoveDown(); return; } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell Grid.ActiveCell = Grid.ActiveRow.Cells["Teacher"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } return; } } #endregion #region txtName if (sender == txtName) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { // oImages.Description = txtName.Text; Grid.Focus(); MoveLast(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: oTeachers.Delete(); Clear(); // oImages.Items.dtItems.Rows.Clear(); Grid.DataBind(); txtCustomerID.Clear(); txtCustomerID.Focus(); break; case Keys.PageDown: MoveLast(); oTeachers.Save(); Grid.DataBind(); Clear(); txtCustomerID.Clear(); txtCustomerID.Focus(); break; case Keys.Delete: if (e.Control) { DeleteItem(); } break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { //MessageBox.Show(e.KeyCode.ToString()); #region Grid if (sender == Grid) { if (Grid.ActiveRow != null) { if (e.KeyCode == Keys.Delete) { if (e.Shift && Grid.GetRow(ChildRow.Last) != Grid.ActiveRow) { Grid.ActiveRow.Delete(); MoveLast(); return; } } switch (Grid.ActiveCell.Column.Key) { case "ProductID": { if (e.KeyCode == Keys.F2) { if (oProduct.View()) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["Price"].Value = oProduct.Price; Grid.ActiveRow.Cells["Quantity"].Value = 1; Grid.ActiveRow.Cells["Quantity"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } if (e.KeyCode == Keys.Return) { if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) //(!oProduct.Items.Contains(Grid.ActiveRow.Cells["ProductID"].Text)) { if (oProduct.Find(Grid.ActiveRow.Cells["ProductID"].Text)) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["Price"].Value = oProduct.Cost; Grid.ActiveRow.Cells["Quantity"].Value = 1; Grid.ActiveRow.Cells["Quantity"].Activate(); Grid.ActiveCell = Grid.ActiveRow.Cells["Quantity"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } else { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } } if (e.KeyCode == Keys.Down) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } if (e.KeyCode == Keys.Up) { Grid.PerformAction(UltraGridAction.PrevRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } if (e.KeyCode == Keys.Right) { Grid.PerformAction(UltraGridAction.NextCellByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["Cases"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } break; case "Quantity": if (e.KeyCode == Keys.Return) { if (Grid.ActiveRow.Cells["ProductID"].Text != "" && !Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { if (Grid.GetRow(ChildRow.Last) == Grid.ActiveRow) { oProduct.Items.AddEmpty(); Grid.DataBind(); MoveLast(); //Grid.PerformAction(UltraGridAction.LastRowInBand, false, false); } else { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } else { Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); Grid.ActiveRow.Cells["Quantity"].Value = 1; } return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Down || e.KeyCode == Keys.Tab) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["Quantity"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } if (e.KeyCode == Keys.Up) { Grid.PerformAction(UltraGridAction.PrevRowByTab, false, false); Grid.ActiveCell = Grid.ActiveRow.Cells["Quantity"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } break; default: { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Down || e.KeyCode == Keys.Tab) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); //Grid.ActiveCell = Grid.ActiveRow.Cells["Received"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } if (e.KeyCode == Keys.Up) { Grid.PerformAction(UltraGridAction.PrevRowByTab, false, false); //Grid.ActiveCell = Grid.ActiveRow.Cells["Received"]; Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } break; } } return; } #endregion #region txtOrderID if (sender == txtProductID) { if (e.KeyCode == Keys.F2) { if (oProduct.View()) { txtProductID.Text = oProduct.ID; // txtVendorID.Text = oProduct.VendID; // oVendor.Find(oProduct.VendID); // txtName.Text = oVendor.Name; Grid.DataSource = oProduct.Items.dtItems; //oProduct.Items; Grid.DataBind(); MoveLast(); txtProductID.Enabled = false; return; } else { Grid.Height = 529; } //this.txtDescription.Text = return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtProductID.Text.Trim() == "") { txtProductID.Clear(); txtProductID.Focus(); return; } if (oProduct.Find(txtProductID.Text)) { // txtVendorID.Text = oProduct.VendID; // oVendor.Find(oProduct.VendID); // txtName.Text = oVendor.Name; //Grid.DataSource = oProduct.Items; Grid.DataSource = oProduct.Items.dtItems; //oProduct.Items; MoveLast(); txtProductID.Enabled = false; return; } else { return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: deleteOrder(); break; case Keys.PageDown: break; case Keys.Delete: if (!e.Control) { Grid.ActiveRow.Delete(); } break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { if (e.KeyCode.ToString() == "F2") { if (oOrder.oCustomer.View()) { this.txtCustomerID.Text = oOrder.oCustomer.ID; this.txtSchoolUseOnly.Checked = oOrder.oCustomer.SchoolUseOnly; this.txtTeacher.Focus(); } this.txtName.Text = oOrder.oCustomer.Name; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (!this.get_customer()) { this.txtCustomerID.Focus(); return; } } } #endregion #region txtTeacher if (sender == txtTeacher) { if (e.KeyCode.ToString() == "F2") { oOrder.oTeacher.View(txtCustomerID.Text); if (oOrder.oTeacher.ID != "") { this.txtTeacher.Text = oOrder.oTeacher.ID; this.txtStudent.Focus(); return; } } if (e.KeyCode == Keys.Enter || e.KeyCode.ToString() == "Tab") { oOrder.oTeacher.ID = txtTeacher.Text; if (!oOrder.oTeacher.Find(txtCustomerID.Text, txtTeacher.Text)) { this.txtTeacher.Clear(); return; } else { this.txtTeacher.Text = oOrder.oTeacher.ID; this.txtStudent.Focus(); return; } } if (e.KeyCode == Keys.PageDown) { oOrder.oTeacher.ID = txtTeacher.Text; bNext_Click(null, null); txtText.Focus(); return; } } #endregion #region txtStudent if (sender == txtStudent) { if (e.KeyCode.ToString() == "F2") { oOrder.oStudent.View(txtCustomerID.Text, txtTeacher.Text); if (oOrder.oStudent.ID != "") { txtTeacher.Text = oOrder.oStudent.Teacher; this.txtStudent.Text = oOrder.oStudent.ID; this.oOrder.oCustomer.Find(this.txtCustomerID.Text); oOrder.CustomerID = this.txtCustomerID.Text; txtName.Text = oOrder.oCustomer.Name; //get(this.txtTeacher.Text, this.txtStudent.Text); if (!oOrder.Find(this.txtTeacher.Text, this.txtStudent.Text)) { MessageBox.Show("This Order doesn't exist"); } if (oOrder.oImage.OrderID != 0) { bPrintImage.Visible = true; } else { bPrintImage.Visible = false; } if (oOrder.FindText(Convert.ToInt32(oOrder.ID))) { txtText.Text = oOrder.LetterText; } else { txtText.Text = ""; lbDiff.Text = oOrder.Diff.ToString(); } this.txtText.Focus(); } return; } if (e.KeyCode == Keys.Enter || e.KeyCode.ToString() == "Tab") { // oOrder.oStudent.ID = txtStudent.Text; if (oOrder.Student != this.txtStudent.Text) { this.txtStudent.Text = oOrder.oStudent.ID; this.txtStudent.Text = oOrder.oStudent.ID; if (!oOrder.Find(this.txtTeacher.Text, this.txtStudent.Text)) { MessageBox.Show("This Order doesn't exist"); } else { if (oOrder.oImage.OrderID != 0) { bPrintImage.Visible = true; } else { bPrintImage.Visible = false; } txtText.Text = ""; lbDiff.Text = oOrder.Diff.ToString(); } if (oOrder.FindText(Convert.ToInt32(oOrder.ID))) { txtText.Text = oOrder.LetterText; } } this.txtText.Focus(); return; } if (e.KeyCode == Keys.PageDown) { oOrder.oTeacher.ID = txtTeacher.Text; bNext_Click(null, null); txtText.Focus(); return; } } #endregion #region txtText if (sender == txtText) { if (e.KeyCode.ToString() == "F8") { bEdit_Click(null, null); return; } if (e.KeyCode == Keys.F2) { frmDiscrepancyOptions frmOptions = new frmDiscrepancyOptions(); frmOptions.ShowDialog(); txtText.Text += frmOptions.sSelectedID; return; } if (e.KeyCode == Keys.PageDown) { if (txtStudent.Text == "") { return; } if (MessageBox.Show("Done with this order ?", "Discrepancy", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { if (txtText.Text == null) { MessageBox.Show("Warning! This discrepancy has no text..."); } return; } else { this.Save(); txtText.Text = ""; txtStudent.Clear(); txtStudent.Focus(); return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: if (sender != txtText) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Down: { if (sender != txtText) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; } case Keys.Up: { if (sender != txtText) { this.SelectNextControl(this.ActiveControl, false, true, true, true); } break; } case Keys.F3: //deleteOrder(); break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { oPayment.CustomerID = oCustomer.ID; txtCustomerID.Text = oCustomer.ID; txtName.Text = oCustomer.Name; txtAmountDue.Enabled = false; txtAmountDue.Text = oCustomer.StatementAmountDue.ToString(); ctrType.Focus(); //txtAmount.Focus(); } return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtCustomerID.Text.Trim().Length == 0) { Clear(); txtCustomerID.Focus(); } if (oCustomer.Find(txtCustomerID.Text)) { oPayment.CustomerID = oCustomer.ID; txtCustomerID.Text = oCustomer.ID; txtName.Text = oCustomer.Name; txtAmountDue.Enabled = false; txtAmountDue.Text = oCustomer.StatementAmountDue.ToString(); //txtAmount.Focus(); ctrType.Focus(); return; } else { Clear(); } } } #endregion #region txtChargeID if (sender == txtChargeID) { if (e.KeyCode.ToString() == "F2") { if (oPayment.View()) { Display(); txtChargeID.Text = oPayment.ID; } return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (oPayment.Find(txtChargeID.Text)) { Display(); txtChargeID.Text = oPayment.ID; } return; } } #endregion #region txtAmount if (sender == txtAmount) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtAmount.Number != 0.00) { txtComment.Focus(); } return; } } #endregion #region txtText if (sender == txtComment) { if (e.KeyCode != Keys.PageDown) { return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F3: { if (txtChargeID.Text.Trim() != String.Empty) { if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } else { oPayment.Delete(); oCustomer.GetPayments(); oCustomer.UpdateCurrentTotals(); oCustomer.HasChanged = true; Clear(); txtCustomerID.Focus(); } } } break; case Keys.F7: this.Close(); break; case Keys.PageDown: oPayment.ID = txtChargeID.Text; oPayment.Date = (DateTime)txtDate.Value; oPayment.Comment = txtComment.Text; switch (ctrType.Text) { case "Payment": oPayment.Type = "P"; oPayment.Amount = txtAmount.Number * -1; break; case "Adjustment": oPayment.Type = "A"; oPayment.Amount = txtAmount.Number; break; case "Invoice": oPayment.Type = "I"; // if (txtAmount.Number < 0) oPayment.Amount = txtAmount.Number; break; default: oPayment.Amount = txtAmount.Number; break; } if (txtChargeID.Text == "") { oPayment.Insert(); if (oPayment.Type == "P" && oCustomer.StatementAmountDue != 0) { oCustomer.PrintStatement(null, PrinterDevice.Printer); } } else { oPayment.Save(); } oCustomer.GetPayments(); oCustomer.UpdateCurrentTotals(); oCustomer.HasChanged = true; Clear(); //txtCustomerID.Clear(); txtCustomerID.Focus(); break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region gKits if (sender == gKits) { if (e.KeyCode == Keys.F8) { txtKitID.Focus(); } if (e.KeyCode == Keys.F2) { UltraGridRow gridRow; gridRow = gKits.ActiveRow; if (gridRow != null) { if (gKits.ActiveRow.Cells["KitID"] == gKits.ActiveCell) { if (oKit.View()) { gKits.ActiveRow.Cells["KitID"].Value = oKit.ID; gKits.ActiveRow.Cells["Name"].Value = oKit.Description; gKits.ActiveRow.Cells["Quantity"].Activate(); gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); //this.txtKitID.Text = oKit.ID; //this.txtKitName.Text = oKit.Description; //this.txtQuantity.Clear(); return; } } } } if (e.KeyCode == Keys.Delete) { //foreach(UltraGridRow rowSelected in gKits.Rows) // MessageBox.Show(rowSelected.Index.ToString()); //MessageBox.Show("Delete"); //oCustomer.Kits.dtKits.Rows // oCustomer.Kits.RemoveAt(0); } if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Enter) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = gKits.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } //SendKeys.Send("{TAB}"); } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = gKits.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell gKits.ActiveCell = gKits.ActiveRow.Cells["Quantity"]; gKits.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } //SendKeys.Send("{TAB}"); } return; } #endregion #region txtCustomerID if (sender == txtCustomerID) { if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { this.txtCustomerID.Text = oCustomer.ID; this.txtName.Text = oCustomer.Name; gKits.DataSource = oCustomer.Kits.GetDataTable(oCustomer); txtKitID.Focus(); return; } this.txtName.Text = oCustomer.Name; //txtKitID.Focus(); return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (!oCustomer.Find(txtCustomerID.Text)) { this.txtCustomerID.Focus(); return; } this.txtName.Text = oCustomer.Name; gKits.DataSource = oCustomer.Kits.GetDataTable(oCustomer); txtKitID.Focus(); return; } } #endregion #region txtKitID if (sender == txtKitID) { if (e.KeyCode.ToString() == "F8") { this.gKits.Focus(); } if (e.KeyCode.ToString() == "F2") { if (oKit.View()) { this.txtKitID.Text = oKit.ID; this.txtKitName.Text = oKit.Description; this.txtQuantity.Clear(); this.txtQuantity.Focus(); return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (oKit.Find(txtKitID.Text)) { this.txtKitID.Text = oKit.ID; this.txtKitName.Text = oKit.Description; this.txtQuantity.Clear(); this.txtQuantity.Focus(); return; } else { this.txtKitID.Clear(); this.txtKitID.Focus(); return; } } return; } #endregion #region txtQuantity if (sender == this.txtQuantity) { //MessageBox.Show(e.KeyCode.ToString()); if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (this.txtQuantity.Text != "") { //this.AddItem(); try { DataRow rowNew = oCustomer.Kits.dtKits.NewRow(); rowNew["KitID"] = txtKitID.Text; rowNew["Name"] = oKit.Description; rowNew["Quantity"] = txtQuantity.Text; oCustomer.Kits.dtKits.Rows.Add(rowNew); } catch (Exception ex) { MessageBox.Show(ex.Message); //"Unable to add new customer for given ID"); } this.txtQuantity.Text = ""; this.txtKitID.Text = ""; this.txtKitID.Focus(); return; } else { this.txtQuantity.Focus(); return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: deleteOrder(); break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtControl_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtSearch if (sender == txtSearch) { if (e.KeyCode == Keys.Tab) { Grid.Focus(); return; } if (e.KeyCode == Keys.Enter) { if (Grid.Rows.Count > 0) { UltraGridRow aUGRow = Grid.Rows[0]; Grid.ActiveRow = aUGRow; if (Grid.ActiveRow != null) { SelectedID = Grid.ActiveRow.Cells["Teacher"].Text; CustomerID = Grid.ActiveRow.Cells["CustomerID"].Text; } this.Close(); } else { this.Close(); } return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.Tab) { txtSearch.Focus(); return; } if (e.KeyCode == Keys.Enter) { if (Grid.Rows.Count > 0) { if (Grid.ActiveRow != null) { SelectedID = Grid.ActiveRow.Cells["Teacher"].Text; CustomerID = Grid.ActiveRow.Cells["CustomerID"].Text; } this.Close(); } return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Up: if (Grid.Focused) { if (Grid.Rows.Count == 0) { } else if (Grid.ActiveRow == Grid.Rows[0]) { txtSearch.Focus(); } else { Grid.PerformAction(UltraGridAction.AboveCell, false, false); } } e.Handled = true; break; case Keys.Down: if (txtSearch.Focused && Grid.Rows.Count > 0) { Grid.Focus(); } Grid.PerformAction(UltraGridAction.BelowCell, false, false); e.Handled = true; break; case Keys.Right: //UltraGrid1.PerformAction(ExitEditMode, False, False) Grid.PerformAction(UltraGridAction.NextCellByTab, false, false); e.Handled = true; //UltraGrid1.PerformAction(EnterEditMode, False, False) break; case Keys.Left: //UltraGrid1.PerformAction(ExitEditMode, False, False) Grid.PerformAction(UltraGridAction.PrevCellByTab, false, false); e.Handled = true; //UltraGrid1.PerformAction(EnterEditMode, False, False) break; case Keys.Enter: DataGrid_MouseUp(null, null); e.Handled = true; break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtPrizeID if (sender == txtPrizeID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oPrize.View()) { ShowPrize(); txtDescription.Focus(); Grid.DataSource = oPrize.Items.dtItems; Grid.DataBind(); Grid.Focus(); MoveLast(); return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtPrizeID.Text.Trim().Length == 0) { Clear(); txtPrizeID.Focus(); } if (oPrize.Find(txtPrizeID.Text)) { txtDescription.Text = oPrize.Description; Grid.DataSource = oPrize.Items.dtItems; Grid.DataBind(); Grid.Focus(); MoveLast(); } else { Clear(); oPrize.Items.dtItems.Rows.Clear(); oPrize.ID = txtPrizeID.Text; oPrize.Items.AddEmpty(); Grid.DataSource = oPrize.Items.dtItems; Grid.DataBind(); txtDescription.Focus(); } return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.F2) { UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveRow.Cells["ProductID"] == Grid.ActiveCell) { if (oProduct.View()) { if (!oPrize.Items.Contains(Grid.ActiveRow.Cells["ProductID"].Text)) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["Amount"].Activate(); Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } else { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } } } } } if (e.KeyCode == Keys.Delete) { } if (e.KeyCode == Keys.Enter) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; if (gridRow != null) { if (Grid.ActiveRow.Cells["ProductID"] == Grid.ActiveCell) { if (oProduct.Find(Grid.ActiveRow.Cells["ProductID"].Text)) { if (!Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { Grid.ActiveRow.Cells["ProductID"].Value = oProduct.ID; Grid.ActiveRow.Cells["Description"].Value = oProduct.Description; Grid.ActiveRow.Cells["BreakLevel"].Activate(); Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } else { MessageBox.Show("Item already entered"); Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); return; } } return; } if (Grid.ActiveRow.Cells["Amount"] == Grid.ActiveCell) { gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next); if (gridRow != null) { MoveDown(); return; } else //if (Grid.ActiveRow.Cells["ProductID"].Text && Grid.ActiveRow.Cells["0"].Text) { if (Grid.ActiveRow.Cells["ProductID"].Text != "" && !Contain(Grid.ActiveRow.Cells["ProductID"].Text)) { if (Grid.GetRow(ChildRow.Last) == Grid.ActiveRow) { oPrize.Items.AddEmpty(); Grid.DataBind(); MoveLast(); //Grid.PerformAction(UltraGridAction.LastRowInBand, false, false); } else { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); } } else { Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); Grid.ActiveRow.Cells["BreakLevel"].Value = 0; Grid.ActiveRow.Cells["Amount"].Value = 0; } return; } } if (Grid.ActiveRow.Cells["BreakLevel"] == Grid.ActiveCell) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["Amount"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); return; } if (Grid.ActiveRow.Cells["Quantity"] == Grid.ActiveCell) { Grid.PerformAction(UltraGridAction.NextRowByTab, false, false); Grid.ActiveRow.Cells["ProductID"].Activate(); Grid.PerformAction(UltraGridAction.EnterEditMode, false, false); return; } } } if (e.KeyCode == Keys.Down) { MoveDown(); return; } if (e.KeyCode == Keys.Up) { Infragistics.Win.UltraWinGrid.UltraGridRow gridRow; gridRow = Grid.ActiveRow; gridRow = gridRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Previous); if (gridRow != null) { gridRow.Activate(); //' set ActiveCell Grid.ActiveCell = Grid.ActiveRow.Cells["ProductID"]; Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); } return; } } #endregion #region txtDescription if (sender == txtDescription) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { oPrize.Description = txtDescription.Text; txtProductTypeID.Focus(); MoveLast(); return; } } #endregion #region txtProductTypeID if (sender == txtProductTypeID) { if (e.KeyCode.ToString() == "F2") { if (oPack.View()) { txtProductTypeID.Text = oPack.ID; txtPTDescription.Text = oPack.Description; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductTypeID.Text.Trim().Length == 0) { txtProductTypeID.Focus(); } if (oPack.Find(txtProductTypeID.Text)) { txtProductTypeID.Text = oPack.ID; txtPTDescription.Text = oPack.Description; } Grid.Focus(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F3: oPrize.Delete(); Clear(); oPrize.Items.dtItems.Rows.Clear(); Grid.DataBind(); txtPrizeID.Clear(); txtPrizeID.Focus(); break; case Keys.PageDown: this.Save(); //oPrize.Description = txtDescription.Text; //oPrize.Save(); Grid.DataBind(); Clear(); txtPrizeID.Clear(); txtPrizeID.Focus(); break; case Keys.Delete: if (e.Control) { DeleteItem(); } break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { Boolean IsF2 = false; if (e.KeyCode.ToString() == "F2") { if (oOrder.oCustomer.View()) { IsF2 = true; this.txtCustomerID.Text = oOrder.oCustomer.ID; this.txtTeacher.Focus(); } this.txtName.Text = oOrder.oCustomer.Name; return; } if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab" || IsF2) { IsF2 = false; if (!oOrder.oCustomer.Find(txtCustomerID.Text)) { this.txtCustomerID.Focus(); return; } txtName.Text = txtName.Text; this.txtTeacher.Focus(); return; } } #endregion #region txtTeacher if (sender == txtTeacher) { if (e.KeyCode.ToString() == "F2") { oTeacher.CustomerID = txtCustomerID.Text; if (oTeacher.View()) { this.txtTeacher.Text = oTeacher.Name; oTeacher.LoadImages(ScannedOrderStatus.ProcessedWithErrors); return; } } if (e.KeyCode == Keys.Enter || e.KeyCode.ToString() == "Tab") { if (txtCustomerID.Text.Trim() != "") { if (oTeacher.Find(oOrder.CompanyID, oOrder.oCustomer.ID, txtTeacher.Text)) { this.txtTeacher.Text = oTeacher.Name; oTeacher.LoadImages(ScannedOrderStatus.ProcessedWithErrors); return; } else { txtTeacher.Clear(); txtTeacher.Focus(); return; } } } } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtUserID if (sender == txtUserID) { if (e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oUser.View()) { txtUserID.Text = oUser.ID.ToString(); txtUser.Text = oUser.UserID; txtPassword.Text = oUser.Password; txtRepID.Text = oUser.RepID.ToString(); if (oRep.Find(oUser.RepID)) { txtName.Text = oRep.Name; } Activate(true); txtUser.Focus(); return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtUser.Text.Trim().Length == 0) { Clear(); } if (oUser.Find(txtUser.Text, "")) { txtUser.Text = oUser.UserID; txtPassword.Text = oUser.Password; txtRepID.Text = oUser.RepID.ToString(); if (oRep.Find(oUser.RepID)) { txtName.Text = oRep.Name; } Activate(true); txtUser.Focus(); return; } else { Clear(); } } } #endregion #region txtPassword if (sender == txtPassword) { if (e.KeyCode == Keys.F3) { return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtUser.Text.Trim().Length == 0) { Clear(); } if (oUser.Find(txtUser.Text, "")) { txtUser.Text = oUser.UserID; txtRepID.Text = oUser.RepID.ToString(); if (oRep.Find(oUser.RepID)) { txtName.Text = oRep.Name; } txtRepID.Focus(); return; } else { Clear(); } } } #endregion #region txtRepID if (sender == txtRepID) { if (e.KeyCode.ToString() == "F2") { if (oRep.ViewByID()) { txtRepID.Text = oRep.ID.ToString(); txtName.Text = oRep.Name; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtRepID.Text.Trim().Length == 0) { Clear(); txtUser.Focus(); } if (oRep.Find(txtRepID.Text)) { txtName.Text = oRep.Name; return; } else { Clear(); return; } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F3: { if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } else { oUser.Delete(); Clear(); txtUser.Focus(); } } break; case Keys.F7: this.Close(); break; case Keys.PageDown: Save(); Clear(); txtUserID.Focus(); break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtOrderID if (sender == txtOrderID) { if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtOrderID.Text.Trim() == "") { txtOrderID.Clear(); txtOrderID.Focus(); return; } if (oOrder.Find(Convert.ToInt32(txtOrderID.Text))) { if (CompanyID != oOrder.CompanyID) { MessageBox.Show("Different Order's Company/Season"); txtOrderID.Clear(); txtOrderID.Focus(); return; } txtTeacher.Text = oOrder.Teacher; txtStudent.Text = oOrder.Student; this.ShowOrder(Convert.ToInt32(txtOrderID.Text)); if (oOrder.Packed) { MessageBox.Show("Order already packed " + oOrder.BoxesPacked.ToString() + " boxes"); txtBoxes.Enabled = true; txtBoxes.Text = oOrder.BoxesPacked.ToString(); txtBoxes.Focus(); /* Clear(); * txtOrderID.Clear(); * txtOrderID.Focus();*/ return; } txtOrderID.Enabled = false; txtBoxes.Enabled = false; txtProductID.Focus(); return; } else { MessageBox.Show("Order not found..."); txtOrderID.Clear(); txtOrderID.Focus(); return; } } } #endregion #region txtProductID if (sender == txtProductID) { if (e.KeyCode.ToString() == "F8") { this.Grid.Focus(); } if (e.KeyCode.ToString() == "F2") { if (oOrder.oProduct.View()) { this.txtProductID.Text = oOrder.oProduct.ID; return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { txtDescription.Clear(); if (txtProductID.Text.ToUpper() == "DONE") { if (!oOrder.IfDone()) { Global.playSimpleSound(1); txtDescription.Text = "You have products left"; ActiveLeft(); txtProductID.Clear(); txtProductID.Focus(); return; } txtBoxes.Clear(); txtBoxes.Enabled = true; txtBoxes.Focus(); //txtOrderID.Enabled = true; return; } if (txtProductID.Text.ToUpper() == "ABORT") { Clear(); groupBox2.Focus(); txtOrderID.Enabled = true; txtOrderID.Focus(); return; } BarCode_2: if (txtProductID.Text.Length < 12) { txtProductID.Text = oOrder.GetItem(txtProductID.Text); if (txtProductID.Text == "") { Global.playSimpleSound(2); txtDescription.Text = "PRODUCT NOT IN ORDER"; this.txtProductID.Clear(); this.txtProductID.Focus(); return; } } //Check by Code if (oOrder.ScanItems.Contains(txtProductID.Text)) { if (oOrder.ScanItems[txtProductID.Text].Quantity < (oOrder.ScanItems[txtProductID.Text].Scanned + 1)) { Global.playSimpleSound(3); txtDescription.Text = "EXTRA PRODUCT !!!"; txtProductID.Clear(); return; } oOrder.ScanItems[txtProductID.Text].Scanned += 1; //if (oOrder.ScanItems[txtProductID.Text].Scanned == oOrder.ScanItems[txtProductID.Text].Quantity) // DeleteRow(); this.txtDescription.Text = oOrder.ScanItems[txtProductID.Text].Description; //this.ScannedItems.Text = oOrder.ScanItems[txtProductID.Text].ProductID + " - " + oOrder.ScanItems[txtProductID.Text].Description; //this.ScannedItems.Items.Add(oOrder.ScanItems[txtProductID.Text].ProductID + " - " + oOrder.ScanItems[txtProductID.Text].Description); if (oOrder.ScanItems[txtProductID.Text].Scanned == oOrder.ScanItems[txtProductID.Text].Quantity) { //oOrder.ScanItems[txtProductID.Text].Packed = ""; this.ActiveRow(true); } else { this.ActiveRow(false); } Grid.DataBind(); this.txtProductID.Clear(); //this.txtDescription.Text = ""; // return; } else { String Barcode2 = oOrder.GetSecondaryBarcode(txtProductID.Text); if (Barcode2 != "") { txtProductID.Text = Barcode2; goto BarCode_2; } Global.playSimpleSound(5); txtDescription.Text = "PRODUCT NOT IN ORDER"; this.txtProductID.Clear(); this.txtProductID.Focus(); return; } } } #endregion #region txtBoxes if (sender == txtBoxes) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtBoxes.Text == "") { txtBoxes.Focus(); return; } if (txtBoxes.Text.ToUpper() == "DONE" || txtBoxes.Text.ToUpper() == "ONE") { txtBoxes.Text = "1"; } oOrder.BoxesPacked = Convert.ToInt16(txtBoxes.Text); oOrder.UpdatePacked(true); Clear(); txtBoxes.Enabled = false; txtOrderID.Enabled = true; txtOrderID.Focus(); return; } } #endregion #region txtGrid if (sender == this.Grid) { if (e.KeyCode.ToString() == "F8") { this.txtProductID.Focus(); return; } if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown) { //return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: this.Grid.Focus(); break; case Keys.F3: break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtProductID_KeyUp(object sender, KeyEventArgs e) { #region txtProductID if (sender == txtProductID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oProduct.View()) { if (oProduct.BarCode.Trim().Length < 11) { Global.ShowNotifier("Please check Barcode"); return; } //ShowProduct(); txtProductID.Text = oProduct.ID; txtProduct.Text = oProduct.BarCode + "-" + oProduct.Description; txtDescription.Focus(); cboProductType.Text = oProduct.BarCode.Substring(0, 1); txtManufacturerCode.Text = oProduct.BarCode.Substring(1, 5); txtProductCode.Text = oProduct.BarCode.Substring(6, 5); txtChecksumDigit.Text = oProduct.BarCode.Substring(11, 1); txtDescription.Text = oProduct.ID + "-" + oProduct.Description; cboScale.Text = "1.0"; txtHeight.Text = "0.6"; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtProductID.Text.Trim().Length == 0) { //Clear(); txtProductID.Focus(); } if (oProduct.Find(txtProductID.Text)) { //ShowProduct(); txtDescription.Focus(); txtProductID.Text = oProduct.ID; if (oProduct.BarCode == "") { MessageBox.Show("No barcode entered"); txtProductID.Focus(); return; } txtProduct.Text = oProduct.BarCode + "-" + oProduct.Description; txtDescription.Focus(); cboProductType.Text = oProduct.BarCode.Substring(0, 1); txtManufacturerCode.Text = oProduct.BarCode.Substring(1, 5); txtProductCode.Text = oProduct.BarCode.Substring(6, 5); txtChecksumDigit.Text = oProduct.BarCode.Substring(11, 1); txtDescription.Text = oProduct.ID + "-" + oProduct.Description; cboScale.Text = "1.0"; txtHeight.Text = "0.6"; } else { //Clear(); } } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F3: { if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } else { oProduct.Delete(); //Clear(); txtProductID.Focus(); } } break; case Keys.F7: this.Close(); break; case Keys.PageDown: //Save(); txtProductID.Focus(); break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtOrderID if (sender == txtOrderID) { if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtOrderID.Text.Trim() == "") { txtOrderID.Clear(); txtOrderID.Focus(); return; } int split = txtOrderID.Text.IndexOf('.'); if (split > -1) { txtOrderID.Text = txtOrderID.Text.Substring(0, split).Trim(); } Int32 OrderID; try { OrderID = Convert.ToInt32(txtOrderID.Text); } catch (Exception ex) { Global.ShowNotifier(ex.Message); Global.playSimpleSound(3); txtOrderID.Clear(); txtOrderID.Focus(); return; } if (oPacking.Find(OrderID, Global.CurrrentLine)) { if (oPacking.ScanItems.Count == 0) { MessageBox.Show("This order does exist but has no items with this product type: " + Global.CurrrentLine); txtOrderID.Clear(); txtOrderID.Focus(); return; } if (CompanyID != oPacking.CompanyID) { MessageBox.Show("Different Order's Company/Season"); txtOrderID.Clear(); txtOrderID.Focus(); return; } txtTeacher.Text = oPacking.Teacher; txtStudent.Text = oPacking.Student; Order.PackByOrder oOB = new Order.PackByOrder(); if (oOB.Find(Convert.ToInt32(txtOrderID.Text), Global.CurrrentLine)) { if (oOB.Packed) // (oPacking.Packed) { MessageBox.Show("Order already packed by " + oOB.Packer + " " + oOB.BoxesPacked.ToString() + " boxes"); txtBoxes.Enabled = true; txtBoxes.Text = oOB.BoxesPacked.ToString(); txtBoxes.Focus(); return; } } /* * if (oPacking.Packed) * { * MessageBox.Show("Order already packed by " + oPacking.Packer + " " + oPacking.BoxesPacked.ToString()+" boxes"); * txtBoxes.Enabled = true; * txtBoxes.Text = oPacking.BoxesPacked.ToString(); * txtBoxes.Focus(); * * return; * } */ this.ShowOrder(); txtOrderID.Enabled = false; txtBoxes.Enabled = false; txtProductID.BackColor = Color.White; txtProductID.Focus(); return; } else { MessageBox.Show("Order not found..."); txtOrderID.Clear(); txtOrderID.Focus(); return; } } } #endregion #region txtProductID if (sender == txtProductID) { if (e.KeyCode.ToString() == "F8") { this.Grid.Focus(); } if (e.KeyCode.ToString() == "F2") { if (oPacking.oProduct.View()) { this.txtProductID.Text = oPacking.oProduct.ID; return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { txtDescription.Clear(); if (txtProductID.Text.ToUpper() == "DONE") { if (!oPacking.IfDone()) { Global.playSimpleSound(1); txtDescription.Text = "You have products left"; ActiveLeft(); txtProductID.Clear(); txtProductID.Focus(); return; } txtBoxes.Clear(); txtBoxes.Enabled = true; txtBoxes.Focus(); //txtOrderID.Enabled = true; return; } if (txtProductID.Text.ToUpper() == "ABORT") { Clear(); groupBox2.Focus(); txtOrderID.Enabled = true; txtOrderID.Focus(); return; } BarCode_2: if (txtProductID.Text.Length < 12) { if (!oPacking.ScanItems.Contains(txtProductID.Text)) { txtProductID.Text = oPacking.GetItem(txtProductID.Text); if (txtProductID.Text == "") { Global.playSimpleSound(2); txtDescription.Text = "PRODUCT NOT IN ORDER"; this.txtProductID.Clear(); this.txtProductID.Focus(); return; } } } //Check by Code if (oPacking.ScanItems.Contains(txtProductID.Text)) { if (oPacking.ScanItems[txtProductID.Text].Quantity < (oPacking.ScanItems[txtProductID.Text].Scanned + 1)) { Global.playSimpleSound(3); txtDescription.Text = "EXTRA PRODUCT !!!"; txtProductID.Clear(); return; } oPacking.ScanItems[txtProductID.Text].Scanned += 1; //if (oPacking.ScanItems[txtProductID.Text].Scanned == oPacking.ScanItems[txtProductID.Text].Quantity) // DeleteRow(); this.txtDescription.Text = oPacking.ScanItems[txtProductID.Text].Description; //this.ScannedItems.Text = oPacking.ScanItems[txtProductID.Text].ProductID + " - " + oPacking.ScanItems[txtProductID.Text].Description; //this.ScannedItems.Items.Add(oPacking.ScanItems[txtProductID.Text].ProductID + " - " + oPacking.ScanItems[txtProductID.Text].Description); if (oPacking.ScanItems[txtProductID.Text].Scanned == oPacking.ScanItems[txtProductID.Text].Quantity) { //oPacking.ScanItems[txtProductID.Text].Packed = ""; this.ActiveRow(true); } else { this.ActiveRow(false); } // Grid.DataBind(); this.txtProductID.Clear(); //this.txtDescription.Text = ""; // return; } else { String Barcode2 = oPacking.GetSecondaryBarcode(txtProductID.Text); if (Barcode2 != "") { txtProductID.Text = Barcode2; goto BarCode_2; } Global.playSimpleSound(5); txtDescription.Text = "PRODUCT NOT IN ORDER"; this.txtProductID.Clear(); this.txtProductID.Focus(); return; } } } #endregion #region txtBoxes if (sender == txtBoxes) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtBoxes.Text == "") { txtBoxes.Focus(); return; } if (txtBoxes.Text.ToUpper() == "DONE" || txtBoxes.Text.ToUpper() == "ONE") { txtBoxes.Text = "1"; } try { oPacking.BoxesPacked = Convert.ToInt16(txtBoxes.Text); //oPacking.Lines[Global.CurrrentLine].BoxesPacked = Convert.ToInt16(txtBoxes.Text); } catch { txtBoxes.Text = ""; txtBoxes.Focus(); return; } oPacking.UpdatePacked(true, Global.CurrrentLine); PrintTitle(); Clear(); txtBoxes.Enabled = false; txtOrderID.Enabled = true; txtOrderID.Focus(); return; } } #endregion #region txtGrid if (sender == this.Grid) { //MessageBox.Show(e.KeyData.ToString()); if (Char.IsDigit(Convert.ToChar(e.KeyValue))) { txtProductID.Focus(); txtProductID.Text += Convert.ToChar(e.KeyValue).ToString(); SendKeys.Send("{END}"); return; } if (e.KeyCode.ToString() == "F8") { this.txtProductID.Focus(); return; } if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown) { //return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: this.Grid.Focus(); break; case Keys.F3: break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }
private void txtControl_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtSearch if (sender == txtSearch) { if (e.KeyCode == Keys.Tab) { MessageBox.Show("Tab"); Grid.Focus(); return; } } #endregion #region Grid if (sender == Grid) { if (e.KeyCode == Keys.Tab) { txtSearch.Focus(); return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Up: if (Grid.Focused) { if (Grid.Rows.Count == 0) { } else if (Grid.ActiveRow == Grid.Rows[0]) { txtSearch.Focus(); } else { Grid.PerformAction(UltraGridAction.AboveCell, false, false); } } e.Handled = true; break; case Keys.Down: if (txtSearch.Focused && Grid.Rows.Count > 0) { Grid.Focus(); } Grid.PerformAction(UltraGridAction.BelowCell, false, false); e.Handled = true; break; case Keys.Right: //UltraGrid1.PerformAction(ExitEditMode, False, False) Grid.PerformAction(UltraGridAction.NextCellByTab, false, false); e.Handled = true; //UltraGrid1.PerformAction(EnterEditMode, False, False) break; case Keys.Left: //UltraGrid1.PerformAction(ExitEditMode, False, False) Grid.PerformAction(UltraGridAction.PrevCellByTab, false, false); e.Handled = true; //UltraGrid1.PerformAction(EnterEditMode, False, False) break; case Keys.Enter: DataGrid_MouseUp(null, null); e.Handled = true; break; } #endregion }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtOrderID if (sender == txtOrderID) { if (e.KeyCode.ToString() == "Return" || e.KeyCode.ToString() == "Tab") { if (txtOrderID.Text.Trim() == "") { txtOrderID.Clear(); txtOrderID.Focus(); return; } Int32 OrderID; try { OrderID = Convert.ToInt32(txtOrderID.Text); } catch (Exception ex) { Global.ShowNotifier(ex.Message); Global.playSimpleSound(3); txtOrderID.Clear(); txtOrderID.Focus(); return; } if (oImprinting.Find(OrderID, Global.CurrrentLine)) { if (oImprinting.ImprintItems.Count == 0) { Global.ShowNotifier("This order does exist but has no items with this product type: " + Global.CurrrentLine); txtOrderID.Clear(); txtOrderID.Focus(); return; } if (CompanyID != oImprinting.CompanyID) { Global.ShowNotifier("Different Order's Company/Season"); txtOrderID.Clear(); txtOrderID.Focus(); return; } txtTeacher.Text = oImprinting.Teacher; txtStudent.Text = oImprinting.Student; if (oImprinting.Imprinted) { Global.ShowNotifier("Order already printed"); //return; } this.ShowOrder(); txtOrderID.Enabled = false; //txtBoxes.Enabled = false; txtProductID.BackColor = Color.White; txtProductID.Focus(); return; } else { MessageBox.Show("Order not found..."); txtOrderID.Clear(); txtOrderID.Focus(); return; } } } #endregion #region txtProductID if (sender == txtProductID) { if (e.KeyCode.ToString() == "F8") { this.Grid.Focus(); } if (e.KeyCode.ToString() == "F2") { if (oImprinting.oProduct.View()) { this.txtProductID.Text = oImprinting.oProduct.ID; return; } } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { txtDescription.Clear(); if (txtProductID.Text.ToUpper() == "DONE") { if (!oImprinting.IfDone()) { Global.playSimpleSound(1); txtDescription.Text = "You have products left"; Global.ShowNotifier(txtDescription.Text); ActiveLeft(); txtProductID.Clear(); txtProductID.Focus(); return; } oImprinting.UpdateImprinted(true, Global.CurrrentLine); Clear(); txtOrderID.Enabled = true; txtOrderID.Focus(); return; } if (txtProductID.Text.ToUpper() == "ABORT") { Clear(); groupBox2.Focus(); txtOrderID.Enabled = true; txtOrderID.Focus(); return; } Imprinting.ImprintItem oItem = oImprinting.GetItem(txtProductID.Text); if (oItem == null) { oItem = oImprinting.GetItemTicket(txtProductID.Text); } if (oItem == null) { Global.playSimpleSound(2); txtDescription.Text = "TICKET OR PRODUCT NOT IN ORDER"; Global.ShowNotifier(txtDescription.Text); this.txtProductID.Clear(); this.txtProductID.Focus(); return; } txtProductID.Text = oItem.TicketID.ToString(); if (oItem.Printed) { Global.playSimpleSound(2); txtDescription.Text = "TICKET ALREADY PRINTED"; Global.ShowNotifier(txtDescription.Text); /*if (MessageBox.Show("Do you want reprint this Ticket?", "Re-print", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2) == DialogResult.Yes) * { * oTicket.Find(Convert.ToInt32(txtProductID.Text)); * frmTicket frm = new frmTicket(oTicket); * frm.Show(); * if (!frm.Print()) * { * Global.ShowNotifier("No Printed"); * frm.Dispose(); * return; * } * frm.Dispose(); * oImprinting.ImprintItems[txtProductID.Text].Printed = true; * } * else*/ { this.txtProductID.Clear(); this.txtProductID.Focus(); return; } } else { oTicket.Find(Convert.ToInt32(txtProductID.Text)); frmTicket frm = new frmTicket(oTicket); frm.Show(); if (!frm.Print()) { Global.ShowNotifier("No Printed"); frm.Dispose(); return; } frm.Dispose(); oImprinting.ImprintItems[txtProductID.Text].Printed = true; } if (oImprinting.ImprintItems.Contains(txtProductID.Text)) { this.txtDescription.Text = oImprinting.ImprintItems[txtProductID.Text].Description; if (oImprinting.ImprintItems[txtProductID.Text].Printed) { this.ActiveRow(true); } else { this.ActiveRow(false); } // Grid.DataBind(); this.txtProductID.Clear(); return; } } } #endregion #region txtGrid if (sender == this.Grid) { //MessageBox.Show(e.KeyData.ToString()); if (Char.IsDigit(Convert.ToChar(e.KeyValue))) { txtProductID.Focus(); txtProductID.Text += Convert.ToChar(e.KeyValue).ToString(); SendKeys.Send("{END}"); return; } if (e.KeyCode.ToString() == "F8") { this.txtProductID.Focus(); return; } if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown) { //return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: this.Grid.Focus(); break; case Keys.F3: break; case Keys.PageDown: break; //case Keys.<some key>: // ......; // break; } #endregion }