/// <summary> /// Create a business event asynchronously /// </summary> /// <param name="businessId">The long id of the business</param> /// <param name="eventType">The type of business event</param> /// <param name="reference">The reference - usually the id related to the event type</param> /// <param name="notes">Notes if applicable</param> public void CreateBusinessEventAsync(long businessId, BusinessEventTypesEnum eventType, string reference, string notes = null) { var businessEvent = new BusinessEvent { BusinessId = businessId, EventType = new EnumEntity { Code = eventType.GetCode() }, Reference = reference, Notes = notes }; // Multithread it Task.Factory.StartNew(() => businessEventDao.CreateAsync(businessEvent)); }
/// <summary> /// Create a business event /// </summary> /// <param name="businessId">The long id of the business</param> /// <param name="eventType">The type of business event</param> /// <param name="reference">The reference - as an int</param> /// <param name="notes">Notes if applicable</param> public void CreateBusinessEventAsync(long businessId, BusinessEventTypesEnum eventType, int reference, string notes = null) { CreateBusinessEventAsync(businessId, eventType, reference.ToString(CultureInfo.InvariantCulture), notes); }
/// <summary> /// Create a business event synchronously, use if you need the results back immediately /// </summary> /// <param name="businessId">The long id of the business</param> /// <param name="eventType">The type of business event</param> /// <param name="reference">The reference - usually the id related to the event type</param> /// <param name="notes">Notes if applicable</param> public void CreateBusinessEvent(long businessId, BusinessEventTypesEnum eventType, string reference, string notes = null) { var businessEvent = new BusinessEvent { BusinessId = businessId, EventType = new EnumEntity { Code = eventType.GetCode() }, Reference = reference, Notes = notes }; // single thread it businessEventDao.Create(businessEvent); }