public void InsertMem(IEnumerable <PaymentCache> paymentCaches) { paymentCaches = paymentCaches.Where(x => !PaymentBook.Contains(x.ToString())); var ms = Payment_Mem.Select(x => x.ToString()); paymentCaches = paymentCaches.Where(x => !ms.Contains(x.ToString())); if (!paymentCaches.Any()) { return; } PaymentFilters.AddRange(paymentCaches.Select(x => PaymentFilter.Parse(x))); Payment_Mem.AddRange(paymentCaches); }
public void InsertMem(PaymentCache paymentCache) { lock (lockObj) { if (PaymentBook.Contains(paymentCache.ToString())) { return; } if (Payment_Mem.Any(x => x.ToString() == paymentCache.ToString())) { return; } Payment_Mem.Add(paymentCache); PaymentFilters.Add(PaymentFilter.Parse(paymentCache)); } }
public void Insert(PaymentCache paymentCache) { lock (lockObj) { var paymentKey = paymentCache.ToString(); if (PaymentBook.Contains(paymentKey)) { return; } PutPaymentBook(new List <string> { paymentKey }); PaymentFilters.Add(PaymentFilter.Parse(paymentCache)); var key = GetKey(AppTables.TradeRecord, paymentKey); AppDomain.Put(key, paymentCache); } }
public PaymentDac() { PaymentBook = new List <string>(); Payment_Mem = new List <PaymentCache>(); PaymentFilters = new List <PaymentFilter>(); PaymentBook = GetPaymentBookInDb(); PaymentBook.ForEach(x => { if (string.IsNullOrEmpty(x)) { PaymentBook.Remove(x); } else { PaymentFilters.Add(PaymentFilter.Parse(x)); } }); //PaymentBook.RemoveAll(x => string.IsNullOrEmpty(x)); //PaymentFilters.AddRange(PaymentBook.Select(x => PaymentFilter.Parse(x))); }
public void Insert(IEnumerable <PaymentCache> payments) { lock (lockObj) { Dictionary <string, PaymentCache> insertMap = new Dictionary <string, PaymentCache>(); List <string> paymentKeys = new List <string>(); foreach (var payment in payments) { var paymentKey = payment.ToString(); if (PaymentBook.Contains(paymentKey)) { continue; } var key = GetKey(AppTables.TradeRecord, paymentKey); paymentKeys.Add(paymentKey); PaymentFilters.Add(PaymentFilter.Parse(payment)); Payment_Mem.RemoveAll(x => x.ToString() == paymentKey); insertMap.Add(key, payment); } PutPaymentBook(paymentKeys); AppDomain.Put(insertMap); } }