/// <summary> /// Completes the specified scheduled event. /// </summary> /// <param name="eventId">Internal identifier of the event.</param> /// <param name="mailingListFile">Mailing list file of the mailing event.</param> /// <param name="remarks">Remarks of the mailing event.</param> /// <param name="mailingCount">Mailing count of the mailing event.</param> /// <param name="userId">Internal identifier of the user.</param> public void CompleteEvent(int eventId, string mailingListFile, string remarks, int mailingCount, int userId) { // Get an instance of the Schedule DAO using the DALFactory ISchedule dao = (ISchedule)DALFactory.DAO.Create(DALFactory.Module.Schedule); try { decimal refundAmount = 0; int refundInventory = 0; // Get the schedule event details. ScheduleInfo schedule = dao.GetEventEntries(eventId); DesignCategory designCategory = (DesignCategory)schedule.Events[0].ProductType.LookupId; string postalTariff = schedule.Events[0].PostalTariff; int numberOfContacts = schedule.Events[0].NumberOfContacts; int orderId = schedule.Events[0].OrderId; int orderValue = schedule.Events[0].OrderValue; // Check whether there are any discripencies in mail quantity. if (numberOfContacts != mailingCount) { refundInventory = numberOfContacts - mailingCount; refundAmount = orderValue - (AccaProcess.CalculateAmount(designCategory, postalTariff, mailingCount)); } dao.CompleteEvent(eventId, mailingListFile, remarks, mailingCount, orderId, refundAmount, designCategory, refundInventory, userId); } catch { throw; } }