public static List <SagePayLog> Append(this List <SagePayLog> list, int orderId, string nv, string status) { SagePayLog log = new SagePayLog(); log.OrderId = orderId; log.NameValue = nv; log.Status = status; log.TimeStamp = DateTime.Now; // To prevent duplication SagePayLog found = list.Find(delegate(SagePayLog queryLog) { return(queryLog.OrderId == log.OrderId && queryLog.NameValue == log.NameValue && queryLog.Status == log.Status && queryLog.TimeStamp.CompareTo(log.TimeStamp) == 0); }); if (found == null) { list.Add(log); } return(list); }
public void RaiseCallbackEvent(string eventArgument) { string[] args = eventArgument.Split(splitter); if (args[0] == "sp") { // sp, tagid, sagepaylogid SagePayLog spLog = OrderService.GetSagePayLogById(Convert.ToInt32(args[1])); if (spLog != null) { message = spLog.NameValue; int charsPerLine = 120; StringBuilder sb = new StringBuilder(); while (message.Length / charsPerLine > 0) { sb.AppendFormat("{0}<br/>", message.Substring(0, message.Length > charsPerLine ? charsPerLine : message.Length)); message = message.Remove(0, message.Length > charsPerLine ? charsPerLine : message.Length); } sb.AppendFormat("{0}<br/>", message); message = sb.ToString(); } } }