Пример #1
0
 private static Protocal.Commands.PriceAlertData CreatePriceAlertData(this PriceAlert.Alert alert, Protocal.Commands.AlertType alertType)
 {
     return(new Protocal.Commands.PriceAlertData
     {
         Id = alert.Id,
         State = alert.State,
         HitPrice = alertType == Protocal.Commands.AlertType.Hit ? (string)alert.HitPrice : null,
         HitTime = alertType == Protocal.Commands.AlertType.Hit ? alert.HitPriceTimestamp : (DateTime?)null
     });
 }
Пример #2
0
 private static void Process(this PriceAlert.Alert alert, Dictionary <Guid, Protocal.Commands.UserPriceAlertData> alertDict, Protocal.Commands.AlertType alertType)
 {
     Protocal.Commands.UserPriceAlertData userPriceAlerts;
     if (!alertDict.TryGetValue(alert.UserId, out userPriceAlerts))
     {
         userPriceAlerts = new Protocal.Commands.UserPriceAlertData
         {
             UserId      = alert.UserId,
             PriceAlerts = new List <Protocal.Commands.PriceAlertData>()
         };
         alertDict.Add(userPriceAlerts.UserId, userPriceAlerts);
     }
     userPriceAlerts.PriceAlerts.Add(alert.CreatePriceAlertData(alertType));
 }