public override bool Save() { if (!PosContext.Instance.Training) { try { transSalesPerson.Add(); } catch (Exception e) { } } return(true); }
public override void Engage(int keyValue) { if (PosContext.Instance.Parameters.getParam("PromptForEmployee") == "FALSE") { this.States().Clear(); PosEventStack.Instance.NextEvent(); return; } switch (this.States().PeekState()) { case ENTER_SALES_PERSON: // If previously entered salesman exists // if (PosContext.Instance.CurrentEj.SalesPerson.Count > 0) // { // this.States().Clear(); // PosEventStack.Instance.NextEvent(); // return; // } this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(GET_SALES_PERSON); //Try to load employee details try { PosContext.Instance.CurrentPosDisplay.LoadEmployeeView(); } catch { } break; case GET_SALES_PERSON: this.PopState(); string salesPerson = PosContext.Instance.InputLine; if ((PosContext.Instance.CurrentEj.SalesPerson.Count > 0) && (string.IsNullOrEmpty(salesPerson.Trim()))) { this.States().Clear(); PosContext.Instance.ClearInput(); PosEventStack.Instance.NextEvent(); return; } emp = new Employee(); emp.Organization_no = PosSettings.Default.Organization; emp.Employee_no = salesPerson; 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(SET_SALES_PERSON_JOURNAL); PosEventStack.Instance.NextEvent(); break; case SET_SALES_PERSON_JOURNAL: this.PopState(); transSalesPerson = new TransSalesPerson(); transSalesPerson.Trans_no = PosContext.Instance.TrxNo; transSalesPerson.Organization_no = PosSettings.Default.Organization; transSalesPerson.Pos_no = PosSettings.Default.Station; transSalesPerson.Store_no = PosSettings.Default.Store; transSalesPerson.Employee_no = emp.Employee_no; transSalesPerson.Add(); PosContext.Instance.CurrentEj.EjAdd(this); this.States().Clear(); this.promptText = ""; PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); PosContext.Instance.ClearInput(); // this.States().PushState(ENTER_SALES_PERSON); this.States().Clear(); PosEventStack.Instance.NextEvent(); break; default: break; } }