Inheritance: Microsoft.WindowsAzure.StorageClient.TableServiceEntity
Beispiel #1
0
        private static void GetBillAndSendNotification(Notification notification)
        {
            string amount = "0.00";

            var tileData = string.Format("<tile><visual><binding template=\"TileSquareText04\"><text id=\"1\">{0}</text></binding></visual></tile>", amount);

            // Post the value to the notification url
            PostToWns(_secret, _package_sid, notification.NotificationUri, tileData, "wns/tile");
        }
 public string Post(Notification notification)
 {
     string retVal = string.Empty;
     notification.PartitionKey = "partitionName";
     using (INotificationRepository rep = new NotificationRepository())
     {
         rep.AddOrUpdate(notification);
         rep.SaveChanges();
         retVal = notification.RowKey;
     }
     return retVal;
 }
 public string AddOrUpdate(Notification notification)
 {
     string key = string.Empty;
     var existingNotification = GetByRowKey(notification.RowKey);
     if (existingNotification == null)
     {
         key = Guid.NewGuid().ToString();
         notification.RowKey = key;
         notification.Password = TickerEncryption.Utility.Encrypt(notification.Password, CloudConfigurationManager.GetSetting(Constants.Thumbprint1), CloudConfigurationManager.GetSetting(Constants.Thumbprint2));
         notification.BalanceString = "New";
         notification.LastVerification = DateTime.UtcNow;
         context.AddObject(tableName, notification);
     }
     else
     {
         existingNotification.UserName = notification.UserName;
         existingNotification.Password = TickerEncryption.Utility.Encrypt(notification.Password, CloudConfigurationManager.GetSetting(Constants.Thumbprint1), CloudConfigurationManager.GetSetting(Constants.Thumbprint2));
         existingNotification.NotificationUri = notification.NotificationUri;
         notification.LastVerification = DateTime.UtcNow;
         key = existingNotification.RowKey;
         context.UpdateObject(existingNotification);
     }
     return key;
 }
 public void UpdateBalance(Notification notification, string newBalance)
 {
     notification.LastUpdate = DateTime.UtcNow;
     notification.BalanceString = newBalance;
     context.UpdateObject(notification);
 }
 public void Update(Notification notification)
 {
     context.UpdateObject(notification);
 }