예제 #1
0
        /// <summary>
        /// Generates Email Recordr with a status of Pending to be sent by the Email Service for all receipts
        /// </summary>
        /// <param name="receipts">Receipt email address list</param>
        /// <param name="receiptsIds">Receipt email id list (if it is an employee, for call criteria)</param>
        /// <param name="subject">Email subject</param>
        /// <param name="body">Email body (HTML)</param>
        /// <param name="username">Username that requested the email creation</param>
        /// <param name="employeeId">EmployeeId of the Username that requested the email creation</param>
        public void SaveEmailList(string[] receipts, List<int> receiptsIds, string subject, string body, string username, int? employeeId)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (CallLogModel _callLogModel = new CallLogModel(_unitOfWork))
                {
                    for (int i = 0; i < receipts.Length; i++)
                    {
                        CS_Email email = SaveEmail(receipts[i], subject, body, username, employeeId);
                        if (i < receiptsIds.Count)
                            _callLogModel.AttachEmailToCallCriteria(receiptsIds[i], email.ID);
                    }
                }

                scope.Complete();
            }
        }