コード例 #1
0
ファイル: TicketService.cs プロジェクト: hperassi/SambaPOS-3
        public void UpdateTicketState(Ticket ticket, string stateName, string currentState, string state, string stateValue, int quantity = 0)
        {
            var sv = ticket.GetStateValue(stateName);
            if (!string.IsNullOrEmpty(currentState) && sv.State != currentState) return;
            if (sv != null && sv.StateName == stateName && sv.StateValue == stateValue && sv.Quantity == quantity && sv.State == state) return;

            ticket.SetStateValue(stateName, state, stateValue, quantity);

            _applicationState.NotifyEvent(RuleEventNames.TicketStateUpdated,
            new
            {
                Ticket = ticket,
                StateName = stateName,
                State = state,
                StateValue = stateValue,
                Quantity = quantity,
                TicketState = ticket.GetStateData()
            });
        }