public static void Temp_SendInvoiceInformationLetter2(string FirstName, string LastName, string emailTo, string auctionenddate, string userinvoice_id, string salesdate, string eventurl, List <Invoice> invoices, decimal amountpaid) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\UserInvoice.txt")); template.Encoding = System.Text.Encoding.UTF8; template.ToEmail = emailTo; template.Data.Add("{{firstName}}", FirstName); template.Data.Add("{{lastName}}", LastName); template.Data.Add("{{auctionenddate}}", auctionenddate); template.Data.Add("{{UserInvoice_ID}}", userinvoice_id); template.Data.Add("{{SaleDate}}", salesdate); template.Data.Add("{{EventURL}}", eventurl); bool line = true; decimal sumcost = 0; decimal sumshipping = 0; decimal sumtax = 0; decimal sumfees = 0; decimal tmp = 0; bool isnotshipment = false; tmp = amountpaid; StringBuilder info = new StringBuilder(); foreach (var item in invoices) { if (item.Shipping == 0) { isnotshipment = true; } info.AppendLine(((line) ? "<tr style=\"background-color:#EFEFEF\" class=\"bordered\">" : "<tr class=\"bordered\">")); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Auction.Lot.ToString() + "</td>"); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Auction.Title + "</td>"); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Cost.GetCurrency() + "</td>"); info.AppendLine("</tr>"); line = !line; sumcost += item.Cost; sumshipping += item.Shipping; sumtax += item.Tax; sumfees += item.LateFee; } info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Net Cost*: </td><td>" + sumcost.GetCurrency() + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Shipping, Handiling & Insurance: </td><td>" + ((sumshipping == 0 || isnotshipment) ? "not calculated yet" : sumshipping.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Sales Tax: </td><td>" + ((sumtax == 0) ? "$0.00" : sumtax.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Late Fees: </td><td>" + ((sumfees == 0) ? "$0.00" : sumfees.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Amount Paid: </td><td>" + ((tmp == 0) ? "$0.00" : tmp.GetCurrency()) + "</td></tr>"); tmp = sumcost + sumfees + sumshipping + sumtax - tmp; info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Amount Due: </td><td>" + ((tmp < 0 || (sumshipping == 0 || isnotshipment)) ? "not calculated yet" : tmp.GetCurrency(false)) + "</td></tr>"); template.Data.Add("{{info}}", info.ToString()); ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML()); }
public static void SendMessageFromConsignor(string emailTo, ConsignNowForm form) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\MessageFromConsignor.txt")); template.Encoding = Encoding.UTF8; template.ToEmail = emailTo; template.Data.Add("{{firstname}}", form.FirstName); template.Data.Add("{{lastname}}", form.LastName); template.Data.Add("{{email}}", form.Email); template.Data.Add("{{phone}}", form.Phone ?? string.Empty); if (!string.IsNullOrWhiteSpace(form.Description)) { template.Data.Add("{{descriptionTitle}}", "Item(s) description:"); template.Data.Add("{{description}}", form.Description); } else { template.Data.Add("{{descriptionTitle}}", string.Empty); template.Data.Add("{{description}}", string.Empty); } template.Data.Add("{{acquire}}", form.Acquire ?? string.Empty); template.Data.Add("{{finance}}", form.Finance ? "Yes" : "No"); template.Data.Add("{{subscribe}}", form.Subscribe ? "Yes" : "No"); if (form.FileLinks.Any()) { StringBuilder sb = new StringBuilder("Image(s):<br />"); form.FileLinks.ForEach(t => sb.AppendFormat("<a href=\"{0}\" target=\"_blank\"><img src=\"{0}\" style=\"max-width:220px;max-height:220px;\"></a>", t)); template.Data.Add("{{images}}", sb.ToString()); } else { template.Data.Add("{{images}}", string.Empty); } form.Attachments.ForEach(t => template.AttachItem.Add(new Attachment(t, MediaTypeNames.Image.Jpeg))); ParseCommonData(template); UniMail.Mailer.Send(template.RenderHTML()); }
//SendInvoicePaymentConfirmation public static void SendInvoicePaymentConfirmation(string email, string login, PaymentConfirmation pc) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\InvoicePaymentConfirmation.txt")); template.Encoding = System.Text.Encoding.UTF8; template.ToEmail = email; StringBuilder table = new StringBuilder(); if (pc.IsShipping) { table.AppendFormat("We will be shipping out your item{0} and sending you a shipping confirmation email within 8 business days.", pc.Quantity > 1 ? "s" : ""); } else { table.AppendFormat("Your item{0} will be held at will call and will be available Monday - Friday, 9AM - 4PM<br /><b>{1}</b><br /><b>{2}</b><br />", pc.Quantity > 1 ? "s" : "", Consts.CompanyTitleName, Consts.CompanyAddress); } template.Data.Add("{{text_title}}", table.ToString()); table = new StringBuilder(); if (!String.IsNullOrEmpty(pc.TransactionID)) { table.Append("<span style='color:Navy'><strong>Transaction information</strong></span><br />"); table.AppendFormat("{0} Transaction ID# <strong>{1}</strong>", (pc.PaymentType == Consts.PaymentType.Paypal ? "Express Checkout Payment" : "Paid by Credit Card"), pc.TransactionID); } else { table.Append("<span style='color:Navy'><strong>Paid from the Account Balance</strong></span>"); } template.Data.Add("{{Transaction}}", table.ToString()); #region Billing & Shipping table = new StringBuilder(); table.Append("<colgroup>"); table.AppendLine("<col width=\"355px\" /><col width=\"360px\" />"); table.Append("</colgroup>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='background-color:#002868;color:#FFFFFF;font-weight:bold;border:0px solid black;padding-left:10px;padding: 5px 0px 5px 10px;'>Billing information</td>"); table.AppendFormat("<td style='background-color:#002868;color:#FFFFFF;font-weight:bold;border:0px solid black;padding-left:10px;padding: 5px 0px 5px 10px;'>Shipping information</td>"); table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} (<b>{1}</b>)</td>", pc.Address_Billing.FullName, login.ToUpper()); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0} (<b>{1}</b>)</td>", pc.Address_Shipping.FullName, login.ToUpper()); } else { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding-left: 10px;padding-right:10px; background-color: White;vertical-align:top' rowspan='{0}'>", ((!String.IsNullOrEmpty(pc.Address_Billing.WorkPhone) || (pc.Address_Shipping != null && !String.IsNullOrEmpty(pc.Address_Shipping.WorkPhone)))) ? "8" : "7"); table.AppendFormat("Your item{0} will be held at will call and will be available Monday - Friday, 9AM - 4PM <br />", pc.Quantity > 1 ? "s" : ""); table.AppendFormat("<b>{0}</b><br />", Consts.CompanyTitleName); table.AppendFormat("<b>{0}</b></td>", Consts.CompanyAddress); } table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.Address_1); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0} </td>", pc.Address_Shipping.Address_1); } table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.Address_2); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color: White;'>{0} </td>", pc.Address_Shipping.Address_2); } table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0}, {1}</td>", pc.Address_Billing.City, pc.Address_Billing.State); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0}, {1}</td>", pc.Address_Shipping.City, pc.Address_Shipping.State); } table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.Zip); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0} </td>", pc.Address_Shipping.Zip); } table.AppendLine("</tr>"); table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.Country); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0}</td>", pc.Address_Shipping.Country); } table.AppendLine("</tr>"); if (!String.IsNullOrEmpty(pc.Address_Billing.WorkPhone) || (pc.Address_Shipping != null && !String.IsNullOrEmpty(pc.Address_Shipping.WorkPhone))) { table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top:solid 1px #DDD;border-left:solid 1px #DDD;border-right:solid 1px #DDD;padding: 5px 0px 5px 10px;;background-color:#FFF;'>{0} </td>", pc.Address_Billing.HomePhone); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD; padding: 5px 0px 5px 10px; background-color: White;'>{0} </td>", pc.Address_Shipping.HomePhone); } table.AppendLine("</tr>"); } else { table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD;border-left:solid 1px #DDD;border-bottom:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.HomePhone); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right: solid 1px #DDD;border-bottom: solid 1px #DDD;padding: 5px 0px 5px 10px; background-color: White;'>{0} </td>", pc.Address_Shipping.HomePhone); } table.AppendLine("</tr>"); } if (!String.IsNullOrEmpty(pc.Address_Billing.WorkPhone) || (pc.Address_Shipping != null && !String.IsNullOrEmpty(pc.Address_Shipping.WorkPhone))) { table.AppendLine("<tr>"); table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right:solid 1px #DDD;border-left:solid 1px #DDD;border-bottom:solid 1px #DDD;padding: 5px 0px 5px 10px;background-color:#FFF;'>{0} </td>", pc.Address_Billing.WorkPhone); if (pc.IsShipping) { table.AppendFormat("<td style='border-top: solid 1px #DDD;border-right: solid 1px #DDD;border-bottom: solid 1px #DDD;padding: 5px 0px 5px 10px; background-color: White;'>{0} </td>", pc.Address_Shipping.WorkPhone); } table.AppendLine("</tr>"); } template.Data.Add("{{billing_info}}", table.ToString()); #endregion #region Invoices table = new StringBuilder(); string tableBL = "border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;padding-left:10px;background-color:White;"; string tableBLR = "border-right:solid 1px #DDD;border-left:solid 1px #DDD;border-bottom:solid 1px #DDD;padding-left:10px;background-color:White;"; foreach (InvoiceDetail invoice in pc.Invoices) { table.AppendLine("<tr>"); table.AppendFormat("<td style='font-size:14px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#F2F2F2;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Lot); table.AppendFormat("<td style='font-size:14px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#F2F2F2;border: solid 1px #e2e2e2'>{0}</td>", invoice.DateCreated.ToShortDateString()); table.AppendFormat("<td style='font-size:14px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#F2F2F2;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Title); table.AppendFormat("<td style='font-size:14px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#F2F2F2;border: solid 1px #e2e2e2'>{0}</td>", invoice.Quantity); table.AppendFormat("<td style='font-size:14px;font-weight:bold;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#F2F2F2;border: solid 1px #e2e2e2'>{0}</td>", invoice.TotalCostWithoutCouponDiscount.GetCurrency()); table.AppendLine("</tr>"); table.AppendLine("<tr><td colspan='5' style='font-size:14px;background-color:#DEEBF7;padding:5px'><table style='margin: 0px; table-layout: fixed;' cellpadding='0' cellspacing='0'><colgroup><col width='245px' /><col width='365px' /><col width='120px' /></colgroup>"); table.AppendFormat("<tr><td> </td><td style='border-top:solid 1px #DDDDDD;border-left:solid 1px #DDDDDD;border-bottom:solid 1px #DDDDDD;padding-left:10px;background-color:White;'>Winning Bid {0}</td><td style='border:solid 1px #DDDDDD;padding-left:10px;background-color:White;'>{1}</td></tr>", (invoice.Quantity > 1) ? String.Format("<span style='display: table-row-group; float: right;'>{0} x {1} = </span>", invoice.Quantity, ((decimal)(invoice.Amount / invoice.Quantity)).GetCurrency()) : String.Empty, invoice.Amount.GetCurrency()); if (invoice.AuctionType != (long)Consts.AuctionType.DealOfTheWeek && (invoice.BuyerPremium > 0 || invoice.RealBP.HasValue)) { table.AppendFormat("<tr><td> </td><td style='{0}'>Buyer's premium</td><td style='{1}'>{2}</td></tr>", tableBL, tableBLR, invoice.RealBP.GetValueOrDefault(invoice.BuyerPremium).GetCurrency()); } if (invoice.Shipping > 0 || invoice.RealSh.HasValue) { table.AppendFormat("<tr><td> </td><td style='{0}'>Shipping and handling</td><td style='{1}'>{2}</td></tr>", tableBL, tableBLR, invoice.RealSh.GetValueOrDefault(invoice.Shipping).GetCurrency()); table.AppendFormat("<tr><td> </td><td style='{0}'>Insurance</td><td style='{1}'>{2}</td></tr>", tableBL, tableBLR, invoice.Insurance.GetCurrency()); } if (invoice.Tax > 0) { table.AppendFormat("<tr><td> </td><td style='{0}'>Tax</td><td style='{1}'>{2}</td></tr>", tableBL, tableBLR, invoice.Tax.GetCurrency()); } if (invoice.Discount > 0 && invoice.TotalOrderDiscount.GetValueOrDefault(0) != invoice.Discount) { table.AppendFormat("<tr><td> </td><td style='{0}'>Tax</td><td style='{1}'>{2}</td></tr>", tableBL, tableBLR, (invoice.Discount - invoice.TotalOrderDiscount.GetValueOrDefault(0)).GetCurrency()); } table.AppendLine("</table>"); table.AppendLine("</td>"); table.AppendLine("</tr>"); } template.Data.Add("{{invoices_info}}", table.ToString()); #endregion if (pc.HasDiscount) { table = new StringBuilder(); table.AppendFormat("<br /><tr><td style='background-color:#01347E;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;' colspan=4>{0} Paid: </td><td style='font-weight:bold;background-color:#01347E;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;'>{1}</td></tr>", "Subtotal", pc.TotalCostWithoutDiscount.GetCurrency()); table.AppendFormat("<br /><tr><td style='font-weight:bold;background-color:#400000;border:solid 1px #400000;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;text-align:right' colspan=4>{0}: </td><td style='font-weight:bold;background-color:#400000;border:solid 1px #400000;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;'>{1}</td></tr>", "Promo Discount", pc.DiscountAmount.GetCurrency()); template.Data.Add("{{discount_info}}", table.ToString()); } else { template.Data.Add("{{discount_info}}", String.Empty); } template.Data.Add("{{TotalDue}}", pc.TotalCost.GetCurrency()); if (pc.Deposit > 0) { table = new StringBuilder(); table.AppendFormat("<br /><tr><td style='font-weight:bold;background-color:#400000;border:solid 1px #400000;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;text-align:right' colspan=4>{0}: </td><td style='font-weight:bold;background-color:#400000;border:solid 1px #400000;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:14px;'>{1}</td></tr>", (pc.TotalCost - pc.Deposit > 0) ? "Deposit" : "Paid from Account Balance", (pc.TotalCost - pc.Deposit < 0) ? pc.TotalCost.GetCurrency() : pc.Deposit.GetCurrency()); if (pc.TotalCost - pc.Deposit > 0) { table.AppendFormat("<br /><tr><td style='font-weight:bold;background-color:#DEEBF7;border:solid 1px #e2e2e2;color:#333333;padding: 5px 0px 5px 10px;font-size:14px;text-align:right' colspan=4>{0} Paid: </td><td style='font-weight:bold;background-color:#DEEBF7;border:solid 1px #e2e2e2;color:#333333;padding: 5px 0px 5px 10px;font-size:14px;'>{1}</td></tr>", (pc.Deposit == 0) ? "Total" : "Balance", (pc.TotalCost - pc.Deposit < 0) ? "(" + (pc.Deposit - pc.TotalCost).GetCurrency() + ")" : (pc.TotalCost - pc.Deposit).GetCurrency()); } else if (pc.DepositLimit >= 0) { table.AppendFormat("<br /><tr><td style='font-weight:bold;background-color:#DEEBF7;border:solid 1px #e2e2e2;color:#333333;padding: 5px 0px 5px 10px;font-size:14px;text-align:right' colspan=4>{0} </td><td style='font-weight:bold;background-color:#DEEBF7;border:solid 1px #e2e2e2;color:#333333;padding: 5px 0px 5px 10px;font-size:14px;'>{1}</td></tr>", !pc.IsDepositRefunded ? "Account Balance:" : "Refunded Amount:", pc.DepositLimit.GetCurrency(false)); } template.Data.Add("{{deposits}}", table.ToString()); } else { template.Data.Add("{{deposits}}", String.Empty); } ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML()); }
public static void SendFutureEventsPerShopper(string email, string firstname, string lastname, string login, List <AuctionShort> auctions, bool ishtml) { try { if (ishtml) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\ReceivePersonalShopperUpdate.txt")); template.Encoding = System.Text.Encoding.UTF8; template.ToEmail = email; StringBuilder sb = new StringBuilder(); string str, image_path; str = image_path = String.Empty; bool line = true; LinkedResource lr; int imgNumber = 0; FileInfo fi; //fi = new FileInfo(HttpContext.Current.Server.MapPath(String.Format(@"~/public/images/logo_1.jpg"))); //if (fi.Exists) //{ // lr = new LinkedResource(fi.FullName); // lr.ContentId = "logo"; // lr.TransferEncoding = TransferEncoding.Base64; // template.LinkedResourceCollection.Add(lr); //} //fi = new FileInfo(HttpContext.Current.Server.MapPath(String.Format(@"~/public/images/logo_text_tr.gif"))); //if (fi.Exists) //{ // lr = new LinkedResource(fi.FullName); // lr.ContentId = "logo_text"; // lr.TransferEncoding = TransferEncoding.Base64; // template.LinkedResourceCollection.Add(lr); //} foreach (AuctionShort a in auctions) { image_path = a.ThumbnailPath; str = String.Empty; if (!String.IsNullOrEmpty(image_path)) { fi = new FileInfo(HttpContext.Current.Server.MapPath(AppHelper.AuctionImage(a.LinkParams.ID, image_path))); if (fi.Exists) { lr = new LinkedResource(fi.FullName); lr.ContentId = "img" + (++imgNumber).ToString(); lr.TransferEncoding = TransferEncoding.Base64; template.LinkedResourceCollection.Add(lr); str = "<img src=\"cid:img" + imgNumber.ToString() + "\">"; } else { str = " "; } } sb.AppendFormat("<tr {0}><td colspan=\"2\"><hr /></td></tr>", (line) ? "style='background-color:#d9e9f0'" : String.Empty); sb.AppendFormat("<tr {0}><td align=\"left\" rowspan=\"3\" style='padding:5px'>{3}</td><td style='text-align:left;'><a href=\"{4}\"><b>{1}</b></a></td></tr><tr {0}><td>{2}</td></tr><tr {0}><td><i>{5}</i></td></tr>", (line) ? "style='background-color:#d9e9f0'" : String.Empty, a.LinkParams.Title, /*a.DescriptionWithoutTagsShort*/ String.Empty, str, AppHelper.GetSiteUrl(String.Format("/Auction/AuctionDetail/{0}/{1}/{2}/{3}", a.LinkParams.ID, a.LinkParams.EventUrl, a.LinkParams.CategoryUrl, a.LinkParams.LotTitleUrl)), String.Format("({0} ET to {1} ET)", a.StartDate, a.EndDate)); line = !line; } template.Data.Add("{{info}}", sb.ToString()); template.Data.Add("{{firstname}}", firstname); template.Data.Add("{{lastname}}", lastname); template.Data.Add("{{login}}", login); ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML()); } else { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\ReceivePersonalShopperUpdateText.txt")); template.Encoding = System.Text.Encoding.UTF8; template.ToEmail = email; StringBuilder sb = new StringBuilder(); foreach (AuctionShort a in auctions) { sb.AppendLine("Lot/Title: " + a.LinkParams.Lot + " - " + a.LinkParams.Title); sb.AppendLine("" + String.Format("({0} ET to {1} ET)", a.StartDate, a.EndDate)); sb.AppendLine(AppHelper.GetSiteUrl(String.Format("/Auction/AuctionDetail/{0}/{1}/{2}/{3}", a.LinkParams.ID, a.LinkParams.EventUrl, a.LinkParams.CategoryUrl, a.LinkParams.LotTitleUrl))); sb.AppendLine(); } template.Data.Add("{{info}}", sb.ToString()); template.Data.Add("{{firstname}}", firstname); template.Data.Add("{{lastname}}", lastname); template.Data.Add("{{login}}", login); ParseCommonData(template); UniMail.Mailer.Enqueue(template.Render()); } } catch (Exception ex) { Vauction.Utils.Lib.Logger.LogInfo("SendFutureEventsPerShopper error: " + ex.Message); } }
//SendEndOfAuctionHTMLLetter public static void SendEndOfAuctionHTMLLetter(string email, EndOfAuction eoa) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\EndOfAuctionNoticeHTML.txt"), "mail"); string emailTitle = (eoa.Invoices.Count() > 0 ? "Winning Auction Notification for " : "End of Auction Notice for ") + eoa.EventTitle; template.Subject = emailTitle; template.Encoding = Encoding.UTF8; template.ToEmail = email; template.Data.Add("{{email_subject}}", emailTitle); template.Data.Add("{{email_title}}", eoa.Invoices.Count() > 0 ? "Congratulations!" : emailTitle); if (eoa.Invoices.Count() > 0) { template.Data.Add("{{email_title_2}}", eoa.UserName + ",<br />" + String.Format("Please send your payment to:<br />Lelands Collectibles, Inc.<br /> 130 Knickerbocker Avenue<br /> Suite E <br />Bohemia, NY 11716 <br /><br />International winners please contact [email protected] before sending payment to receive your international shipping cost. <br /><br />You can also preview your invoice online in your account or follow <a style='font-weight:bold;color:#6C0202' href='{2}/Account/InvoiceDetailed/{0}/{1}'>this link</a>.", eoa.Invoices.First().UserInvoice_ID, eoa.Invoices.First().LinkParams.EventUrl, "{{siteUrl}}") + "<br /><br />You are the winning bidder for the following auction item(s)."); } else { template.Data.Add("{{email_title_2}}", "This email is sent as a courtesy to let you know that this auction has ended."); } StringBuilder table; if (eoa.Invoices.Count() > 0) { #region Invoices table = new StringBuilder(); table.AppendLine("<span style='color:#490202'><strong>Winning Item Invoice</strong></span>"); table.AppendLine("<table style='table-layout:fixed;font-size:12px;' cellpadding='0' cellspacing='0' >"); table.AppendLine("<colgroup><col width='80px' /><col width='510px' /><col width='140px' /></colgroup>"); table.AppendLine("<tr>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Lot#</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Title</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Cost</td>"); table.AppendLine("</tr>"); foreach (InvoiceDetail invoice in eoa.Invoices) { table.AppendLine("<tr>"); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Lot); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Title); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.Cost.GetCurrency()); table.AppendLine("</tr>"); } table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Net Cost*", eoa.TotalCst.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Shipping, Handiling & Insurance", eoa.TotalShippingString); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Sales Tax", eoa.TotalTax.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Late Fees", eoa.TotalLateFee.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Total Due", eoa.TotalCostString); table.AppendLine("</table>* Auction items include premium"); template.Data.Add("{{invoices_info}}", table.ToString()); #endregion } else { template.Data.Add("{{invoices_info}}", String.Empty); } template.Data.Add("{{separator}}", (eoa.Invoices.Count() > 0 && eoa.LoserLots.Count() > 0) ? "<br /><hr /><br />" : String.Empty); if (eoa.LoserLots.Count() > 0) { table = new StringBuilder(); table.AppendLine("<p>Unfortunately, you were not a successful bidder for lot(s)</p>"); table.AppendLine("<table style='table-layout:fixed;font-size:14px' cellpadding='0' cellspacing='0' >"); table.AppendLine("<colgroup><col width='80px' /><col width='290px' /><col width='100px' /><col width='100px' /><col width='100px' /><col width='60px' /></colgroup>"); table.AppendLine("<tr>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Lot#</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Title</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Winning Bid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Your Bid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Your MaxBid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Bids</td>"); table.AppendLine("</tr>"); foreach (UserBidWatch ubw in eoa.LoserLots) { table.AppendLine("<tr>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.LinkParams.Lot + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.LinkParams.Title + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.CurrentBid.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.Amount.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.MaxBid.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.Bids + "</td>"); table.AppendLine("</tr>"); } table.AppendLine("</table><br />"); template.Data.Add("{{loserlots}}", table.ToString()); } else { template.Data.Add("{{loserlots}}", String.Empty); } ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML(), "mail"); }
//SendEndOfAuctionHTMLLetter public static void SendEndOfAuctionHTMLLetter(string email, EndOfAuction eoa) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\EndOfAuctionNoticeHTML.txt"), "mail"); string emailTitle = (eoa.Invoices.Count() > 0 ? "Winning Auction Notification for " : "End of Auction Notice for ") + eoa.EventTitle; template.Subject = emailTitle; template.Encoding = Encoding.UTF8; template.ToEmail = email; template.Data.Add("{{email_subject}}", emailTitle); template.Data.Add("{{email_title}}", eoa.Invoices.Count() > 0 ? "Congratulations!" : emailTitle); if (eoa.Invoices.Count() > 0) template.Data.Add("{{email_title_2}}", eoa.UserName + ",<br />" + String.Format("Please send your payment to:<br />Lelands Collectibles, Inc.<br /> 130 Knickerbocker Avenue<br /> Suite E <br />Bohemia, NY 11716 <br /><br />International winners please contact [email protected] before sending payment to receive your international shipping cost. <br /><br />You can also preview your invoice online in your account or follow <a style='font-weight:bold;color:#6C0202' href='{2}/Account/InvoiceDetailed/{0}/{1}'>this link</a>.", eoa.Invoices.First().UserInvoice_ID, eoa.Invoices.First().LinkParams.EventUrl, "{{siteUrl}}") + "<br /><br />You are the winning bidder for the following auction item(s)."); else template.Data.Add("{{email_title_2}}", "This email is sent as a courtesy to let you know that this auction has ended."); StringBuilder table; if (eoa.Invoices.Count() > 0) { #region Invoices table = new StringBuilder(); table.AppendLine("<span style='color:#490202'><strong>Winning Item Invoice</strong></span>"); table.AppendLine("<table style='table-layout:fixed;font-size:12px;' cellpadding='0' cellspacing='0' >"); table.AppendLine("<colgroup><col width='80px' /><col width='510px' /><col width='140px' /></colgroup>"); table.AppendLine("<tr>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Lot#</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Title</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Cost</td>"); table.AppendLine("</tr>"); foreach (InvoiceDetail invoice in eoa.Invoices) { table.AppendLine("<tr>"); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Lot); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.LinkParams.Title); table.AppendFormat("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{0}</td>", invoice.Cost.GetCurrency()); table.AppendLine("</tr>"); } table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Net Cost*", eoa.TotalCst.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Shipping, Handiling & Insurance", eoa.TotalShippingString); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Sales Tax", eoa.TotalTax.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Late Fees", eoa.TotalLateFee.GetCurrency(false)); table.AppendFormat("<tr><td style='font-weight:bold;color:#490202;padding: 5px 5px 5px 10px; text-align:right;font-size:12px;' colspan='2'>{0}: </td><td style='font-weight:bold;color:#222;padding: 5px 0px 5px 10px;font-size:12px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>{1}</td></tr>", "Total Due", eoa.TotalCostString); table.AppendLine("</table>* Auction items include premium"); template.Data.Add("{{invoices_info}}", table.ToString()); #endregion } else template.Data.Add("{{invoices_info}}", String.Empty); template.Data.Add("{{separator}}", (eoa.Invoices.Count() > 0 && eoa.LoserLots.Count() > 0) ? "<br /><hr /><br />" : String.Empty); if (eoa.LoserLots.Count() > 0) { table = new StringBuilder(); table.AppendLine("<p>Unfortunately, you were not a successful bidder for lot(s)</p>"); table.AppendLine("<table style='table-layout:fixed;font-size:14px' cellpadding='0' cellspacing='0' >"); table.AppendLine("<colgroup><col width='80px' /><col width='290px' /><col width='100px' /><col width='100px' /><col width='100px' /><col width='60px' /></colgroup>"); table.AppendLine("<tr>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Lot#</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Title</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Winning Bid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Your Bid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Your MaxBid</td>"); table.AppendLine("<td style='font-weight:bold;background-color:#6C0202;color:#FFFFFF;padding: 5px 0px 5px 10px;font-size:12px;'>Bids</td>"); table.AppendLine("</tr>"); foreach (UserBidWatch ubw in eoa.LoserLots) { table.AppendLine("<tr>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.LinkParams.Lot + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.LinkParams.Title + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.CurrentBid.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.Amount.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.MaxBid.GetCurrency() + "</td>"); table.AppendLine("<td style='font-size:12px;font-weight:bold;padding: 5px 0px 5px 10px;background-color:#f4f4f4;border: solid 1px #e2e2e2'>" + ubw.Bids + "</td>"); table.AppendLine("</tr>"); } table.AppendLine("</table><br />"); template.Data.Add("{{loserlots}}", table.ToString()); } else template.Data.Add("{{loserlots}}", String.Empty); ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML(), "mail"); }
public static void Temp_SendInvoiceInformationLetter2(string FirstName, string LastName, string emailTo, string auctionenddate, string userinvoice_id, string salesdate, string eventurl, List<Invoice> invoices, decimal amountpaid) { UniMail.Template template = new UniMail.Template(HttpContext.Current.Server.MapPath(@"~\Templates\Mail\UserInvoice.txt")); template.Encoding = System.Text.Encoding.UTF8; template.ToEmail = emailTo; template.Data.Add("{{firstName}}", FirstName); template.Data.Add("{{lastName}}", LastName); template.Data.Add("{{auctionenddate}}", auctionenddate); template.Data.Add("{{UserInvoice_ID}}", userinvoice_id); template.Data.Add("{{SaleDate}}", salesdate); template.Data.Add("{{EventURL}}", eventurl); bool line = true; decimal sumcost = 0; decimal sumshipping = 0; decimal sumtax = 0; decimal sumfees = 0; decimal tmp = 0; bool isnotshipment = false; tmp = amountpaid; StringBuilder info = new StringBuilder(); foreach (var item in invoices) { if (item.Shipping == 0) isnotshipment = true; info.AppendLine(((line) ? "<tr style=\"background-color:#EFEFEF\" class=\"bordered\">" : "<tr class=\"bordered\">")); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Auction.Lot.ToString() + "</td>"); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Auction.Title + "</td>"); info.AppendLine("<td style='padding-left: 5px; border:1px solid #444'>" + item.Cost.GetCurrency() + "</td>"); info.AppendLine("</tr>"); line = !line; sumcost += item.Cost; sumshipping += item.Shipping; sumtax += item.Tax; sumfees += item.LateFee; } info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Net Cost*: </td><td>"+sumcost.GetCurrency()+"</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Shipping, Handiling & Insurance: </td><td>" + ((sumshipping == 0 || isnotshipment) ? "not calculated yet" : sumshipping.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Sales Tax: </td><td>" + ((sumtax == 0) ? "$0.00" : sumtax.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Late Fees: </td><td>" + ((sumfees == 0) ? "$0.00" : sumfees.GetCurrency()) + "</td></tr>"); info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Amount Paid: </td><td>" + ((tmp == 0) ? "$0.00" : tmp.GetCurrency()) + "</td></tr>"); tmp = sumcost + sumfees + sumshipping + sumtax - tmp; info.AppendLine("<tr><td colspan=\"2\" style=\"text-align:right; font-weight:bold\">Amount Due: </td><td>" + ((tmp < 0 || (sumshipping == 0 || isnotshipment)) ? "not calculated yet" : tmp.GetCurrency(false)) + "</td></tr>"); template.Data.Add("{{info}}", info.ToString()); ParseCommonData(template); UniMail.Mailer.Enqueue(template.RenderHTML()); }