Пример #1
0
 public void Update(EjSalesPerson pEvent)
 {
     if (prompt != null)
     {
         prompt.PromptText = pEvent.PromptText;
         prompt.StartInputAnimation();
     }
 }
Пример #2
0
        void btn_Click(object sender, RoutedEventArgs e)
        {
            PosButton posButton = sender as PosButton;

            PosContext.Instance.InputLine = posButton.ItemGroup;
            EjSalesPerson ej = new EjSalesPerson();

            ej.States().PushState(EjSalesPerson.GET_SALES_PERSON);
            PosEventStack.Instance.PushEvent(ej);
            PosEventStack.Instance.NextEvent();
            //new EnterKey().Engage(0);
        }
Пример #3
0
        public override void Engage(int keyValue)
        {
            if (PosContext.Instance.CurrentEj.SalesPerson.Count == 0)
            {
                this.States().Clear();
                PosContext.Instance.ClearInput();
                PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY);
                posError.Engage(0);
                return;
            }


            switch (this.States().PeekState())
            {
            case ENTER_SALES_PERSON:



                this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo");
                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.ClearInput();
                this.States().PopState();

                this.States().PushState(GET_SALES_PERSON);

                break;



            case GET_SALES_PERSON:

                this.PopState();

                this.employee_no = PosContext.Instance.InputLine;

                Employee emp = new Employee();
                emp.Organization_no = PosSettings.Default.Organization;
                emp.Employee_no     = this.employee_no;
                emp.LoadByEmployeeNo();

                if (string.IsNullOrEmpty(emp.FName))
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.INVALID_EMPLOYEE_NO);
                    this.PromptText = PosContext.Instance.Parameters.getParam("InvalidEmployeeNumber");
                    PosEventStack.Instance.PushEvent(error);
                    PosContext.Instance.Operprompt.Update(this);
                    PosContext.Instance.ClearInput();

                    this.States().PushState(GET_SALES_PERSON);
                    PosEventStack.Instance.NextEvent();
                    return;
                }

                PosContext.Instance.ClearInput();
                this.States().PopState();

                this.States().PushState(DELETE_SALES_PERSON);
                PosEventStack.Instance.NextEvent();
                break;



            case DELETE_SALES_PERSON:

                this.PopState();

                PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesP){
                    TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesP.DataRecord();
                    if (transSalesPerson.Employee_no == this.employee_no)
                    {
                        this.ejSalesPerson = ejSalesP;
                    }
                });

                //   foreach (EjSalesPerson ejPerson in PosContext.Instance.CurrentEj.SalesPerson)
                //   {
                //               MessageBox.Show(ejPerson.Employee.Employee_no);
                //          if (ejPerson.Employee.Employee_no == this.employee_no)
                //        {
                //          this.ejSalesPerson = ejPerson;
                //      }
                //  }


                if (this.ejSalesPerson != null)
                {
                    PosContext.Instance.CurrentEj.SalesPerson.Remove(this.ejSalesPerson);
                    this.ejSalesPerson.DeleteEj();
                    PosContext.Instance.Receipt.Update(this);
                }



                this.States().Clear();
                PosEventStack.Instance.NextEvent();

                break;

            default:
                break;
            }
        }