using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Collections.Generic; using System.Collections; using System.IO; using CodeCafe.Web; using System.Web.Caching; /// /// Summary description for clsGlobal /// public enum ListTypes { Empty, AllowNone, AllowNew, AllowSelect, AllowAll }; public class Global { /**********************************************************************************************************************************/ /// /// Loads the terms and conditions into the server cache. /// /// public static string LoadTermsAndConditions() { string result = ""; string filename = System.Web.HttpContext.Current.Server.MapPath("~/Terms.htm"); if (System.Web.HttpContext.Current.Cache["terms"] == null) { result = Utils.LoadFile(filename); System.Web.HttpContext.Current.Cache.Insert("terms", result, new CacheDependency(filename)); } else result = (string)System.Web.HttpContext.Current.Cache["terms"]; return result; } /**********************************************************************************************************/ /// /// Sends the BluWave branded email. /// /// To address. /// The subject line. /// The content. /// The reply to. /// public static string SendBluWaveEmail(string ToAddress, string SubjectLine, string Content, string ReplyTo) { string result = ""; Email email = new Email(); email.EmbedImage("~/Templates/BluWave_Header.png", "header"); email.EmbedImage("~/Templates/BluWave_Footer.png", "footer"); string msg = Utils.LoadFile("~/Templates/Generic-Emailer.htm"); msg = msg.Replace("", Content); email.SetReplyTo(ReplyTo); result = email.SendMail(ToAddress, SubjectLine, msg); return result; } /**********************************************************************************************************/ /// /// Gets the province. /// /// The prov ID. /// public static string GetProvince(int ProvID) { string result = ""; switch (ProvID) { case 1: result ="Eastern Cape"; break; case 2: result = "Free State"; break; case 3: result = "Gauteng"; break; case 4: result = "KwaZulu - Natal"; break; case 5: result = "Limpopo"; break; case 6: result = "Mpumalanga"; break; case 7: result = "North West"; break; case 8: result = "Northern Cape"; break; case 9: result = "Western Cape"; break; case 10: result = "Outside South Africa"; break; } return result; } /**********************************************************************************************************/ /// /// Gets the size of the company. /// /// The size ID. /// public static string GetCompanySize(int SizeID) { string result = ""; switch (SizeID) { case 1: result = "1 - 5"; break; case 2: result = "6 - 10"; break; case 3: result = "11 - 20"; break; case 4: result = "21 - 30"; break; case 5: result = "More than 30"; break; } return result; } /**********************************************************************************************************/ /// /// Renders the email address as a link. /// /// The email. /// public static string RenderEmail(string email) { return "" + email + ""; } /**********************************************************************************************************/ /// /// Displays the Recurring payment info. /// /// The purchase date. /// The num terms. /// public static string RecurringPaymentInfo(DateTime PurchaseDate, int NumTerms) { string result = ""; DateTime Payment = new DateTime(PurchaseDate.AddMonths(1).Year, PurchaseDate.AddMonths(1).Month, 1); result += "
Your first monthly payment will reflect immediately, subsequent payments will reflect on the 1st of each month starting from
"; result += "1st " + Payment.ToString("MMMM yyyy") + " until 1st " + Payment.AddMonths(NumTerms - 2).ToString("MMMM yyyy") + "

"; return result; } /**********************************************************************************************************/ }