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)
        {
            #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
        }