Пример #1
0
        // Named by @ShawnWildermuth via twitter
        public void DoIt(string xmlFromGoogleCart)
        {
            // Pull out the serial number
            XDocument doc = XDocument.Load(new StringReader(xmlFromGoogleCart));
            var query = from elems in doc.Elements().Attributes("serial-number") select elems;
            string serial = query.First().Value;

            // Now check to see if that serial exists..
            PgpEntities entities = new PgpEntities();

            var cards = from c in entities.ProcessedCards
                        where c.Serial == serial
                        select new { c.Serial };

            if (cards.Count() > 0)
            {
                logger.Log("The serial number " + cards.First().Serial + " already exists.. Stopping");
                return;
            }

            ProcessedCard card = new ProcessedCard { RawData = xmlFromGoogleCart, Serial = serial };
            entities.AddToProcessedCards(card);
            entities.SaveChanges();

            GetIdsFromCartXml(card.RawData);
        }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProcessedCards EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProcessedCards(ProcessedCard processedCard)
 {
     base.AddObject("ProcessedCards", processedCard);
 }
Пример #3
0
 /// <summary>
 /// Create a new ProcessedCard object.
 /// </summary>
 /// <param name="processedCardId">Initial value of the ProcessedCardId property.</param>
 /// <param name="rawData">Initial value of the RawData property.</param>
 /// <param name="serial">Initial value of the Serial property.</param>
 public static ProcessedCard CreateProcessedCard(global::System.Int32 processedCardId, global::System.String rawData, global::System.String serial)
 {
     ProcessedCard processedCard = new ProcessedCard();
     processedCard.ProcessedCardId = processedCardId;
     processedCard.RawData = rawData;
     processedCard.Serial = serial;
     return processedCard;
 }