示例#1
0
        private void butSave_Click(object sender, System.EventArgs e)
        {
            if (this.txtCharge.Text.Length == 0)
            {
                this.txtCharge.Text = "0.00";
            }

            //	if (Convert.ToDouble(this.txtCharge.Text)==0)
            //		MessageBox.Show("Charge Value should be other than 0");
            //	else
            //	{
            oRep.Find(Rep.RepID);
            if (this.ActionType == "Edit")
            {
                String Sql = new string(' ', 200);
                Sql = String.Format("Update rep_charges Set Description = \"{0}\", Description_1 = \"{1}\", Description_2 =\"{2}\", Charge=\"{3}\", Date=\"{4}\", Rep_ID='{5}'" + " Where ChargeID='" + Rep.ChargeID + "'",
                                    this.txtDesc_1.Text, this.txtDesc_2.Text, this.txtDesc_3.Text, this.txtCharge.Text, this.Date.Value.ToString("yyyy-MM-dd"), oRep.RepID);
                Global.oMySql.exec_sql(Sql);
                this.Dispose(true);
            }
            else
            {
                txtCharge_Validating(null, null);

                String Sql = new string(' ', 200);
                Sql = String.Format("Insert into rep_charges (CompanyID, RepID, Description,Description_1,Description_2,Charge, Date, Rep_ID)  Values(\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\")",
                                    this.Rep.CompanyID, oRep.RepID, this.txtDesc_1.Text, this.txtDesc_2.Text, this.txtDesc_3.Text, this.txtCharge.Text, this.Date.Value.ToString("yyyy-MM-dd"), oRep.RepID);
                Global.oMySql.exec_sql(Sql);
                this.Dispose(true);
            }
            //	}
        }
        public ActionResult SyncService(string id)
        {
            int idInt;

            if (string.IsNullOrWhiteSpace(id) || !int.TryParse(id, out idInt))
            {
                ShowNotify("无效同步服务ID");
                return(UIHelper.Result());
            }
            try
            {
                var list = _alertContacts.Find(t => t.ServiceId == idInt).ToList();
                if (list.Count > 0)
                {
                    var model = Rep.Get(t => t._id == idInt);
                    var sList = Rep.Find(t => t.PrimaryId == model.PrimaryId && t._id != idInt).ToList();

                    var rList = new List <ServiceAlertContacts>();

                    sList.ForEach(k =>
                    {
                        list.ForEach(l =>
                        {
                            var m       = (ServiceAlertContacts)l.Clone();
                            m._id       = Guid.NewGuid().ToString();
                            m.ServiceId = Convert.ToInt32(k._id);
                            m.PrimaryId = k.PrimaryId;
                            rList.Add(m);
                        });
                    });
                    _alertContacts.Delete(t => t.PrimaryId == model.PrimaryId && t.ServiceId != idInt);
                    _alertContacts.BulkInsert(rList);
                    ShowNotify("同步成功");
                }
                else
                {
                    ShowNotify("无同步数据");
                }
            }
            catch (Exception e)
            {
                Alert.Show(e.Message, MessageBoxIcon.Warning);
                throw;
            }
            return(UIHelper.Result());
        }
示例#3
0
 private void txtRepID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode.ToString() == "F2")
     {
         btnSearchNow_Click(null, null);
     }
     if (e.KeyCode.ToString() == "Enter")
     {
         //cmdFillList_Click(null, null);
         if (txtRepID.Text != "")
         {
             if (oRep.Find(Convert.ToInt32(txtRepID.Text)))
             {
                 txtName.Text = oRep.Name;
             }
         }
     }
 }
示例#4
0
        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
        }
示例#5
0
        private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            #region txtCustomerID
            if (sender == txtCustomerID)
            {
                if (e.KeyCode.ToString() == "F2")
                {
                    if (oCustomer.View())
                    {
                        txtCustomerID.Text = oCustomer.ID;
                        txtName.Text       = oCustomer.Name;
                    }
                    return;
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtCustomerID.Text.Trim().Length == 0)
                    {
                        txtCustomerID.Focus();
                    }

                    if (oCustomer.Find(txtCustomerID.Text))
                    {
                        txtCustomerID.Text = oCustomer.ID;
                        txtName.Text       = oCustomer.Name;
                    }
                }
            }
            #endregion
            #region txtCustomerID_2
            if (sender == txtCustomerID_2)
            {
                if (e.KeyCode.ToString() == "F2")
                {
                    if (oCustomer.View())
                    {
                        txtCustomerID_2.Text = oCustomer.ID;
                        txtName_2.Text       = oCustomer.Name;
                    }
                    return;
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtCustomerID_2.Text.Trim().Length == 0)
                    {
                        txtCustomerID_2.Focus();
                    }

                    if (oCustomer.Find(txtCustomerID_2.Text))
                    {
                        txtCustomerID_2.Text = oCustomer.ID;
                        txtName_2.Text       = oCustomer.Name;
                    }
                }
            }
            #endregion
            #region txtRepID
            if (sender == txtRepID)
            {
                if (e.KeyCode.ToString() == "F2")
                {
                    if (oRep.View())
                    {
                        txtRepID.Text   = oRep.ID.ToString();
                        txtRepName.Text = oRep.Name;
                    }

                    return;
                }
                if (e.KeyCode == Keys.Enter)
                {
                    if (oRep.Find(txtRepID.Text))
                    {
                        txtRepID.Text   = oRep.ID.ToString();
                        txtRepName.Text = oRep.Name;
                    }

                    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.F7:
                this.Close();
                break;

            case Keys.PageDown:
                oCustomer.PrintCustomerListing(txtCustomerID.Text, txtCustomerID_2.Text, txtRepID.Text, txtZero.Checked, bRegisters.Checked);
                this.Dispose();
                break;


                //case Keys.<some key>:
                // ......;
                // break;
            }
            #endregion
        }
示例#6
0
        private void txtRepID_KeyUp(object sender, KeyEventArgs e)
        {
            if (sender == txtRepID)
            {
                if (e.KeyCode == Keys.F2)
                {
                    if (oVoicemail.View())
                    {
                        txtRepID.Text = oVoicemail.ID;
                        oRep.Find(oVoicemail.RepID);
                        lbRepName.Text = oRep.Name;
                        return;
                    }
                }
                if (e.KeyCode == Keys.Enter)
                {
                    if (txtRepID.Text.Trim() == "")
                    {
                        return;
                    }

                    if (oVoicemail.Find(txtRepID.Text))
                    {
                        txtRepID.Text = oVoicemail.ID;
                        oRep.Find(oVoicemail.RepID);
                        lbRepName.Text = oRep.Name;
                        return;
                    }
                }
            }
            if (sender == txtRepID_2)
            {
                if (e.KeyCode == Keys.F2)
                {
                    if (oVoicemail.View())
                    {
                        txtRepID_2.Text = oVoicemail.ID;
                        oRep.Find(oVoicemail.RepID);
                        lbRepName_2.Text = oRep.Name;
                        return;
                    }
                }
                if (e.KeyCode == Keys.Enter)
                {
                    if (txtRepID_2.Text.Trim() == "")
                    {
                        return;
                    }

                    if (oVoicemail.Find(txtRepID_2.Text))
                    {
                        txtRepID_2.Text = oVoicemail.ID;
                        oRep.Find(oVoicemail.RepID);
                        lbRepName_2.Text = oRep.Name;
                        return;
                    }
                }
            }

            if (e.KeyCode == Keys.PageDown)
            {
                if (!cbSummary.Checked)
                {
                    oRep.PrintCommissionReport(txtRepID.Text, txtRepID_2.Text, "", false);
                }
                else
                {
                    oRep.PrintCommissionSummaryReport(txtRepID.Text, txtRepID_2.Text);
                }
            }
        }
        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 txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            #region txtRepID
            if (sender == txtRepID)
            {
                if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3)
                {
                    return;
                }


                if (e.KeyCode.ToString() == "F2")
                {
                    if (oRep.ViewByID())
                    {
                        ShowVendor();
                    }

                    if (txtRepID.Text == "")
                    {
                        return;
                    }

                    oRep.Items.Load(this.CompanyID, Convert.ToInt32(txtRepID.Text));
                    Grid.DataSource = oRep.Items.dtItems;
                    Grid.DataBind();
                    Grid.Focus();
                    MoveLast();
                    return;
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtRepID.Text.Trim().Length == 0)
                    {
                        Clear();
                        txtRepID.Focus();
                    }

                    if (oRep.Find(Convert.ToInt32(txtRepID.Text)))
                    {
                        ShowVendor();
                        oRep.Items.Load(this.CompanyID, Convert.ToInt32(txtRepID.Text));
                        Grid.DataSource = oRep.Items.dtItems;
                        Grid.DataBind();
                        Grid.Focus();
                        MoveLast();
                    }
                    else
                    {
                        Clear();
                        txtRepID.Focus();

                        /*
                         * oRep.ID = Convert.ToInt32(txtRepID.Text);
                         * oRep.Items.AddEmpty();
                         * Grid.DataSource = oRep.Items.dtItems;
                         * Grid.DataBind();
                         * Grid.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 (!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["Cost"].Activate();
                            Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
                            return;
                        }
                        else if (Grid.ActiveRow.Cells["Cost"] == Grid.ActiveCell)
                        {
                            Grid.ActiveRow.Cells["HTS_Number"].Activate();
                            Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
                            return;
                        }
                        else if (Grid.ActiveRow.Cells["HTS_Number"] == Grid.ActiveCell)
                        {
                            Grid.ActiveRow.Cells["HTS_Rate"].Activate();
                            Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
                            return;
                        }
                        else if (Grid.ActiveRow.Cells["HTS_Rate"] == Grid.ActiveCell)
                        {
                            Grid.ActiveRow.Cells["HTS_Price"].Activate();
                            Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
                            return;
                        }
                        else if (Grid.ActiveRow.Cells["HTS_Price"] == Grid.ActiveCell)
                        {
                            Grid.ActiveRow.Cells["Country"].Activate();
                            Grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
                            return;
                        }

                        if (Grid.GetRow(ChildRow.Last) == Grid.ActiveRow)
                        {
                            oRep.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 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 Rep?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    MessageBox.Show("Operation Cancelled");
                    return;
                }

                break;

            case Keys.PageDown:
                this.Save();
                Grid.DataBind();
                Clear();
                txtRepID.Clear();
                txtRepID.Focus();
                break;

            case Keys.Delete:
                if (e.Control)
                {
                    DeleteItem();
                }
                break;
                //case Keys.<some key>:
                // ......;
                // break;
            }
            #endregion
        }