private void RaiseStopMachineEvent(SweetsMachine machine)
 {
     MachineEvents?.Invoke(this, new SweetsMachineSimulatorEventArg
     {
         MachineSerialNumber = machine.SerialNumber,
         EventType           = SweetsMachineEventTypes.StopMachine,
         EventTime           = DateTime.UtcNow
     });
 }
 private void RaiseTempEvent(SweetsMachine machine)
 {
     MachineEvents?.Invoke(this, new SweetsMachineSimulatorEventArg
     {
         MachineSerialNumber = machine.SerialNumber,
         EventType           = SweetsMachineEventTypes.TempSensor,
         Value1    = machine.CurrentTemp,
         EventTime = DateTime.UtcNow
     });
 }
        private void RaiseBuyProductEvent(SweetsMachine machine, Product product)
        {
            var paymentType   = 0; //Cash
            var rnPaymentType = new Random(Guid.NewGuid().GetHashCode());

            if (rnPaymentType.Next(5) == 0)
            {
                //Card
                paymentType = 1;
            }

            MachineEvents?.Invoke(this, new SweetsMachineSimulatorEventArg
            {
                MachineSerialNumber = machine.SerialNumber,
                EventType           = SweetsMachineEventTypes.BuyProduct,
                Value1    = product.ProdId,
                Value2    = product.CurrentState,
                Value3    = paymentType,
                EventTime = DateTime.UtcNow
            });
        }