Exemple #1
0
 private void LogTransactionRemote(TransactionLog trans_log)
 {
     if (_deviceInfo.pushToCloud == true)
     {
         CloudInterface.PushToCloud(_deviceInfo.iotHubUri, _deviceInfo.SerialNumber, _deviceInfo.iotHubDeviceKey, trans_log).ContinueWith(result => {
             if (result.Equals(true))
             {
                 var transaction          = _transactionLogComp.GetTransactionLogByRowGuid(trans_log.rowguid);
                 transaction.Uploaded     = true;
                 transaction.DateUploaded = DateTime.Now.ToUniversalTime();
                 _transactionLogComp.UpdateTransactionLog(transaction);
                 // set transaction log persisted state to true;
             }
         });
     }
     else if (_deviceInfo.pushToWebApi == true)
     {
         CloudInterface.PushToWebApi(_deviceInfo.ServerUrl, trans_log).ContinueWith(result => {
             if (result.Equals(true))
             {
                 var transaction             = _transactionLogComp.GetTransactionLogByRowGuid(trans_log.rowguid);
                 transaction.persistedServer = true;
                 transaction.DateUploaded    = DateTime.Now.ToUniversalTime();
                 _transactionLogComp.UpdateTransactionLog(transaction);
                 // set transaction log persisted state to false;
             }
         });
     }
     //
 }
 public MainForm()
 {
     InitializeComponent();
     cloud = new CloudInterface();
 }