protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.RawUrl.StartsWith("/dollarsaver/index")) { //Response.Redirect("~/Default.aspx?station_id=" + StationId); DollarSaverRedirect("~/Default.aspx"); } DateTime currentDate = DateTime.Now; currentDate = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day); StationTableAdapter stationAdapter = new StationTableAdapter(); DollarSaverDB.StationRow station = stationAdapter.GetStation(StationId)[0]; siteType = (SiteType)station.SiteTypeId; CertificateTableAdapter certificateAdapter = new CertificateTableAdapter(); //stationNameLabel.Text = station.Name; if (!station.IsContent1Null()) { content1Label.Text = station.Content1; } if (!station.IsContent2Null()) { content2Label.Text = station.Content2; } String ImageDir = Request.PhysicalApplicationPath + station.ImageDirUrl; if (station.StationSiteType == SiteType.Standard) { standardHolder.Visible = true; dealHolder.Visible = false; signUpTopLink.NavigateUrl = GetUrl(signUpTopLink.NavigateUrl); SpecialSettingsTableAdapter specialSettingsAdapter = new SpecialSettingsTableAdapter(); DollarSaverDB.SpecialSettingsDataTable specialSettingsTable = specialSettingsAdapter.GetSpecialSettings(StationId); bool dailyHeader = false; if (specialSettingsTable.Count == 1) { dailyHeader = specialSettingsTable[0].DailyHeader; } Image dailyWeeklyImage = new Image(); if (dailyHeader) { //dailyWeeklyImage.SkinID = "dailyImage"; if (!station.Content.IsDailyDealImageNull() && File.Exists(ImageDir + station.Content.DailyDealImage)) { dailyWeeklyImage.ImageUrl = station.ImageDirUrl + station.Content.DailyDealImage; } else { dailyWeeklyImage.ImageUrl = "~/images/boxtop_daily.gif"; } } else { //dailyWeeklyImage.SkinID = "weeklyImage"; if (!station.Content.IsWeeklyDealImageNull() && File.Exists(ImageDir + station.Content.WeeklyDealImage)) { dailyWeeklyImage.ImageUrl = station.ImageDirUrl + station.Content.WeeklyDealImage; } else { dailyWeeklyImage.ImageUrl = "~/images/boxtop_weekly.gif"; } } dailyWeeklyImageHolder.Controls.Add(dailyWeeklyImage); DollarSaverDB.CertificateDataTable daily = certificateAdapter.GetSpecial(StationId, 1); if (daily.Count == 1) { SpecialCert1.DisplayCertificate = daily[0]; if (HitCounterEnabled) { LogHit(currentDate, daily[0].CertificateId, PageHitType.HomePage); } } DollarSaverDB.CertificateDataTable cert2 = certificateAdapter.GetSpecial(StationId, 2); if (cert2.Count == 1) { SpecialCert2.DisplayCertificate = cert2[0]; if (HitCounterEnabled) { LogHit(currentDate, cert2[0].CertificateId, PageHitType.HomePage); } } DollarSaverDB.CertificateDataTable cert3 = certificateAdapter.GetSpecial(StationId, 3); if (cert3.Count == 1) { SpecialCert3.DisplayCertificate = cert3[0]; if (HitCounterEnabled) { LogHit(currentDate, cert3[0].CertificateId, PageHitType.HomePage); } } DollarSaverDB.CertificateDataTable cert4 = certificateAdapter.GetSpecial(StationId, 4); if (cert4.Count == 1) { SpecialCert4.DisplayCertificate = cert4[0]; if (HitCounterEnabled) { LogHit(currentDate, cert4[0].CertificateId, PageHitType.HomePage); } } if (!station.Content.IsOtherDealsImageNull() && File.Exists(ImageDir + station.Content.OtherDealsImage)) { otherDealsImage.ImageUrl = station.ImageDirUrl + station.Content.OtherDealsImage; } if (!station.Content.IsLogoImageNull() && File.Exists(ImageDir + station.Content.LogoImage)) { logoImage.ImageUrl = station.ImageDirUrl + station.Content.LogoImage; } } else // Deal of the Week { standardHolder.Visible = false; dealHolder.Visible = true; if (!Station.IsSiteNameNull() && Station.SiteName != String.Empty) { dotwStationNameLabel.Text = Regex.Replace(Station.SiteName, "<[^>]+>", ""); } else { dotwStationNameLabel.Text = "DollarSaver Deal of the Week"; } if (!Station.Content.IsDotwSubheaderImageNull() && File.Exists(ImageDir + station.Content.DotwSubheaderImage)) { subheaderCell.Style["background-image"] = "url(" + station.ImageDirUrl + station.Content.DotwSubheaderImage + ")"; } else { subheaderCell.Style["background-image"] = "url(" + ResolveUrl("~/images/dotw_background.gif") + ")"; } DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCurrentDeal(StationId); if (certificateTable.Count == 1) { dealOfTheWeek.Deal = certificateTable[0]; if (HitCounterEnabled) { LogHit(currentDate, certificateTable[0].CertificateId, PageHitType.HomePage); } } } } }
void placeOrderButton_Click(object sender, EventArgs e) { // Validate fields /* * string patternLenient = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; * * string patternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+" + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + @"[a-zA-Z]{2,}))$"; + */ String creditCardType = creditCardList.SelectedValue; String creditCardNumber = creditCardNumberBox.Text.Trim(); creditCardNumber = Regex.Replace(creditCardNumber, @"\D", ""); String verificationNumber = verificationNumberBox.Text.Trim(); String firstName = firstNameBox.Text.Trim(); String lastName = lastNameBox.Text.Trim(); String address1 = address1Box.Text.Trim(); String address2 = address2Box.Text.Trim(); String city = cityBox.Text.Trim(); String stateCode = stateList.SelectedValue; String zipCode = zipCodeBox.Text.Trim(); String phoneNumber = phoneNumberBox.Text.Trim(); if (firstName == String.Empty) { ErrorMessage = "First Name is required"; return; } if (lastName == String.Empty) { ErrorMessage = "Last Name is required"; return; } if (address1 == String.Empty) { ErrorMessage = "Address is required"; return; } if (city == String.Empty) { ErrorMessage = "City is required"; return; } if (stateCode == String.Empty) { ErrorMessage = "State is required"; return; } if (zipCode == String.Empty) { ErrorMessage = "Zip Code is required"; return; } if (phoneNumber == String.Empty) { ErrorMessage = "Phone Number is required"; return; } if (phoneNumber.Length < 10) { ErrorMessage = "Phone Number must include area code plus 7 digit phone number"; return; } if (DsCookie["_c"] == "1") { DsCookie["_c_ba"] = Cipher.Encrypt2(firstName); DsCookie["_c_bb"] = Cipher.Encrypt2(lastName); DsCookie["_c_bc"] = Cipher.Encrypt2(address1); DsCookie["_c_bd"] = Cipher.Encrypt2(address2); DsCookie["_c_be"] = Cipher.Encrypt2(city); DsCookie["_c_bf"] = Cipher.Encrypt2(stateCode); DsCookie["_c_bg"] = Cipher.Encrypt2(zipCode); DsCookie["_c_bh"] = Cipher.Encrypt2(phoneNumber); } if (creditCardNumber == String.Empty) { ErrorMessage = "Credit Card Number is required"; return; } if (verificationNumber == String.Empty) { ErrorMessage = "Card Verification Number is required"; return; } OrderTableAdapter orderAdapter = new OrderTableAdapter(); CertificateNumberTableAdapter numberAdapter = new CertificateNumberTableAdapter(); OrderLineItemTableAdapter orderLineItemAdapter = new OrderLineItemTableAdapter(); decimal subtotal = 0.0m; foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems) { int numberAssigned = Convert.ToInt32(numberAdapter.Assign(lineItem.OrderLineItemId)); if (numberAssigned != lineItem.Quantity) { if (numberAssigned == 0) { ErrorMessage = "We're sorry, " + lineItem.Certificate.AdvertiserName + " is no longer available"; orderLineItemAdapter.Delete(lineItem.OrderLineItemId); } else { lineItem.Quantity = numberAssigned; orderLineItemAdapter.Update(lineItem); ErrorMessage = "We're sorry, " + lineItem.Certificate.AdvertiserName + " is no longer available in the quantity you requested. Please review your updated order and click on the checkout button if you would like to purchase the new quantity"; } Order.LineItemModifiedDate = DateTime.Now; orderAdapter.Update(Order); ResetOrder(); Response.Redirect("~/Cart.aspx"); } subtotal += lineItem.Total; } switch (creditCardType) { case "Visa": Order.PaymentMethodId = (int)PaymentMethod.Visa; break; case "MasterCard": Order.PaymentMethodId = (int)PaymentMethod.MasterCard; break; case "Discover": Order.PaymentMethodId = (int)PaymentMethod.Discover; break; case "Amex": Order.PaymentMethodId = (int)PaymentMethod.Amex; break; default: break; } Order.SubTotal = subtotal; Order.GrandTotal = subtotal; Order.BillingFirstName = firstName; Order.BillingLastName = lastName; Order.BillingAddress1 = address1; if (address2 != String.Empty) { Order.BillingAddress2 = address2; } else { Order.SetBillingAddress2Null(); } Order.BillingCity = city; Order.BillingStateCode = stateCode; Order.BillingZipCode = zipCode; Order.BillingPhone = phoneNumber; orderAdapter.Update(Order); // Check max purchase qty for Deal of the Week if (Station.StationSiteType == SiteType.DealOfTheWeek) { CertificateTableAdapter certificateAdapter = new CertificateTableAdapter(); DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCurrentDeal(StationId); if (certificateTable.Count == 1) { DollarSaverDB.CertificateRow deal = certificateTable[0]; if (deal.MaxPurchaseQty > 0) { foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems) { if (lineItem.CertificateId == deal.CertificateId) { int pastQty = Convert.ToInt32(orderLineItemAdapter.GetQtyByConsumer(firstName, lastName, null, address1, city, stateCode, Order.ShippingEmail, deal.CertificateId)); if (pastQty + lineItem.Quantity > deal.MaxPurchaseQty) { ErrorMessage = "Sorry, the maximum purchase quantity per person for the Deal of the Week is " + deal.MaxPurchaseQty + "."; if (pastQty >= deal.MaxPurchaseQty) { ErrorMessage += "<BR>You have already purchased the maximum allowed."; } else { int allowedAmount = deal.MaxPurchaseQty - pastQty; ErrorMessage += "<BR>You may only purchase " + allowedAmount + " more."; } ResetOrder(); Response.Redirect("~/Cart.aspx"); } } } } } } if (Order.CheckoutStartDate < Order.LineItemModifiedDate) { ResetOrder(); ErrorMessage = "Your cart has been updated while checking out, please verify you items and continue the checkout process."; Response.Redirect("~/Cart.aspx"); } Order.OrderStatusId = (int)OrderStatus.Processing; orderAdapter.Update(Order); // charge order... NVPCallerServices caller = PayPalAPI.PayPalAPIInitialize(IsDev); NVPCodec encoder = new NVPCodec(); encoder["VERSION"] = "50.0"; encoder["METHOD"] = "DoDirectPayment"; encoder["PAYMENTACTION"] = "Sale"; encoder["AMT"] = subtotal.ToString("0.00"); encoder["CREDITCARDTYPE"] = creditCardType; encoder["ACCT"] = creditCardNumber; encoder["EXPDATE"] = expirationMonthList.SelectedValue + expirationYearList.SelectedValue; encoder["CVV2"] = verificationNumber; encoder["FIRSTNAME"] = firstName; encoder["LASTNAME"] = lastName; encoder["STREET"] = address1; encoder["CITY"] = city; encoder["STATE"] = stateCode; encoder["ZIP"] = zipCode; encoder["COUNTRYCODE"] = "US"; encoder["CURRENCYCODE"] = "USD"; /* * encoder["INVNUM"] = Order.OrderId.ToString(); * encoder["ITEMAMT"] = Order.LineItems.SubTotal.ToString("0.00"); * foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems.Rows) { * int itemNumber = lineItem.SeqNo - 1; * * encoder["L_NAME" + itemNumber] = lineItem.ShortName; * encoder["L_NUMBER" + itemNumber] = lineItem.CertificateId.ToString(); * encoder["L_QTY" + itemNumber] = lineItem.Quantity.ToString(); * encoder["L_AMT" + itemNumber] = lineItem.DiscountValue.ToString("0.00"); * } */ string paypalRequest = encoder.Encode(); string paypalResponse = String.Empty; try { paypalResponse = caller.Call(paypalRequest); } catch { ResetOrder(); ErrorMessage = "An error occurred while processing your order, please try submitting it again."; return; } NVPCodec decoder = new NVPCodec(); decoder.Decode(paypalResponse); string strAck = decoder["ACK"]; if (strAck != null && (strAck == "Success" || strAck == "SuccessWithWarning")) { string transactionId = decoder["TRANSACTIONID"]; Order.TransactionId = transactionId; Order.OrderDate = DateTime.Now; Order.OrderStatusId = (int)OrderStatus.Complete; orderAdapter.Update(Order); InfoMessage = "Successfully processed order"; if (SendReceipt()) { InfoMessage += "<BR />Receipt sent to " + Order.ShippingEmail; } if (Order.AddToMailingList) { CustomerContactTableAdapter customerContactAdapter = new CustomerContactTableAdapter(); customerContactAdapter.Insert(StationId, DateTime.Now, Order.ShippingEmail, Order.BillingFirstName, Order.BillingLastName); } Response.Redirect("~/Confirmation.aspx", true); return; } else { ResetOrder(); ErrorMessage = "Error! " + decoder["L_LONGMESSAGE0"] + " (" + decoder["L_ERRORCODE0"] + ")"; return; } }
protected void Page_Load(object sender, EventArgs e) { if (Order == null || Order.StationId != StationId || Order.OrderStatusId != (int)OrderStatus.New) { OrderId = 0; Response.Redirect("~/Cart.aspx"); } com.paypal.sdk.services.NVPCallerServices caller = PayPalAPI.PayPalAPIInitialize(IsDev); NVPCodec encoder = new NVPCodec(); encoder["METHOD"] = "GetExpressCheckoutDetails"; encoder["TOKEN"] = Session["TOKEN"].ToString(); string paypalRequest = encoder.Encode(); string paypalResponse = caller.Call(paypalRequest); NVPCodec decoder = new NVPCodec(); decoder.Decode(paypalResponse); String billingEmailAddress = String.Empty; String firstName = String.Empty; String lastName = String.Empty; String phoneNumber = String.Empty; /* * String address1 = String.Empty; * String address2 = String.Empty; * String city = String.Empty; * String stateCode = String.Empty; * String zipCode = String.Empty; */ string strAck = decoder["ACK"]; if (strAck != null && (strAck == "Success" || strAck == "SuccessWithWarning")) { Session["PAYERID"] = decoder["PAYERID"]; billingEmailAddress = decoder["EMAIL"]; firstName = decoder["FIRSTNAME"]; lastName = decoder["LASTNAME"]; phoneNumber = decoder["PHONENUM"]; } else { /* * string pStrError = * "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" + * "Desc=" + decoder["L_SHORTMESSAGE0"] + "&" + * "Desc2=" + decoder["L_LONGMESSAGE0"]; * * Response.Redirect("APIError.aspx?" + pStrError); * */ ErrorMessage = decoder["L_LONGMESSAGE0"]; //Response.Redirect("~/Cart.aspx"); ResetAndRedirect(); } OrderLineItemTableAdapter orderLineItemAdapter = new OrderLineItemTableAdapter(); OrderTableAdapter orderAdapter = new OrderTableAdapter(); CertificateNumberTableAdapter numberAdapter = new CertificateNumberTableAdapter(); decimal subtotal = 0.0m; foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems) { int numberAssigned = Convert.ToInt32(numberAdapter.Assign(lineItem.OrderLineItemId)); if (numberAssigned != lineItem.Quantity) { if (numberAssigned == 0) { ErrorMessage = "We're sorry, " + lineItem.Certificate.AdvertiserName + " is no longer available"; orderLineItemAdapter.Delete(lineItem.OrderLineItemId); } else { lineItem.Quantity = numberAssigned; orderLineItemAdapter.Update(lineItem); ErrorMessage = "We're sorry, " + lineItem.Certificate.AdvertiserName + " is no longer available in the quantity you requested. Please review your updated order and click on the chechout button if you would like to purchase the new quantity"; } ResetAndRedirect(); } subtotal += lineItem.Total; } // Check max purchase qty for Deal of the Week if (Station.StationSiteType == SiteType.DealOfTheWeek) { CertificateTableAdapter certificateAdapter = new CertificateTableAdapter(); DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCurrentDeal(StationId); if (certificateTable.Count == 1) { DollarSaverDB.CertificateRow deal = certificateTable[0]; if (deal.MaxPurchaseQty > 0) { foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems) { if (lineItem.CertificateId == deal.CertificateId) { int pastQty = Convert.ToInt32(orderLineItemAdapter.GetQtyByConsumer(firstName, lastName, billingEmailAddress, null, null, null, Order.ShippingEmail, deal.CertificateId)); if (pastQty + lineItem.Quantity > deal.MaxPurchaseQty) { ErrorMessage = "Sorry, the maximum purchase quantity per person for the Deal of the Week is " + deal.MaxPurchaseQty + "."; if (pastQty >= deal.MaxPurchaseQty) { ErrorMessage += "<BR>You have already purchased the maximum allowed."; } else { int allowedAmount = deal.MaxPurchaseQty - pastQty; ErrorMessage += "<BR>You may only purchase " + allowedAmount + " more."; } ResetAndRedirect(); } } } } } } //charge order here Order.SubTotal = subtotal; Order.GrandTotal = subtotal; Order.BillingFirstName = firstName; Order.BillingLastName = lastName; Order.BillingEmail = billingEmailAddress; /* * Order.BillingAddress1 = address1; * if (address2 != String.Empty) { * Order.BillingAddress2 = address2; * } else { * Order.SetBillingAddress2Null(); * } * Order.BillingCity = city; * Order.BillingStateCode = stateCode; * Order.BillingZipCode = zipCode; */ Order.BillingPhone = phoneNumber; Order.PaymentMethodId = (int)PaymentMethod.PayPal; orderAdapter.Update(Order); if (Order.CheckoutStartDate < Order.LineItemModifiedDate) { ErrorMessage = "Your cart has been updated while checking out, please verify your items and continue the checkout process."; ResetAndRedirect(); } Order.OrderStatusId = (int)OrderStatus.Processing; orderAdapter.Update(Order); encoder["METHOD"] = "DoExpressCheckoutPayment"; encoder["TOKEN"] = Session["TOKEN"].ToString(); encoder["PAYERID"] = Session["PAYERID"].ToString(); encoder["AMT"] = subtotal.ToString("0.00"); encoder["PAYMENTACTION"] = "Sale"; encoder["CURRENCYCODE"] = "USD"; encoder["INVNUM"] = Order.OrderId.ToString(); encoder["ITEMAMT"] = Order.LineItems.SubTotal.ToString("0.00"); foreach (DollarSaverDB.OrderLineItemRow lineItem in Order.LineItems.Rows) { int itemNumber = lineItem.SeqNo - 1; encoder["L_NAME" + itemNumber] = lineItem.ShortName; encoder["L_NUMBER" + itemNumber] = lineItem.CertificateId.ToString(); encoder["L_QTY" + itemNumber] = lineItem.Quantity.ToString(); encoder["L_AMT" + itemNumber] = lineItem.DiscountValue.ToString("0.00"); } paypalRequest = encoder.Encode(); paypalResponse = String.Empty; try { paypalResponse = caller.Call(paypalRequest); } catch { ErrorMessage = "An error occurred while processing your order, please try submitting it again."; ResetAndRedirect(); } decoder.Decode(paypalResponse); strAck = decoder["ACK"]; if (strAck != null && (strAck == "Success" || strAck == "SuccessWithWarning")) { /* * string pStrResQue = "TRANSACTIONID=" + decoder["TRANSACTIONID"] + "&" + * "CURRENCYCODE=" + decoder["CURRENCYCODE"] + "&" + * "AMT=" + decoder["AMT"]; * * Response.Redirect("DoExpressCheckoutPayment.aspx?" + pStrResQue); * */ string transactionId = decoder["TRANSACTIONID"]; Order.TransactionId = transactionId; Order.OrderDate = DateTime.Now; Order.OrderStatusId = (int)OrderStatus.Complete; orderAdapter.Update(Order); InfoMessage = "Successfully processed order"; if (SendReceipt()) { InfoMessage += "<BR />Receipt sent to " + Order.ShippingEmail; } if (Order.AddToMailingList) { CustomerContactTableAdapter customerContactAdapter = new CustomerContactTableAdapter(); customerContactAdapter.Insert(StationId, DateTime.Now, Order.ShippingEmail, Order.BillingFirstName, Order.BillingLastName); } Response.Redirect("~/Confirmation.aspx"); } else { /* * string pStrError = * "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" + * "Desc=" + decoder["L_SHORTMESSAGE0"] + "&" + * "Desc2=" + decoder["L_LONGMESSAGE0"]; * * Response.Redirect("APIError.aspx?" + pStrError); * */ ErrorMessage = "An error has occurred while processing your order: " + decoder["L_LONGMESSAGE0"] + " (" + decoder["L_ERRORCODE0"] + ")"; ResetAndRedirect(); } }
private void GenerateFeed() { CertificateTableAdapter certificateAdapter = new CertificateTableAdapter(); String description = ""; String siteUrl = "http://" + EnvDomain; String homePageUrl = siteUrl + ResolveUrl("~/Default.aspx") + "?station_id=" + StationId; //mainFeed.Title = TextSyndicationContent.CreatePlaintextContent(Station.SiteNamePlainText); //mainFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri(homePageUrl))); List <DollarSaverDB.CertificateRow> listCertificates = new List <DollarSaverDB.CertificateRow>(); if (Station.StationSiteType == SiteType.Standard) { SpecialSettingsTableAdapter specialSettingsAdapter = new SpecialSettingsTableAdapter(); DollarSaverDB.SpecialSettingsDataTable specialSettingsTable = specialSettingsAdapter.GetSpecialSettings(StationId); bool dailyHeader = false; if (specialSettingsTable.Count == 1) { dailyHeader = specialSettingsTable[0].DailyHeader; } if (dailyHeader) { description = "Daily Deal"; } else { description = "Weekly Deal"; } DollarSaverDB.CertificateDataTable daily = certificateAdapter.GetSpecial(StationId, 1); if (daily.Count == 1) { listCertificates.Add(daily[0]); } } else { description = "Deal of the Week"; DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCurrentDeal(StationId); if (certificateTable.Count == 1) { listCertificates.Add(certificateTable[0]); } } List <SyndicationItem> items = new List <SyndicationItem>(); foreach (DollarSaverDB.CertificateRow certificate in listCertificates) { SyndicationItem item = new SyndicationItem(); item.Title = TextSyndicationContent.CreatePlaintextContent(certificate.AdvertiserName); String advertiserUrl = siteUrl + ResolveUrl("~/Advertiser.aspx?advertiser_id=" + certificate.AdvertiserId); item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(advertiserUrl))); StringBuilder content = new StringBuilder(); if (certificate.Advertiser.LogoUrl != String.Empty) { String logoUrl = siteUrl + ResolveUrl(certificate.Advertiser.LogoUrl); int logoWidth = 125; int logoHeight = 75; if (certificate.Advertiser.IsLogoImageVertical) { logoWidth = 75; logoHeight = 125; } content.Append("<div>"); content.Append("<a href=\"" + advertiserUrl + "\">"); content.Append("<img src=\"" + logoUrl + "\" alt=\"" + Server.HtmlEncode(certificate.AdvertiserName) + "\" style=\"border-color:#404040;border-width:1px;border-style:solid;height:" + logoHeight + "px;width:" + logoWidth + "px;\">"); content.Append("</a>"); content.Append("</div>"); } content.Append("<div style=\"font-family: Arial;\">"); //content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.3em; line-height: 1.7em;\">" + Server.HtmlEncode(certificate.AdvertiserName) + "</a>"); content.Append("<p>"); content.Append(certificate.Advertiser.Description); content.Append("</p>"); content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.1em; line-height: 1.5em;\">" + Server.HtmlEncode(certificate.ShortName) + "<a>"); content.Append("<p> "); content.Append(certificate.Description); content.Append("</p>"); content.Append("<p style=\"font-weight: bold;\"> "); content.Append("Certificate Value: " + certificate.FaceValue.ToString("$0.00") + "<br />"); content.Append("Price: <span style=\"color: red;\">" + certificate.DiscountValue.ToString("$0.00") + "</span><br />"); content.Append("Your Savings: " + certificate.Savings + "<br />"); content.Append("</p>"); content.Append("<a href=\"" + advertiserUrl + "\" style=\"font-weight: bold; font-size: 1.1em; line-height: 1.5em;\">BUY NOW</a>"); content.Append("</div>"); content.Append("<div style=\"clear: both;\"></div>"); item.Content = SyndicationContent.CreateHtmlContent(content.ToString()); items.Add(item); } SyndicationFeed mainFeed = new SyndicationFeed(Station.SiteNamePlainText, description, new Uri(homePageUrl)); mainFeed.Description = TextSyndicationContent.CreatePlaintextContent(description); mainFeed.Items = items; Response.ContentType = "application/rss+xml"; using (XmlWriter xmlWriter = XmlWriter.Create(Response.OutputStream)) { Rss20FeedFormatter rssFeed = new Rss20FeedFormatter(mainFeed); rssFeed.WriteTo(xmlWriter); } }