public static void SendAdNotification(AdsDataComponent.AdsRow ad) { SiteSettings s = SiteSettings.GetSharedSettings(); StringBuilder messageBody = new StringBuilder(); messageBody.AppendFormat("A new Ad has just been to the Classifieds site '{0}':", s.SiteName); messageBody.AppendLine(); messageBody.AppendLine(); messageBody.Append("Title: "); messageBody.AppendLine(ad.Title); messageBody.Append("Category: "); messageBody.AppendLine(ad.CategoryName); messageBody.AppendLine(); messageBody.AppendLine("For Details and Activation: "); messageBody.Append(ClassifiedsHttpApplication.SiteUrl); messageBody.AppendFormat("EditAd.aspx?id={0}", ad.Id); messageBody.AppendLine(); if ((AdStatus)ad.AdStatus != AdStatus.Activated) { messageBody.AppendLine("Status: The Ad is not yet active."); } else { messageBody.AppendLine("Status: The Ad was activated automatically."); } try { MailMessage m = new MailMessage(s.SiteEmailFromField, GetAdminRecipients()); m.Subject = String.Format("New Ad posted: {0}", ad.Title); m.Body = messageBody.ToString(); SmtpClient client = new SmtpClient(); client.Send(m); } catch { } }
private static void RemovePhotoFilesInTable(AdsDataComponent.PhotosDataTable photosToDelete) { if (photosToDelete != null) { for (int i = 0; i < photosToDelete.Rows.Count; i++) { AdsDataComponent.PhotosRow photo = photosToDelete.Rows[i] as AdsDataComponent.PhotosRow; DeleteLocalPhotoFiles(photo.Id); } } }
private static AdsDataComponent.AdsRow GetFirstRow(AdsDataComponent.AdsDataTable table) { if (table != null && table.Rows.Count > 0) { AdsDataComponent.AdsRow row; row = table.Rows[0] as AdsDataComponent.AdsRow; row.URL = System.Web.HttpUtility.UrlDecode(row.URL); row.Title = System.Web.HttpUtility.HtmlDecode(row.Title); row.Description = System.Web.HttpUtility.HtmlDecode(row.Description); row.Location = System.Web.HttpUtility.HtmlDecode(row.Location); return row; } else return null; }