/// <summary> /// Sends out an email containing a summary of the new allocations made /// to each sub editor. /// </summary> /// <param name="totalSent">total number of emails sent returned</param> /// <returns>True if emails sent okay, false if not</returns> private bool SendNotificationEmails(ref int totalSent) { UserList userList = new UserList(InputContext); userList.CreateSubEditorsList(); int[] userIDs = null; if (!userList.GetUserIDs(ref userIDs)) return false; for (int counter = 0; counter < userIDs.Length; counter++) { string emailAddress = String.Empty, emailSubject = String.Empty, emailText = String.Empty; bool toSend =true; // create their notification email object SubNotificationEmail subnotificationEmail = new SubNotificationEmail(InputContext); subnotificationEmail.CreateNotificationEmail(userIDs[counter], ref toSend, ref emailAddress, ref emailSubject, ref emailText); if(toSend) {// if we have an email to send then send it InputContext.SendMailOrSystemMessage(emailAddress, emailSubject, emailText, InputContext.CurrentSite.EditorsEmail, InputContext.CurrentSite.ShortName, false, userIDs[counter], InputContext.CurrentSite.SiteID); totalSent++; } } if (totalSent == 0) { XmlNode subAllocateForm = RootElement.SelectSingleNode("SUB-ALLOCATION-FORM"); XmlNode notifSent = AddElement(subAllocateForm, "NOTIFICATIONS-SENT","");//, dataReader.GetInt32NullAsZero("Total")); AddAttribute(notifSent, "TOTAL", totalSent); } else { XmlNode subAllocateForm = RootElement.SelectSingleNode("SUB-ALLOCATION-FORM"); XmlNode notifSent = AddElement(subAllocateForm, "NOTIFICATIONS-SENT", "An error occurred whilst trying to send emails");//, dataReader.GetInt32NullAsZero("Total")); AddAttribute(notifSent, "TYPE", "EMAIL-FAILURE"); } return true; }