protected void Page_Load(object sender, EventArgs e) { if (!Usr.Current.IsAdmin) throw new Exception(""); Usr u = new Usr(ContainerPage.Url["UsrK"]); u.DeleteProfilePic(); Mailer sm = new Mailer(); sm.UsrRecipient = u; sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; sm.Body = "<p>Your profile photo has been deleted</p>"; sm.Body += "<p>This could have been for one of several reasons:</p>"; sm.Body += "<ul>"; sm.Body += "<li>Profile pictures <b>MUST BE OF YOUR FACE</b>.</li>"; sm.Body += "<li>Profile pictures must show your face clearly - make sure you <b>ZOOM IN</b>.</li>"; sm.Body += "<li>The face must match your sex"; if (u.IsMale || u.IsFemale) sm.Body += " (you currently have <b>" + (u.IsMale ? "MALE" : "FEMALE") + "</b> selected as your sex)"; sm.Body += " - see the <a href=\"[LOGIN(/pages/mydetails)]\">My details</a> page to change your selected sex.</li>"; sm.Body += "</ul>"; sm.Body += "<p>You can create a new profile picture on the <a href=\"[LOGIN(/pages/mypicture)]\">Create my picture</a> page.</p>"; sm.Subject = "Your DontStayIn profile photo has been deleted"; sm.RedirectUrl = "/pages/mypicture"; sm.Send(); Response.Redirect(u.Url()); }
public void Ban_Click(object o, System.EventArgs e) { if (Usr.Current != null && Usr.Current.IsJunior) { ThisUsr.Banned = true; ThisUsr.BannedByUsrK = Usr.Current.K; ThisUsr.BannedDateTime = DateTime.Now; ThisUsr.BannedReason = BanReasonTextBox.Text; ThisUsr.Update(); Mailer sm = new Mailer(); sm.Body = "<p>Banned user: <a href=\"[LOGIN(" + ThisUsr.Url() + ")]\">" + ThisUsr.NickName + "</a> (" + ThisUsr.K + " - " + ThisUsr.Email + ")</p>"; sm.Body += "<p>They were banned by: <a href=\"[LOGIN(" + Usr.Current.Url() + ")]\">" + Usr.Current.NickName + "</a> (" + Usr.Current.K + " - " + Usr.Current.Email + ")</p>"; sm.Body += "<p>DateTime: " + DateTime.Now.ToString() + "</p>"; sm.Body += "<p>Reason: " + ThisUsr.BannedReason + "</p>"; sm.TemplateType = Mailer.TemplateTypes.AdminNote; sm.Subject = "New banned user - " + ThisUsr.NickName + " was banned by " + Usr.Current.NickName; sm.To = "*****@*****.**"; sm.Send(); //PanelBanned.Visible = true; PanelBan.Visible = false; this.RunThisUsrFilter(); } }
protected void PaymentReceived(object sender, Controls.Payment.PaymentDoneEventArgs e) { if (!e.Duplicate) { Mailer m = new Mailer(); m.Body = @" <p>Thank you!</p> <p>Payment receipt for £" + ((int)(int.Parse(TicketsQuantityTextBox.Text) * 20)).ToString() + @".</p> <p>Reference: " + int.Parse(TicketsQuantityTextBox.Text) + @" ticket" + (int.Parse(TicketsQuantityTextBox.Text)==1?"":"s") + @" for Camp DSI 2006.</p> <p>Payment reference: "+e.Invoices[0].K.ToString()+@".</p> <p>Please regularly check the Camp DSI event listing for further information and updates.</p> <p>See you soon!</p>"; m.Bulk = false; m.RedirectUrl = "/uk/barnstaple/a-secret-location/2006/jun/17/event-29398"; m.Subject = "Receipt for Camp DSI tickets"; m.UsrRecipient = Usr.Current; m.Send(); Usr.Current.CampTickets += int.Parse(TicketsQuantityTextBox.Text); Usr.Current.Update(); } Update u = new Update(); u.Changes.Add(new Assign.Override(Bobs.Global.Columns.ValueInt, "(select sum(CampTickets) from Usr)")); u.Table=TablesEnum.Global; u.Where=new Q(Bobs.Global.Columns.K,Bobs.Global.Records.CampDsiTickets); u.Run(); Usr.Current.AttendEvent(29398, true, null, null); DoneQuantityLabel.Text = int.Parse(TicketsQuantityTextBox.Text).ToString() + " ticket" + (int.Parse(TicketsQuantityTextBox.Text) == 1 ? "" : "s"); ChangePanel(DonePanel); }
public void EnableCommsClick(object o, System.EventArgs e) { Mailer mail = new Mailer(); mail.SendEvenIfUnverifiedOrBroken = true; mail.Subject = "DontStayIn - verify your email address..."; mail.Body = @"<h1>Verify your email address...</h1><p>Please click the following link to verify your email address and allow posting to our discussion boards:</p> <p align=""center"" style=""padding:8px 0px 9px 0px;""><a href=""[LOGIN]"" style=""font-size:14px;font-weight:bold;"">Click here to verify your email</a></p>"; mail.To = cUsr.Email; mail.UsrRecipient = cUsr; mail.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mail.Send(); emailSentP.Visible = true; }
static void Main(string[] args) { try { Console.WriteLine("Sending ticket money in resserve..."); Utilities.EmailAccountsTicketFundsReserveAmount(); Console.WriteLine("Finished sending ticket money in resserve..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception sending ticket money in resserve</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception sending ticket money in resserve"; admin.To = Vars.EMAIL_ADDRESS_TIMI; admin.Send(); } try { Console.WriteLine("Sending gallery update emails..."); Gallery.DailySendNewGalleryEmails(); Console.WriteLine("Finished sending gallery update emails..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception sending gallery emails</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception sending gallery emails"; admin.To = "*****@*****.**"; admin.Send(); } //Mailer admin1 = new Mailer(); //admin1.TemplateType = Mailer.TemplateTypes.AdminNote; //admin1.Body = "<p>Finished sending afternoon email</p>"; //admin1.Subject = "Finished sending afternoon email"; //admin1.To = "*****@*****.**"; //admin1.Send(); Console.WriteLine("Ended!!!"); System.Environment.Exit(0); }
public static void EmailTicketRunStatusUpdate(TicketPromoterEvent ticketPromoterEvent) { // Email promoter: list of all ticket runs for the specified event detailing: status, tickets sold, money earned, end datetime. Includes links to ticket runs, event, promoter, and doorlist. // Email copy to accounts try { if (ticketPromoterEvent != null && ticketPromoterEvent.TicketRuns != null && ticketPromoterEvent.TicketRuns.Count > 0) { Mailer mailer = new Mailer(); string emailSubject = "DontStayIn ticket runs update for " + ticketPromoterEvent.Event.FriendlyName; mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p>Promoter: <a href=""[LOGIN(" + ticketPromoterEvent.Promoter.Url() + "\")]>" + ticketPromoterEvent.Promoter.Name + "</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.UrlApp("allticketruns"); } mailer.Body += @"<p>Event: <a href=""[LOGIN(" + ticketPromoterEvent.Event.Url() + "\")]>" + ticketPromoterEvent.Event.FriendlyName + "</a></p>"; mailer.Body += "<p>Ticket runs:</p><ul>"; DateTime lastTicketRunEndDateTime = DateTime.MinValue; List<TicketRun> ticketRunsToUpdate = new List<TicketRun>(); foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += @"<li><a href=""[LOGIN(" + ticketRun.Url() + "\")]>" + ticketRun.PriceBrandName + @"</a> <br>Status: " + Utilities.CamelCaseToString(ticketRun.Status.ToString()) + "<br>Sold: " + ticketRun.ValidTicketQuantity.ToString() + "<br>Money earned: " + Utilities.MoneyToHTML(ticketRun.ValidTicketQuantity * ticketRun.Price) + "<br>Ends: " + ticketRun.EndDateTime.ToString("ddd dd/MM/yyyy HH:mm") + "</li>"; lastTicketRunEndDateTime = lastTicketRunEndDateTime > ticketRun.EndDateTime ? lastTicketRunEndDateTime : ticketRun.EndDateTime; if (ticketRun.EndDateTime < DateTime.Now && !ticketRun.EmailSent) { ticketRun.EmailSent = true; ticketRunsToUpdate.Add(ticketRun); } } mailer.Body += "</ul>"; mailer.Body += @"<p>Doorlist: <a href=""[LOGIN(" + ticketPromoterEvent.Event.DoorlistUrl + "\")]>" + ticketPromoterEvent.Event.Name + " doorlist</a></p>"; if (lastTicketRunEndDateTime < DateTime.Now) { mailer.Body += "<p>Please note that all your current ticket runs for " + ticketPromoterEvent.Event.Name + " have ended. Please print off the doorlist and make sure you verify card details at the door.</p>"; } else { mailer.Body += "<p>Please note that your last ticket run for " + ticketPromoterEvent.Event.Name + " will end on " + lastTicketRunEndDateTime.ToString("ddd dd/MM/yyyy") + " at " + lastTicketRunEndDateTime.ToString("HH:mm") + ". Please wait for all ticket runs to end before printing off the doorlist. Make sure you verify card details at the door.</p>"; } if (!ticketPromoterEvent.Promoter.EnableTickets) { mailer.Body += "<br><p>We have not yet received your ticket application form. Without a processed ticket application form, you cannot receive any funds from ticket sales.</p><p>This is an automated email reminder. If you have already sent it in, please ignore this email.</p><p>" + @"<a href=""[LOGIN(" + ticketPromoterEvent.Promoter.UrlApp("plus") + "\")]>Click here for ticket application form</a></p>"; } // Send email to each user in the AdminUsrs for the Promoter account if (!Vars.DevEnv) { if (ticketPromoterEvent.Promoter != null) { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } } foreach (TicketRun ticketRun in ticketRunsToUpdate) ticketRun.Update(); // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; if (Vars.DevEnv) mailer.Subject = "TEST - " + mailer.Subject; // now send to our tickets email address mailer.To = Vars.EMAIL_ADDRESS_TICKETS; mailer.Send(); } } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailTicketPromoterEvent(): Promoter K= " + ticketPromoterEvent.PromoterK + ", Event K= " + ticketPromoterEvent.EventK, ticketPromoterEvent); } }
public static void EmailTicketPromoterEvent(TicketPromoterEvent ticketPromoterEvent) { // Email promoter: stating funds have been released and applied to their DSI promoter account // Attach Transfer if != null // Email copy to accounts try { if (ticketPromoterEvent.Promoter.EnableTickets && ticketPromoterEvent.FundsTransfer != null && Math.Round(ticketPromoterEvent.TotalFunds, 2) != 0) { Mailer mailer = new Mailer(); string emailSubject = "DontStayIn " + Utilities.CamelCaseToString(Transfer.Methods.TicketSales.ToString()).ToLower() + " (" + ticketPromoterEvent.TotalFunds.ToString("c") + ") for " + ticketPromoterEvent.Event.FriendlyName; mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p>Promoter: <a href=""[LOGIN(" + ticketPromoterEvent.Promoter.Url() + "\")]>" + ticketPromoterEvent.Promoter.Name + "</a></p>"; mailer.Body += @"<p>Event: <a href=""[LOGIN(" + ticketPromoterEvent.Event.Url() + "\")]>" + ticketPromoterEvent.Event.FriendlyName + "</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.UrlApp("allticketruns"); } mailer.Body += "<p>Total funds: " + Utilities.MoneyToHTML(ticketPromoterEvent.TotalFunds) + "</p>"; mailer.Body += @"<p>Tickets sold: " + ticketPromoterEvent.SoldTickets.ToString() + "<br>"; int cancelledTicketCount = 0; foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += ticketRun.SoldTickets.ToString() + " x " + ticketRun.PriceBrandName + "<br>"; cancelledTicketCount += ticketRun.CancelledTicketQuantity; } mailer.Body += "</p>"; if (cancelledTicketCount > 0) { mailer.Body += @"<p>Tickets cancelled: " + cancelledTicketCount.ToString() + "<br>"; foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += ticketRun.CancelledTicketQuantity.ToString() + " x " + ticketRun.PriceBrandName + "<br>"; } mailer.Body += "</p>"; } try { AddSelfBillingInvoiceToEmail(mailer, ticketPromoterEvent); } catch { } // Send email to each user in the AdminUsrs for the Promoter account if (!Vars.DevEnv) { if (ticketPromoterEvent.Promoter != null) { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } } // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; if (!Vars.DevEnv && ticketPromoterEvent.Promoter.SalesUsr != null) { mailer.UsrRecipient = ticketPromoterEvent.Promoter.SalesUsr; mailer.Send(); } mailer.UsrRecipient = null; if (Vars.DevEnv) mailer.Subject = "TEST - " + mailer.Subject; // now send to our tickets email address mailer.To = Vars.EMAIL_ADDRESS_TICKETS; try { mailer.To += ", " + ticketPromoterEvent.Promoter.SalesUsr.Email; } catch { } mailer.Send(); } } catch (Exception ex) { EmailException(ex, "<p>Occurred in Utilities.EmailTicketPromoterEvent(): Promoter K= " + ticketPromoterEvent.PromoterK + ", Event K= " + ticketPromoterEvent.EventK + "</p>", ticketPromoterEvent); } }
private static void AddRefundToEmail(Mailer mailer, Transfer transfer) { if ((transfer.Status.Equals(Transfer.StatusEnum.Pending) || transfer.Status.Equals(Transfer.StatusEnum.Success)) && transfer.Type.Equals(Transfer.TransferTypes.Refund)) { mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, transfer), "DontStayIn " + transfer.TypeToString + " #" + transfer.K.ToString() + ".doc", "application/word")); if (transfer.Promoter != null) mailer.Body += @"<p><a href=""[LOGIN(" + transfer.UrlReport() + "\")]>" + transfer.TypeToString + " for " + Utilities.MoneyToHTML(Math.Abs(transfer.Amount)) + "</a> has been "; else mailer.Body += "<p>" + transfer.TypeToString + " for " + Utilities.MoneyToHTML(Math.Abs(transfer.Amount)) + " has been "; if (transfer.Status.Equals(Transfer.StatusEnum.Pending)) mailer.Body += "setup"; else if (transfer.Status.Equals(Transfer.StatusEnum.Success)) mailer.Body += "successfully processed"; if (transfer.Promoter != null) { mailer.Body += " on your " + transfer.Promoter.LinkEmail() + " promoter account.</p>"; } else { mailer.Body += ".</p>"; } if (transfer.TransferRefundedK != 0) { Transfer transferRefunded = new Transfer(transfer.TransferRefundedK); mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, transferRefunded), "DontStayIn " + transferRefunded.TypeToString + " #" + transferRefunded.K.ToString() + ".doc", "application/word")); if (transfer.Promoter != null) mailer.Body += @"<ul type=""circle""><li><a href=""[LOGIN(" + transferRefunded.UrlReport() + "\")]>Refunding transfer #" + transferRefunded.K.ToString() + "</a></li></ul>"; else mailer.Body += @"<ul type=""circle""><li>Refunding " + transferRefunded.TypeToString.ToLower() + " #" + transferRefunded.K.ToString() + "</li></ul>"; } AddAppliedInvoices(mailer, transfer); } }
private static void AddPendingPaymentToEmail(Mailer mailer, Transfer transfer) { if (transfer.Status.Equals(Transfer.StatusEnum.Pending) && transfer.Type.Equals(Transfer.TransferTypes.Payment)) { mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, transfer), "DontStayIn " + transfer.TypeToString + " #" + transfer.K.ToString() + ".doc", "application/word")); if (transfer.Promoter != null) { mailer.Body += @"<p><a href=""[LOGIN(" + transfer.UrlReport() + "\")]>" + transfer.Status.ToString() + " " + transfer.TypeToString.ToLower() + "</a> for " + Utilities.MoneyToHTML(Math.Abs(transfer.Amount)) + " has been setup on your " + transfer.Promoter.LinkEmail() + " promoter account.</p>"; if (transfer.Method.Equals(Transfer.Methods.Cheque)) mailer.Body += "<p>Please make your cheque payable to:<br>Development Hell Limited<br>Greenhill House, Thorpe Road, Peterborough, PE3 6RU</p><p>Add reference #" + transfer.K.ToString() + " to the back of the cheque</p>"; else if (transfer.Method.Equals(Transfer.Methods.BankTransfer)) mailer.Body += "<p>Please make BACS transfer details:<br>Bank name: Barclays Bank PLC<br>Branch Name: Commercial Bank Basingstoke<br>Sort Code: 20-37-63<br>Account #: 00478377<br>(IBAN for international transfers: GB04 BARC 2037 6300 4783 77)</p><p>Add BACS reference #" + transfer.K.ToString() + "</p>"; else mailer.Body += "<p>Please make payment to:<br>Development Hell Limited<br>Greenhill House, Thorpe Road, Peterborough, PE3 6RU</p>"; } AddAppliedInvoices(mailer, transfer); } }
public static void EmailTransfer(Transfer transfer, string emailSubject, bool transferCreated, bool transferStatusChanged) { try { Mailer mailer = new Mailer(); //mailer.Attachments.Add(new System.Net.Mail.Attachment(transfer.GenerateReportMemoryStream(false), "DontStayIn " + transfer.Type.ToString() + " #" + transfer.K.ToString() + ".html", "html/plain")); mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (transfer.Promoter != null) { mailer.Body += transfer.Promoter.LinkEmailFull; } if (transfer.Usr != null) { mailer.Body += transfer.Usr.LinkEmailFull; } AddTransferToEmail(mailer, transfer); if (transfer.Promoter != null) { mailer.Body += @"<br><p><a href=""[LOGIN(" + transfer.Promoter.UrlApp("invoices") + "\")]>Click here to view all " + transfer.Promoter.Name + " invoices</a></p>"; mailer.RedirectUrl = transfer.Promoter.UrlApp("invoices"); } // Who does it go to??? All go to accounts. Newly successful transfers go to payments & promoter.adminusrs // Send email to each user in the AdminUsrs for the Promoter account if (!Vars.DevEnv && transfer.Promoter != null && ((transferStatusChanged || transferCreated) && transfer.Status.Equals(Transfer.StatusEnum.Success) || (transferCreated && transfer.Status.Equals(Transfer.StatusEnum.Pending) && transfer.Type.Equals(Transfer.TransferTypes.Refund)))) { try { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in transfer.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } if (transfer.Usr != null && !transfer.Usr.IsPromoterK(transfer.PromoterK)) { mailer.UsrRecipient = transfer.Usr; mailer.Send(); } if (transfer.Promoter.AccountsEmail != null && transfer.Promoter.AccountsEmail.Length > 0) { try { string body = "<p>" + emailSubject + "</p><p>Account: " + transfer.Promoter.Name + "</p>"; Utilities.EmailToNonUser(transfer.Promoter.AccountsEmail, mailer.Subject, body, mailer.Attachments.ToArray()); } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailTransfer(): Promoter.AccountsEmail = " + transfer.Promoter.AccountsEmail; EmailException(ex, additionalDetails, transfer); } } } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailTransfer(): Promoter.AccountsEmail = " + transfer.Promoter.AccountsEmail; EmailException(ex, additionalDetails, transfer); } } // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.Subject = ""; if (Vars.DevEnv) mailer.Subject = "TEST - "; mailer.Subject += "DontStayIn "; if (transfer.DateTimeCreated.Equals(transfer.DateTimeComplete) && transfer.Method.Equals(Transfer.Methods.Card)) mailer.Subject += "WEB "; mailer.Subject += transfer.TypeToString + " #" + transfer.K.ToString() + ", " + Math.Abs(transfer.Amount).ToString("c"); if (transfer.Usr != null) mailer.Subject += " from " + transfer.Usr.Name; if (transfer.Promoter != null) mailer.Subject += " (" + transfer.Promoter.Name + ")"; if (!Vars.DevEnv && transfer.Status.Equals(Transfer.StatusEnum.Success) && (transferStatusChanged || transferCreated)) { // Only send to [email protected] when a payment has been just been made successful mailer.To = "*****@*****.**"; mailer.Send(); } // now send to our accounts email address mailer.To = "*****@*****.**"; if (transferCreated == true) mailer.Subject += " created"; else mailer.Subject += " updated"; mailer.Subject += ", Status: " + transfer.Status.ToString(); mailer.Send(); } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailTransfer()", transfer); } }
public static void AddInvoicesToEmail(Mailer mailer, List<Invoice> invoices) { foreach (Invoice invoice in invoices) { if (invoice.Promoter != null && invoice.PromoterK != invoices[0].PromoterK) throw new Exception("Trying to email invoices for different promoters."); mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, invoice), "DontStayIn " + invoice.TypeToString + " #" + invoice.K.ToString() + ".doc", "application/word")); mailer.Body += "<p>"; if (invoice.Promoter != null) mailer.Body += @"<a href=""[LOGIN(" + invoice.UrlReport() + "\")]>"; mailer.Body += invoice.TypeToString + " #" + invoice.K.ToString() + " for " + Utilities.MoneyToHTML(Math.Abs(invoice.Total)); if (invoice.Type.Equals(Invoice.Types.Invoice)) { mailer.Body += ", - status: " + invoice.Status.ToString(); if (invoice.AmountDue > 0) mailer.Body += ", amount due: " + Utilities.MoneyToHTML(invoice.AmountDue); //mailer.Body += "</b>"; } if (invoice.Promoter != null) mailer.Body += "</a>"; if (invoice.Usr != null) { mailer.Body += @", user: "******"</p>"; if (invoice.Type.Equals(Invoice.Types.Credit)) { Query invoicesCreditedQuery = new Query(new And(new Q(InvoiceCredit.Columns.CreditInvoiceK, invoice.K), new Q(Invoice.Columns.Type, Invoice.Types.Invoice))); invoicesCreditedQuery.TableElement = new Join(Invoice.Columns.K, InvoiceCredit.Columns.InvoiceK); InvoiceSet invoicesCredited = new InvoiceSet(invoicesCreditedQuery); foreach (Invoice invoiceCredited in invoicesCredited) { mailer.Body += @"<p>"; if (invoice.Promoter != null) mailer.Body += @"<a href=""[LOGIN(" + invoiceCredited.UrlReport() + "\")]>Crediting invoice #" + invoiceCredited.K.ToString() + "</a>"; else mailer.Body += "Crediting invoice #" + invoiceCredited.K.ToString(); mailer.Body += "</p>"; } } foreach (InvoiceItem ii in invoice.Items) { mailer.Body += "<ul><li>" + HttpUtility.HtmlEncode(ii.Description) + " - " + Utilities.MoneyToHTML(Math.Abs(ii.Total)) + "</li></ul>"; } } }
static void Main(string[] args) { DateTime dt = DateTime.Now; try { Console.WriteLine("Picking mixmagvote entries..."); MixmagEntry.SendUpdateEmails(); Console.WriteLine("Finished picking mixmagvote entries..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception picking winners</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception picking winners"; admin.To = "*****@*****.**"; admin.Send(); } if (!Vars.DevEnv) { try { Console.WriteLine("Picking competitions..."); Comp.PickAllWinners(); Console.WriteLine("Finished picking competitions..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception picking winners</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception picking winners"; admin.To = "*****@*****.**"; admin.Send(); } double PickAllWinnersTime = (DateTime.Now - dt).TotalMinutes; dt = DateTime.Now; try { Console.WriteLine("Sending promoter competition reminders..."); Comp.SendPromoterReminders(); Console.WriteLine("Finished sending promoter competition reminders..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception sending promoter conpetition remintders</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception sending promoter conpetition remintders"; admin.To = "*****@*****.**"; admin.Send(); } double SendPromoterRemindersTime = (DateTime.Now - dt).TotalMinutes; dt = DateTime.Now; try { Console.WriteLine("Sending promoter guestlist reminders..."); Event.SendGuestlistReminders(); Console.WriteLine("Finished sending promoter guestlist reminders..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception sending guestlist reminders</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception sending guestlist reminders"; admin.To = "*****@*****.**"; admin.Send(); } double SendGuestlistRemindersTime = (DateTime.Now - dt).TotalMinutes; dt = DateTime.Now; try { Console.WriteLine("Sending after event user reminders..."); Event.SendAfterEventReminders(); Console.WriteLine("Finished sending after event user reminders..."); } catch (Exception ex) { Mailer admin = new Mailer(); admin.TemplateType = Mailer.TemplateTypes.AdminNote; admin.Body = "<p>Exception sending after event user reminders</p>"; admin.Body += "<p>" + ex.ToString() + "</p>"; admin.Subject = "Exception sending after event user reminders"; admin.To = "*****@*****.**"; admin.Send(); } double SendAfterEventRemindersTime = (DateTime.Now - dt).TotalMinutes; dt = DateTime.Now; } // Mailer finished = new Mailer(); // finished.TemplateType = Mailer.TemplateTypes.AdminNote; // finished.Subject = "Finished midday task"; // finished.Body = "<p>Finished midday task. Times in minutes:</p>"; // finished.Body += @"<p> //" + SendAfterEventRemindersTime.ToString("0.00") + @" - SendAfterEventRemindersTime</p>"; // finished.To = "*****@*****.**"; // finished.Send(); Console.WriteLine("Ended!!!"); System.Environment.Exit(0); }
protected void UploadNow_Click(object sender, EventArgs eventArgs) { if (InputFile.PostedFile != null) { #region Upload file Bobs.Misc m = new Bobs.Misc(); m.UsrK = Usr.Current.K; if (CurrentPromoter != null) m.PromoterK = CurrentPromoter.K; m.DateTime = DateTime.Now; m.Folder = CurrentFolder; m.Guid = Guid.NewGuid(); if (InputFile.PostedFile.FileName.IndexOf(".") == -1) m.Extention = ""; else m.Extention = InputFile.PostedFile.FileName.Substring(InputFile.PostedFile.FileName.LastIndexOf(".") + 1).ToLower(); if (m.Extention.Equals("jpeg") || m.Extention.Equals("jpe")) m.Extention = "jpg"; if (!(m.Extention.Equals("jpg") || m.Extention.Equals("gif") || m.Extention.Equals("png") || m.Extention.Equals("flv") || m.Extention.Equals("mp4") || (Usr.Current.IsAdmin && m.Extention.Equals("zip")) || m.Extention.Equals("swf"))) throw new DsiUserFriendlyException("You can only upload gif, jpg, png, flv or swf files with this page."); m.Size = InputFile.PostedFile.ContentLength; m.Name = InputFile.PostedFile.FileName.Substring(InputFile.PostedFile.FileName.LastIndexOf("\\") + 1); byte[] bytes = new byte[InputFile.PostedFile.InputStream.Length]; InputFile.PostedFile.InputStream.Read(bytes, 0, (int)InputFile.PostedFile.InputStream.Length); if (m.Extention.Equals("jpg") || m.Extention.Equals("gif") || m.Extention.Equals("png")) { using (System.Drawing.Image image = System.Drawing.Image.FromStream(new MemoryStream(bytes))) { m.Width = image.Width; m.Height = image.Height; } } if (CurrentPromoter != null) { if (m.Extention.Equals("swf")) { if (m.Size <= 150 * 1024) m.NeedsAuth = true; } } m.Update(); try { Storage.AddToStore(bytes, Storage.Stores.Pix, m.Guid, m.Extention, m, ""); } catch { m.Delete(); } if (m.NeedsAuth) { Mailer adminMail = new Mailer(); adminMail.Subject = "New files waiting to be approved!!! uploaded by" + Usr.Current.NickNameSafe; adminMail.To = "*****@*****.**"; adminMail.Body += "<p>New FILES uploaded by <a href=\"[LOGIN(" + Usr.Current.Url() + ")]\">" + Usr.Current.NickNameSafe + "</a></p>"; if (CurrentPromoter != null) adminMail.Body += "<p>... for promoter <a href=\"[LOGIN(" + CurrentPromoter.Url() + ")]\">" + CurrentPromoter.Name + "</a></p>"; adminMail.Body += "<h2>Files:</h2>"; adminMail.Body += "<p><a href=\"" + m.Url() + "\">" + HttpUtility.HtmlEncode(m.Name) + "</a> - " + m.FileSizeString + "</p>"; adminMail.TemplateType = Mailer.TemplateTypes.AdminNote; adminMail.RedirectUrl = Usr.Current.Url(); adminMail.Send(); } if (CurrentBanner != null) CurrentBanner.AssignMisc(m); #endregion if (CurrentBanner != null) Response.Redirect(CurrentBanner.Url()); else Response.Redirect(ContainerPage.Url.CurrentUrl("mode","view","misck",m.K)); } }
public void SendMatchNotification() { #region Init thread Thread t = new Thread(); t.DateTime = DateTime.Now; t.Enabled = true; t.ParentObjectK = 0; t.ParentObjectType = Model.Entities.ObjectType.None; t.Subject = "DSI Date introduction - " + this.Usr.NickName + " and " + this.DateUsr.NickName; t.UsrK = this.UsrK; t.Private = true; t.IsNews = false; t.IsSticky = false; t.Update(); t.UpdateAncestorLinks(null); ThreadUsr tu = new ThreadUsr(); tu.DateTime = DateTime.Now; tu.InvitingUsrK = this.UsrK; tu.UsrK = this.DateUsrK; tu.ThreadK = t.K; tu.ChangeStatus(ThreadUsr.StatusEnum.NewInvite); tu.StatusChangeObjectK = this.UsrK; tu.StatusChangeObjectType = Model.Entities.ObjectType.Usr; tu.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup; tu.Update(); ThreadUsr tu1 = new ThreadUsr(); tu1.DateTime = DateTime.Now; tu1.InvitingUsrK = this.DateUsrK; tu1.UsrK = this.UsrK; tu1.ThreadK = t.K; tu1.ChangeStatus(ThreadUsr.StatusEnum.NewInvite); tu1.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup; tu1.StatusChangeObjectK = this.UsrK; tu1.StatusChangeObjectType = Model.Entities.ObjectType.Usr; tu1.Update(); Comment c = new Comment(); c.DateTime = DateTime.Now; if (HttpContext.Current != null) c.Ip = Utilities.TruncateIp(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]); c.Enabled = true; string rel = ""; if (this.Usr.Relationship1 && this.DateUsr.Relationship1) rel += " <b>just friends</b>"; if (this.Usr.Relationship2 && this.DateUsr.Relationship2) rel += (rel.Length > 0 ? " or " : "") + " <b>a bit of a fling</b>"; if (this.Usr.Relationship3 && this.DateUsr.Relationship3) rel += (rel.Length > 0 ? " or " : "") + " <b>love</b>"; c.Text = "<b>You've both been matched by DSI Date.</b>\n\nYou've selected Yes to each others profiles on the DSI Date page. You're both looking for: " + rel + ".\n\nGet to know each other better in this private conversation."; c.ThreadK = t.K; c.UsrK = 3526; c.DuplicateGuid = Guid.NewGuid(); c.Update(); c = new Comment(c.K); CommentAlert.Enable(this.Usr, t.K, Model.Entities.ObjectType.Thread); CommentAlert.Enable(this.DateUsr, t.K, Model.Entities.ObjectType.Thread); t.LastPost = c.DateTime; t.LastPostUsrK = c.UsrK; t.Update(); t.UpdateTotalComments(null); //t.UpdateTotalParticipants(); UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob(); job.ExecuteSynchronously(); #endregion this.MatchThreadK = t.K; this.Update(); UsrDate udRev = new UsrDate(this.DateUsrK, this.UsrK); udRev.MatchThreadK = t.K; udRev.Update(); //Email Mailer sm = new Mailer(); sm.RedirectUrl = t.Url(); sm.Subject = "DSI Date has matched you to " + this.DateUsr.NickName; sm.Body = "<p>DSI Date has matched you to " + this.DateUsr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>"; sm.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.DateUsr.NickNameSafe + " a message</a></p>"; sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; sm.UsrRecipient = this.Usr; sm.To = this.Usr.Email; sm.Send(); Mailer sm1 = new Mailer(); sm1.RedirectUrl = t.Url(); sm1.Subject = "DSI Date has matched you to " + this.Usr.NickName; sm1.Body = "<p>DSI Date has matched you to " + this.Usr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>"; sm1.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.Usr.NickNameSafe + " a message</a></p>"; sm1.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; sm1.UsrRecipient = this.DateUsr; sm1.To = this.DateUsr.Email; sm1.Send(); }
public void CampDsiEmails(object o, System.EventArgs e) { Cambro.Web.Helpers.WriteAlertHeader(); Cambro.Web.Helpers.WriteAlert("Selecting users...", 1); Query q = new Query(); q.TableElement = new JoinLeft(Usr.Columns.K, GroupUsr.Columns.UsrK); q.TableElement = new Join(q.TableElement, new TableElement(TablesEnum.UsrEventAttended), QueryJoinType.Left, Usr.Columns.K, UsrEventAttended.Columns.UsrK); q.QueryCondition = new Or( new Q(GroupUsr.Columns.GroupK, 1060), new Q(UsrEventAttended.Columns.EventK, 29398), new Q(UsrEventAttended.Columns.EventK, 10597) ); q.Distinct = true; q.DistinctColumn = Usr.Columns.K; UsrSet bs = new UsrSet(q); for (int count = 0; count < bs.Count; count++) { Usr c = bs[count]; try { Mailer m = new Mailer(); m.UsrRecipient = c; m.RedirectUrl = "/event-29398"; m.Subject = "DontStayIn 3rd birthday bash! - Camp DSI 2006!"; m.Body = @"<p> <div style=""font-size:33px; font-weight:bold; line-height:33px;""> <center>DSI IS 3 YEARS OLD!</center> </div> </p> <p> <div style=""font-size:36px; font-weight:bold;line-height:36px;""> <center>LETS GO CAMPING!</center> </div> </p> <p> <center> Friday 16th June to Sunday 18th June 2006<br> <a href=""[LOGIN]"">Camp DSI</a> @ <a href=""[LOGIN(/uk/barnstaple/little-roadway-farm-campsite)]"">Little Roadway Farm Campsite</a> in Woolacombe, North Devon </center> </p> <table cellspacing=""10""><tr><td valign=""top""> <p> You are receiving this email because you are signed up to Camp DSI! </p> <p> This year we are heading back to the beautiful Woolacombe in Devon to celebrate our third birthday! DSI will be 3 years old! Can you believe it? </p> <p> If you're not coming, please be so kind as to take your name off the <a href=""[LOGIN]"">event page</a>. </p> <p> For those of you coming, <b>GET READY FOR A WEEKEND TO REMEMBER!</b> </p> <p> This year you can expect a marquee playing music on Friday evening, Saturday daytime and evening and Sunday daytime. We have lots of activities provided by some of our DSI regulars - currently we have: </p> <p> <b>A dressing up tent, a giant BBQ, a tea tent, a break-dancing tent, a body painting tent, a casino / strip poker tent, a massage tent, a rubber dingy racing contest, a tequila drinking contest and photography lessons!!!</b> </p> <p> If you think you could add anything to the fun, please put your name down on <a href=""[LOGIN(/chat/k-629074)]"">this topic</a> and we will be in contact. </p> <p> Tickets are £20 for the whole weekend. That includes campsite fees etc. The rest will be used to pay for marquees / sound rigs / all the other bits and bobs. </p> <p> <b>We've only got 300 tickets, but there are 400 of you signed up... Some of you might be disappointed if you don't buy your tickets early! The only way to get a ticket is to <a href=""[LOGIN]"">buy on the event page</a>. If you don't have a credit card, you can get one of your friends to buy one for you.</b> </p> <p> Everyone who buys a ticket will get a little CAMP DSI icon on their profile! </p> <p> We're really excited about this - it's going to be great to meet you all in the flesh! See you there! </p> </td> <td valign=""top""> <p> <a href=""[LOGIN(/photo-503702)]""><img src=""[WEB-ROOT]gfx/camp-dsi-jump.jpg"" width=""100"" height=""133"" border=""0"" style=""border:1px solid #000000;""></a> </p> <p> <a href=""[LOGIN(/photo-474887)]""><img src=""[WEB-ROOT]gfx/camp-dsi-matt.jpg"" width=""100"" height=""94"" border=""0"" style=""border:1px solid #000000;""></a> </p> <p> <a href=""[LOGIN(/photo-476406)]""><img src=""[WEB-ROOT]gfx/camp-dsi-vw.jpg"" width=""100"" height=""133"" border=""0"" style=""border:1px solid #000000;""></a> </p> <p> <a href=""[LOGIN(/photo-475245)]""><img src=""[WEB-ROOT]gfx/camp-dsi-girl.jpg"" width=""100"" height=""127"" border=""0"" style=""border:1px solid #000000;""></a> </p> </td></tr></table> <p style=""margin-bottom:10px;""> <center><a href=""[LOGIN]"" style=""font-size:20px; font-weight:bold;line-height:20px;"">CLICK HERE TO BUY YOUR TICKETS!</a></center> </p> "; m.Send(); //Response.Write(c.NickName + "<br>"); // Do work here! //c.Update(); if (count % 10 == 0) Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2); } catch (Exception ex) { Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3); } bs.Kill(count); } Cambro.Web.Helpers.WriteAlert("Done!", 3); Cambro.Web.Helpers.WriteAlertFooter(); }
public static void AddInvoicesToEmail(Mailer mailer, InvoiceSet invoiceSet) { List<Invoice> invoices = new List<Invoice>(); foreach (Invoice invoice in invoiceSet) invoices.Add(invoice); AddInvoicesToEmail(mailer, invoices); }
public static void AddInvoicesToEmail(Mailer mailer, Invoice invoice) { List<Invoice> invoices = new List<Invoice>(); invoices.Add(invoice); AddInvoicesToEmail(mailer, invoices); }
public void EditArticleIndexPublishClick(object o, System.EventArgs e) { if (ContainerPage.Url["Mode"].Equals("Edit")) { if ((CurrentArticle != null && !Usr.Current.CanEdit(CurrentArticle)) || (CurrentPara != null && !Usr.Current.CanEdit(CurrentPara.Article))) { ChangePanel(CantEditPanel); return; } if (!CurrentArticle.Pic.Equals(Guid.Empty) && CurrentArticle.Status.Equals(Article.StatusEnum.New)) { if (Usr.Current.IsAdmin) { CurrentArticle.EnableArticle(Usr.Current, false, true); } else if (CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Event || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Venue) { CurrentArticle.EnableArticle(Usr.Current, false, true); } else { CurrentArticle.Status = Article.StatusEnum.Edit; } CurrentArticle.Update(); Mailer sm = new Mailer(); sm.Subject = "Article published"; sm.Body += "<p>New article published:</p>"; sm.Body += "<p><a href=\"[LOGIN(" + CurrentArticle.Url() + ")]\">" + CurrentArticle.Name + "</a></p>"; sm.Body += "<p><a href=\"[LOGIN(" + UrlInfo.PageUrl("myarticles", "mode", "edit", "k", CurrentArticle.K.ToString()) + ")]\">Edit (my articles)</a></p>"; sm.Body += "<p><a href=\"http://old.dontstayin.com/login-" + Usr.Current.K + "- " + Usr.Current.LoginString + "/admin/article?ID=" + CurrentArticle.K.ToString() + "\">Edit (admin)</a></p>"; sm.TemplateType = Mailer.TemplateTypes.AdminNote; sm.To = "*****@*****.**"; sm.Send(); Response.Redirect("/pages/myarticles/mode-list"); } } }
private static void AddAppliedInvoices(Mailer mailer, Transfer transfer) { Query invoiceQuery = new Query(new Q(InvoiceTransfer.Columns.TransferK, transfer.K)); invoiceQuery.TableElement = new Join(InvoiceTransfer.Columns.InvoiceK, Invoice.Columns.K); invoiceQuery.OrderBy = new OrderBy(Invoice.Columns.K, OrderBy.OrderDirection.Ascending); InvoiceSet invoices = new InvoiceSet(invoiceQuery); if (invoices.Count > 0) { mailer.Body += "<p>Applied to the following:</p>"; AddInvoicesToEmail(mailer, invoices); } }
public static void EmailPromotersListingsReminder() { Console.WriteLine("Utilities.EmailPromotersListingsReminder();"); Query q = new Query(); q.QueryCondition = new Q(Promoter.Columns.Status, QueryOperator.NotEqualTo, Promoter.StatusEnum.Disabled); if (Vars.DevEnv) q.TopRecords = 10; PromoterSet bs = new PromoterSet(q); List<int> ks = new List<int>(); for (int count = 0; count < bs.Count; count++) { Promoter c = bs[count]; try { foreach (Usr u in c.AdminUsrs) { if (!ks.Contains(u.K)) { ks.Add(u.K); Mailer mailer = new Mailer(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mailer.Subject = "DSI LISTINGS DEADLINE - Wednesday 9AM! Get your events mailed to 200,000 clubbers for FREE!"; mailer.Body = @"<p>Club promoters!</p> <p>Make sure you have your events listed on Don't Stay In <b>before Wednesday at 9AM</b>. If you get your event listed before then, it will go into our weekly round-up of events being sent out to 200,000 raving revellers.</p> <p>If you want your event included in this week's FREE mailer, then all you need to do is <a href=""[LOGIN(/pages/events/edit)]"">list your event here</a>.</p> <p>It's free and only takes 2 minutes. You can always come back later if you want to tart it up a bit.</p> <p>Cheers,</p> <p>The DSI Team</p>"; mailer.RedirectUrl = "/pages/events/edit"; mailer.UsrRecipient = u; mailer.Send(); Console.WriteLine("sent to {0}", u.Email); } } //if (count % 10 == 0) Console.WriteLine("Done " + count + "/" + bs.Count + " " + c.UrlName, 2); } catch (Exception ex) { Console.WriteLine("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3); } bs.Kill(count); } Console.WriteLine("All done!"); Console.ReadLine(); }
private static void AddTransferToEmail(Mailer mailer, Transfer transfer) { if (transfer != null) { if (transfer.Status.Equals(Transfer.StatusEnum.Pending) && transfer.Type.Equals(Transfer.TransferTypes.Payment)) { AddPendingPaymentToEmail(mailer, transfer); } else if (transfer.Status.Equals(Transfer.StatusEnum.Success) && transfer.Type.Equals(Transfer.TransferTypes.Payment)) { AddSuccessfulPaymentToEmail(mailer, transfer); } else if ((transfer.Status.Equals(Transfer.StatusEnum.Pending) || transfer.Status.Equals(Transfer.StatusEnum.Success)) && transfer.Type.Equals(Transfer.TransferTypes.Refund)) { AddRefundToEmail(mailer, transfer); } } }
/// <summary> /// Sends email to all admin users for each promoter account that has a negative balance. /// </summary> /// <param name="monthYear">Month and year of statement to link to in email</param> public static void EmailAllPromoterOutstandingStatements(DateTime monthYear) { // Make datetime the last day (23:59:59.999) of the given month DateTime lastDayOfMonthYear = Utilities.GetEndOfMonth(monthYear); try { // Replacing CreatedDateTime with TaxDateTime, as per Gee's request for OASIS v1.5 Query promoterOutstandingQuery = new Query( new And( new Or( new And( new Q(Invoice.Columns.Type, Invoice.Types.Invoice), new Q(Invoice.Columns.TaxDateTime, QueryOperator.LessThanOrEqualTo, lastDayOfMonthYear), new Q(Invoice.Columns.Paid, false)), new And(new Q(Transfer.Columns.Type, Transfer.TransferTypes.Payment), new Q(Transfer.Columns.IsFullyApplied, false), new Q(Transfer.Columns.DateTimeCreated, QueryOperator.LessThanOrEqualTo, lastDayOfMonthYear), new Q(Transfer.Columns.Status, Transfer.StatusEnum.Success)), new And(new Q(Transfer.Columns.Type, Transfer.TransferTypes.Refund), new Q(Transfer.Columns.TransferRefundedK, 0), new Q(Transfer.Columns.DateTimeCreated, QueryOperator.LessThanOrEqualTo, lastDayOfMonthYear), new Or(new Q(Transfer.Columns.Status, Transfer.StatusEnum.Pending), new Q(Transfer.Columns.Status, Transfer.StatusEnum.Success)) ) ) ), new Q(Promoter.Columns.SuspendReminderEmails, false ) ); promoterOutstandingQuery.TableElement = new Join(Promoter.Columns.K, Invoice.Columns.PromoterK, QueryJoinType.Left); promoterOutstandingQuery.TableElement = new Join(promoterOutstandingQuery.TableElement, new TableElement(TablesEnum.Transfer), QueryJoinType.Left, Promoter.Columns.K, Transfer.Columns.PromoterK); promoterOutstandingQuery.Distinct = true; promoterOutstandingQuery.DistinctColumn = Promoter.Columns.K; PromoterSet promoters = new PromoterSet(promoterOutstandingQuery); foreach (Promoter promoter in promoters) { if (promoter.SuspendReminderEmails) { continue; } try { // first try to apply any available money to unpaid invoices. promoter.ApplyAvailableMoneyToUnpaidInvoices(); // Dont need to send statements to promoters with balance == zero decimal promoterBalance = promoter.GetBalance(); // We only send out statements to promoters who owe us money, as per Gee 15/11/06 if (Math.Round(promoterBalance, 2) < 0) { Mailer mailer = new Mailer(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mailer.Subject = "DontStayIn statement of outstanding funds for " + monthYear.ToString("MMM yyyy") + " for " + promoter.Name; mailer.Body = "<h2>DontStayIn statement of outstanding funds for " + monthYear.ToString("MMM yyyy") + "</h2>"; mailer.Body += promoter.LinkEmailFull; mailer.Body += "<p><b>Account balance: " + Utilities.MoneyToHTML(Math.Abs(promoterBalance)) + "</b></p>"; mailer.Body += @"<p><a href=""[LOGIN(" + promoter.UrlStatementReport(monthYear) + "\")]>Statement for " + monthYear.ToString("MMM yyyy") + "</a></p>"; mailer.Body += @"<p><a href=""[LOGIN(" + promoter.UrlApp("invoices", "pay", "true") + "\")]>Please pay invoices now</a>.</p>"; mailer.Attachments.Add(new System.Net.Mail.Attachment(promoter.GenerateMonthlyStatementMemoryStream(monthYear.Month, monthYear.Year, false), "DontStayIn Statement for " + monthYear.ToString("MMM yyyy") + ".doc", "application/word")); if (!Vars.DevEnv) { foreach (Usr usr in promoter.AdminUsrs) { try { mailer.UsrRecipient = usr; mailer.Send(); } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailAllPromoterOutstandingStatements(): Usr K= "; if (usr != null) additionalDetails += usr.K.ToString(); else additionalDetails += "null"; List<IBobAsHTML> bobsAsHtml = new List<IBobAsHTML>(); bobsAsHtml.Add(promoter); bobsAsHtml.Add(usr); EmailException(ex, additionalDetails, bobsAsHtml); } } } if (!Vars.DevEnv && promoter.AccountsEmail != null && promoter.AccountsEmail.Length > 0) { try { string body = ""; body = "<h2>DontStayIn statement of outstanding funds for " + monthYear.ToString("MMM yyyy") + "</h2>"; body += @"<p>Account: " + promoter.Name + " - <b>Account balance: " + Utilities.MoneyToHTML(Math.Abs(promoterBalance)) + "</b></p>"; body += @"<p>Statement for " + monthYear.ToString("MMM yyyy") + "</p>"; body += @"<p>Please pay invoices now.</p>"; Utilities.EmailToNonUser(promoter.AccountsEmail, mailer.Subject, body, mailer.Attachments.ToArray()); } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailAllPromoterOutstandingStatements(): Promoter.AccountsEmail = " + promoter.AccountsEmail; EmailException(ex, additionalDetails, promoter); } } // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; if (Vars.DevEnv) mailer.Subject = "TEST - " + mailer.Subject; mailer.To = "*****@*****.**"; mailer.Send(); } } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailAllPromoterOutstandingStatements(): Promoter K= "; if (promoter != null) additionalDetails += promoter.K.ToString(); else additionalDetails += "null"; EmailException(ex, additionalDetails, promoter); } } } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailAllPromoterOutstandingStatements()"); } }
private static void AddSuccessfulPaymentToEmail(Mailer mailer, Transfer transfer) { if (transfer.Status.Equals(Transfer.StatusEnum.Success) && transfer.Type.Equals(Transfer.TransferTypes.Payment)) { mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, transfer), "DontStayIn " + transfer.TypeToString + " #" + transfer.K.ToString() + ".doc", "application/word")); if (transfer.Promoter != null) { mailer.Body += @"<p><a href=""[LOGIN(" + transfer.UrlReport() + "\")]>Successful " + transfer.TypeToString.ToLower() + " for " + Utilities.MoneyToHTML(Math.Abs(transfer.Amount)) + "</a> has been processed on your " + transfer.Promoter.LinkEmail() + " promoter account.</p>"; } else if (transfer.Usr != null) { mailer.Body += "<p>Successful " + transfer.TypeToString.ToLower() + " for " + Utilities.MoneyToHTML(Math.Abs(transfer.Amount)) + " has been processed on your " + transfer.Usr.LinkEmail() + " user account.</p>"; } AddAppliedInvoices(mailer, transfer); } }
private static void EmailUnpaidPromotersInvoicesToPromotersAndAccounts(DateTime fromDueDate, DateTime toDueDate) { try { // Get all promoterK's who have outstanding invoices within the date range Query promoterKQuery = new Query(); promoterKQuery.QueryCondition = new And(new Q(Invoice.Columns.Type, Invoice.Types.Invoice), new Q(Invoice.Columns.Paid, false), new Q(Invoice.Columns.PromoterK, QueryOperator.NotEqualTo, 0), new Q(Invoice.Columns.DueDateTime, QueryOperator.GreaterThanOrEqualTo, fromDueDate), new Q(Invoice.Columns.DueDateTime, QueryOperator.LessThanOrEqualTo, toDueDate)); promoterKQuery.Columns = new ColumnSet(Invoice.Columns.PromoterK); promoterKQuery.GroupBy = new GroupBy(Invoice.Columns.PromoterK); InvoiceSet promoterKInvoices = new InvoiceSet(promoterKQuery); Promoter promoter = null; // Foreach promoter, group together all their outstanding invoices within the date range and send one email with all invoices as attachments foreach (Invoice promoterKInvoice in promoterKInvoices) { try { promoter = new Promoter(promoterKInvoice.PromoterK); bool containsOverdue = false; promoter.ApplyAvailableMoneyToUnpaidInvoices(); Query outstandingInvoicesQuery = new Query(new And(new Q(Invoice.Columns.Type, Invoice.Types.Invoice), new Q(Invoice.Columns.Paid, false), new Q(Invoice.Columns.DueDateTime, QueryOperator.GreaterThanOrEqualTo, fromDueDate), new Q(Invoice.Columns.DueDateTime, QueryOperator.LessThanOrEqualTo, toDueDate), new Q(Invoice.Columns.PromoterK, promoterKInvoice.PromoterK))); outstandingInvoicesQuery.OrderBy = new OrderBy(Invoice.Columns.DueDateTime, OrderBy.OrderDirection.Ascending); InvoiceSet outstandingInvoices = new InvoiceSet(outstandingInvoicesQuery); Mailer mailer = new Mailer(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; decimal totalAmountDue = 0; foreach (Invoice invoice in outstandingInvoices) { totalAmountDue += Math.Round(invoice.AmountDue, 2); if (invoice.Paid == false && new DateTime(invoice.DueDateTime.Year, invoice.DueDateTime.Month, invoice.DueDateTime.Day) <= new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)) { containsOverdue = true; } } string nonUserEmailBody = ""; // If there are no outstanding/overdue invoices, then do not send warning message if (outstandingInvoices.Count > 0) { // For overdue invoices if (containsOverdue == true) { mailer.Subject = "DontStayIn overdue invoices require payment of " + totalAmountDue.ToString("c"); mailer.Body = "<p>DontStayIn overdue invoices. Amount due " + Utilities.MoneyToHTML(totalAmountDue) + ". Payment required immediately for the following invoices:</p>"; } // For outstanding invoices else { mailer.Subject = "DontStayIn outstanding invoices require payment of " + totalAmountDue.ToString("c"); mailer.Body = "<p>DontStayIn outstanding invoices. Amount due " + Utilities.MoneyToHTML(totalAmountDue) + ". Payment required before due date for the following invoices:</p>"; } nonUserEmailBody = mailer.Body + "<p>Promoter: " + promoter.Name + "</p><p>Please pay invoices now</p>"; mailer.Body += promoter.LinkEmailFull; Utilities.AddInvoicesToEmail(mailer, outstandingInvoices); mailer.Body += @"<p><a href=""[LOGIN(" + promoter.UrlApp("invoices", "pay", "true") + "\")]>Please pay invoices now</a>.</p>"; if (!Vars.DevEnv) { if (!promoter.SuspendReminderEmails) { foreach (Usr usr in promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.RedirectUrl = promoter.UrlApp("invoices"); mailer.Send(); } } } if (!Vars.DevEnv && promoter.AccountsEmail != null && promoter.AccountsEmail.Length > 0) { try { Utilities.EmailToNonUser(promoter.AccountsEmail, mailer.Subject, nonUserEmailBody, mailer.Attachments.ToArray()); } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailAllPromoterOutstandingStatements(): Promoter.AccountsEmail = " + promoter.AccountsEmail; EmailException(ex, additionalDetails, promoter); } } // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.Subject += " (" + promoter.Name + ")"; // now send to our accounts email address mailer.To = "*****@*****.**"; mailer.Send(); } } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailUnpaidPromotersInvoicesToPromotersAndAccounts(): Promoter K= "; if (promoterKInvoice != null) additionalDetails += promoterKInvoice.PromoterK.ToString(); else additionalDetails += "null"; EmailException(ex, additionalDetails, promoter); } } } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailUnpaidPromotersInvoicesToPromotersAndAccounts()"); } }
public static bool EmailTicket(Ticket ticket) { try { if(ticket.K == 0) throw new Exception("Ticket not saved. K=0"); Mailer mailer = new Mailer(); mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, ticket), "DontStayIn Ticket #" + ticket.K.ToString() + ".doc", "application/word")); string cancelledText = ticket.Cancelled ? "Cancelled " : ""; mailer.Subject = cancelledText + "DontStayIn Ticket for " + Cambro.Misc.Utility.Snip(ticket.Event.Name, 40) + " on " + Utilities.DateToString(ticket.Event.DateTime); mailer.Body = "<h2>" + cancelledText + "DontStayIn Ticket for " + ticket.Event.FriendlyName + "</h2>"; if (!ticket.Cancelled) { StringBuilder confirmationMessage = new StringBuilder(); switch (ticket.TicketRun.DeliveryMethod) { case TicketRun.DeliveryMethodType.E_Ticket: confirmationMessage.Append(@"<p>Thank you for buying " + (ticket.Quantity > 1 ? "tickets" : "a ticket") + @" through DontStayIn.</p> <p><b>" + (ticket.Quantity > 1 ? Ticket.ETICKET_CARD_REMINDER_PLURAL : Ticket.ETICKET_CARD_REMINDER_SINGULAR) + ".</b></p>" + (ticket.Code.Length > 0 ? "<p><b>" + Ticket.ETICKET_CODE_REMINDER_SINGULAR + ".</b></p>" : "") + "<p>" + Ticket.ETICKET_CARD_REMINDER_NOT_LET_YOU_IN + " The card you paid with ends with the digits \"<b>" + ticket.CardNumberEnd + "</b>\".</p><p>Make sure you take this card with you!</p>"); break; case TicketRun.DeliveryMethodType.SpecialDelivery: string[] address = ticket.AddressParts; confirmationMessage.Append("Thanks for buying " + (ticket.Quantity > 1 ? "tickets. " : "a ticket.") + " Your tickets will be delivered to: "); confirmationMessage.Append("<p><small>"); foreach (string addressPart in address) { if (addressPart != "") { confirmationMessage.Append("<br>" + addressPart); } } confirmationMessage.Append("</small></p>"); confirmationMessage.Append("<br>around " + ticket.TicketRun.DeliveryDate.ToLongDateString() + "."); break; default: throw new NotImplementedException(); } mailer.Body += confirmationMessage; } else { mailer.Body += @"<p>You recently bought " + (ticket.Quantity > 1 ? "tickets" : "a ticket") + " through DontStayIn. Your " + (ticket.Quantity > 1 ? "tickets have" : "ticket has") + " been cancelled and your card has been refunded.</p>"; } mailer.Body += @"<br><p><b>Your " + cancelledText.ToLower() + "ticket details</b></p>"; mailer.Body += ticket.Event.LinkEmailFull; mailer.Body += "<p>Ticket ref: " + ticket.K.ToString() + "</p>"; mailer.Body += "<p>Ticket" + (ticket.Quantity > 1 ? "s" : "") + ": " + ticket.Quantity.ToString() + " x " + Utilities.MoneyToHTML(ticket.TicketRun.Price) + (ticket.Cancelled ? "" : " + booking fee (" + Utilities.MoneyToHTML(ticket.TicketRun.BookingFee) + ")") + "</p>"; if(ticket.Code.Length > 0) mailer.Body += "<p><font size='+1'><b>Ticket CODE: \"" + ticket.Code.ToString() + "\"</b></font></p>"; if(ticket.TicketRun.Name.Length > 0) mailer.Body += "<p>Ticket type: " + ticket.TicketRun.Name + "</p>"; if (ticket.TicketRun.Description.Length > 0) mailer.Body += "<p>Description: " + ticket.TicketRun.Description + "</p>"; mailer.Body += "<br><p>You can find details of all your tickets on the \"<a href=\"[LOGIN(" + ticket.BuyerUsr.UrlApp("mytickets") + "\")]>My tickets</a>\" page (on the \"My DSI\" menu).</p>"; mailer.Body += "<p><center><a href=\"[LOGIN(" + ticket.BuyerUsr.UrlApp("mytickets") + "\")]><img src=\"[WEB-ROOT]gfx/mytickets-menu.gif\" border=\"0\" align=\"center\"/></a></center></p><br>"; if (ticket.Enabled) { // Send email to BuyerUsr for the ticket purchase. mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mailer.UsrRecipient = ticket.BuyerUsr; mailer.Send(); } // Change subject for internal use if (ticket.BuyerUsr != null) mailer.Subject += " for " + ticket.BuyerUsr.NickName; if(!ticket.Cancelled && ticket.Enabled) mailer.Subject += " was purchased"; mailer.Body += ticket.AsHTML(); // now send to our tickets email address mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.To = Vars.EMAIL_ADDRESS_TICKETS; mailer.Send(); } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailTicket(ticket)", ticket); return false; } return true; }
public static void EmailAfterEventTicketFeedback() { DateTime yesterday = DateTime.Today.AddDays(-1); DateTime today = DateTime.Today; try { Query yesterdaysEventTicketsQuery = new Query(new And(new Q(Event.Columns.DateTime, QueryOperator.GreaterThanOrEqualTo, yesterday), new Q(Event.Columns.DateTime, QueryOperator.LessThan, today), Ticket.SoldTicketsQ)); yesterdaysEventTicketsQuery.TableElement = new Join(Ticket.Columns.EventK, Event.Columns.K); yesterdaysEventTicketsQuery.Columns = new ColumnSet(Ticket.Columns.BuyerUsrK, Ticket.Columns.EventK); yesterdaysEventTicketsQuery.GroupBy = new GroupBy(new GroupBy(Ticket.Columns.BuyerUsrK), new GroupBy(Ticket.Columns.EventK)); yesterdaysEventTicketsQuery.OrderBy = new OrderBy(Ticket.Columns.EventK); TicketSet eventTickets = new TicketSet(yesterdaysEventTicketsQuery); foreach (Ticket ticket in eventTickets) { try { Mailer mailer = new Mailer(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; mailer.UsrRecipient = ticket.BuyerUsr; mailer.Subject = "DontStayIn ticket feedback for " + ticket.Event.FriendlyName; //string eventUrl = @"[LOGIN(" + ticket.Event.Url(); mailer.Body = "<h2>" + mailer.Subject + @"</h2> <p>Thanks for buying your tickets with us!</p> <p>In order to provide a better service in future, we would like to know if everything went OK with getting into the event...</p> <p>Please click an option below</p> <p style='font-size:14px; font-weight:bold; padding-left:12px;'><a href=""[LOGIN(" + ticket.Event.UrlTicketFeedback(Ticket.FeedbackEnum.Good) + @")]""><img src='http://www.dontstayin.com/gfx/icon-tick-up.png' border='0' height='21' width='26' style='vertical-align:middle;'/>Yes, all OK</a></p> <p style='font-size:14px; font-weight:bold; padding-left:12px;'><a href=""[LOGIN(" + ticket.Event.UrlTicketFeedback(Ticket.FeedbackEnum.Bad) + @")]""><img src='http://www.dontstayin.com/gfx/icon-cross-up.png' border='0' height='21' width='26' style='vertical-align:middle;'/>No, there was a problem</a></p>"; mailer.Send(); } catch (Exception ex) { string additionalDetails = "Occurred in Utilities.EmailAfterEventTicketFeedback(): EventK= " + ticket.EventK.ToString() + ", BuyerUsrK= " + ticket.BuyerUsrK.ToString(); EmailException(ex, additionalDetails, ticket); } } } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailAfterEventTicketFeedback()"); } }
public static void AddSelfBillingInvoiceToEmail(Mailer mailer, TicketPromoterEvent ticketPromoterEvent) { if (ticketPromoterEvent != null && ticketPromoterEvent.FundsTransfer != null && mailer != null) { mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, ticketPromoterEvent), "DontStayIn " + Utilities.CamelCaseToString(ticketPromoterEvent.FundsTransfer.Method.ToString()) + " #" + ticketPromoterEvent.FundsTransferK.ToString() + ".doc", "application/word")); if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p><a href=""[LOGIN(" + ticketPromoterEvent.UrlReport() + "\")]>" + ticketPromoterEvent.TypeAndK + "</a> for " + Utilities.MoneyToHTML(Math.Abs(ticketPromoterEvent.FundsTransfer.Amount)) + " has been released to your " + ticketPromoterEvent.Promoter.LinkEmail() + " promoter account.</p>"; } } }
public static void EmailPromoterReminderToSubmitTicketApplicationForm(TicketPromoterEvent ticketPromoterEvent) { try { if (!ticketPromoterEvent.Promoter.EnableTickets) { Mailer mailer = new Mailer(); mailer.Subject = "DontStayIn has not yet received your ticket application form, promoter: " + ticketPromoterEvent.Promoter.Name; mailer.Body = "<h2>" + mailer.Subject + "</h2>"; mailer.Body += ticketPromoterEvent.Promoter.LinkEmailFull; mailer.Body += @"<p>You recently setup ticket sales for event: " + ticketPromoterEvent.Event.LinkEmail + "</p><p>We have not yet received your ticket application form. Without a processed ticket application form, you cannot receive any funds from ticket sales.</p><p>This is an automated email reminder. If you have already sent it in, please ignore this email.</p><p>" + @"<a href=""[LOGIN(" + ticketPromoterEvent.Promoter.UrlApp("plus") + "\")]>Click here for ticket application form</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.Url(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; if (!Vars.DevEnv) { foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } // Change subject for internal use mailer.Subject += " (K=" + ticketPromoterEvent.PromoterK.ToString() + ")"; // now send to our accounts email address mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.To = Vars.EMAIL_ADDRESS_TICKETS; try { mailer.To += ", " + ticketPromoterEvent.Promoter.SalesUsr.Email; } catch { } mailer.Send(); } } catch (Exception ex) { List<IBobAsHTML> bobsAsHtml = new List<IBobAsHTML>(); bobsAsHtml.Add(ticketPromoterEvent.Promoter); bobsAsHtml.Add(ticketPromoterEvent.Event); EmailException(ex, "Occurred in Utilities.EmailPromoterReminderToSubmitTicketApplicationForm()", bobsAsHtml); } }
public static void AdminEmailAlert(string body, string subject, string recipientAddresses) { Mailer sm = new Mailer(); sm.Body = "<p>" + body + "</p>"; sm.TemplateType = Mailer.TemplateTypes.AdminNote; sm.Subject = subject; sm.To = recipientAddresses; sm.Send(); }
public static bool EmailInvoice(Invoice invoice, string emailSubject, bool invoiceCreated) { bool emailSuccessful = true; try { Mailer mailer = new Mailer(); mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (invoice.Promoter != null) { mailer.Body += invoice.Promoter.LinkEmailFull; } AddInvoicesToEmail(mailer, new InvoiceSet(new Query(new Q(Invoice.Columns.K, invoice.K)))); if (invoice.Promoter != null) { mailer.Body += @"<p><a href=""[LOGIN(" + invoice.Promoter.UrlApp("invoices") + "\")]>Click here to view all " + invoice.Promoter.Name + " invoices</a></p>"; mailer.RedirectUrl = invoice.Promoter.UrlApp("invoices"); } try { // Send email to each user in the AdminUsrs for the Promoter account. When invoice is paid, it will appear as an attachment to the transfer email that completed its payment if (!Vars.DevEnv && invoice.Promoter != null && Math.Round(invoice.Total) != 0) { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in invoice.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } if (invoice.Usr != null && !invoice.Usr.IsPromoterK(invoice.PromoterK)) { mailer.UsrRecipient = invoice.Usr; mailer.Send(); } if (invoice.Promoter.AccountsEmail != null && invoice.Promoter.AccountsEmail.Length > 0) { try { string body = "<p>" + emailSubject + "</p><p>Account: " + invoice.Promoter.Name + "</p>"; Utilities.EmailToNonUser(invoice.Promoter.AccountsEmail, mailer.Subject, body, mailer.Attachments.ToArray()); } catch (Exception ex) { emailSuccessful = false; string additionalDetails = "Occurred in Utilities.EmailInvoice(invoice, emailSubject, invoiceCreated): Promoter.AccountsEmail = " + invoice.Promoter.AccountsEmail; EmailException(ex, additionalDetails, invoice); } } } } catch (Exception ex) { emailSuccessful = false; string additionalDetails = "Occurred in Utilities.EmailInvoice(invoice, emailSubject, invoiceCreated): Promoter.AccountsEmail = " + invoice.Promoter.AccountsEmail; EmailException(ex, additionalDetails, invoice); } // Change subject for internal use mailer.Subject = ""; if (Vars.DevEnv) mailer.Subject = "TEST - "; mailer.Subject += "DontStayIn "; if (invoice.IsImmediateCreditCardPayment) mailer.Subject += "WEB "; mailer.Subject += invoice.TypeToString + " #" + invoice.K.ToString() + ", " + Math.Abs(invoice.Total).ToString("c"); if (invoice.Usr != null) mailer.Subject += " from " + invoice.Usr.Name; if (invoice.Promoter != null) mailer.Subject += " (" + invoice.Promoter.Name + ")"; if (invoiceCreated == true) mailer.Subject += " created"; else mailer.Subject += " updated"; // now send to our accounts email address mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.To = "*****@*****.**"; mailer.Send(); } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailInvoice(invoice, emailSubject, invoiceCreated)", invoice); emailSuccessful = false; } return emailSuccessful; }