Exemplo n.º 1
0
        public static void ProcessMessage(QueueEnvelope envelope, bool reportEnvelopeError = true)
        {
            try
            {
                InformationContext.Current.InitializeCloudStorageAccess(envelope.ActiveContainerName);
                if (envelope.SingleOperation != null)
                {
                    ProcessSingleOperation(envelope.SingleOperation);
                }
                if (envelope.OrderDependentOperationSequence != null)
                {
                    Exception firstException = null;
                    //envelope.OrderDependentOperationSequence.CollectionContent.ForEach(ProcessSingleOperation);
                    foreach (var singleOperation in envelope.OrderDependentOperationSequence.CollectionContent)
                    {
                        try
                        {
                            ProcessSingleOperation(singleOperation);
                        } catch (Exception ex)
                        {
                            firstException = ex;
                            ErrorSupport.ReportException(ex);
                        }
                    }
                    if (firstException != null)
                    {
                        throw firstException;
                    }
                }
            }
            catch (Exception ex)
            {
                if (reportEnvelopeError)
                {
                    ErrorSupport.ReportEnvelopeWithException(envelope, ex);
                }
                throw;
            } finally
            {
                InformationContext.ProcessAndClearCurrent();
            }

            counter++;
            if (counter >= 1000)
            {
                QueueSupport.ReportStatistics("Processed " + counter + " messages...");
                counter = 0;
            }
        }
Exemplo n.º 2
0
        public static void SendGroupJoinEmail(TBEmailValidation emailValidation, TBCollaboratingGroup collaboratingGroup)
        {
            string urlLink = GetUrlLink(emailValidation.ID);

            QueueSupport.ReportStatistics("Group Email sent! Link: " + urlLink, TimeSpan.FromDays(1));
//            string emailMessageFormat =
//                @"You have been invited to join in the collaboration platform by Aalto Global Impact to collaborate in the group: {0}.
//
//
//Use the following link to accept the invitation and join the group:
//{1}
//
//
//The link is valid for 14 days, after which you need to request new invitation.";
//            string message = String.Format(emailMessageFormat, collaboratingGroup.Title, urlLink);
//            SendEmail(FromAddress, emailValidation.Email,
//                      "Invitation to join collaboration group: " + collaboratingGroup.Title, message);
        }
Exemplo n.º 3
0
 public static bool ProcessOwnerSubscriptionChains(IContainerOwner lockedOwner, string acquiredEtag, string containerName)
 {
     try
     {
         if (containerName != null)
         {
             InformationContext.Current.InitializeCloudStorageAccess(containerName: containerName);
         }
         string[]     blobs        = SubscribeSupport.GetChainRequestList(lockedOwner);
         var          chainContent = blobs.Select(blob => StorageSupport.RetrieveInformation(blob, typeof(SubscriptionChainRequestContent))).Cast <SubscriptionChainRequestContent>().ToArray();
         const double invalidSubscriptionSubmissionTimeInSeconds = 600;
         if (chainContent.Any(item => item.SubmitTime < DateTime.UtcNow.AddSeconds(-invalidSubscriptionSubmissionTimeInSeconds)))
         {
             return(false);
         }
         WorkerSupport.ExecuteSubscriptionChains(chainContent);
         foreach (string blob in blobs)
         {
             StorageSupport.DeleteBlob(blob);
         }
     }
     catch (Exception ex)
     {
         ErrorSupport.ReportException(ex);
         throw;
     }
     finally
     {
         SubscribeSupport.ReleaseChainLock(lockedOwner, acquiredEtag);
         if (containerName != null)
         {
             InformationContext.ProcessAndClearCurrent();
         }
     }
     counter++;
     if (counter >= 1000)
     {
         QueueSupport.ReportStatistics("Processed " + counter + " messages...");
         counter = 0;
     }
     return(true);
 }
Exemplo n.º 4
0
        public static void SendValidationEmail(TBEmailValidation emailValidation)
        {
            string urlLink = GetUrlLink(emailValidation.ID);

            QueueSupport.ReportStatistics("Email sent! Link: " + urlLink, TimeSpan.FromDays(1));
//            string emailMessageFormat =
//                @"Welcome to The Open Innovation Platform!
//
//
//You have just joined the collaboration platform by Aalto Global Impact. Your email address '{0}' has been registered on the OIP system. Before you start your collaboration we simply need to confirm that you did register your email. Please follow the link below during which you might be redirected to perform the authentication on OIP.
//
//
//Use the following link to complete your registration (the link is valid for 30 minutes after which you need to resend the validation):
//{1}
//
//
//Wishing you all the best from OIP team!";
//            string message = string.Format(emailMessageFormat, emailValidation.Email, urlLink);
//            SendEmail(FromAddress, emailValidation.Email, "Welcome to The Open Innovation Platform!", message);
        }
Exemplo n.º 5
0
        public static void SendInputJoinEmail(TBEmailValidation emailValidation, InformationInput informationInput, string[] ownerEmailAddresses)
        {
            string urlLink = GetUrlLink(emailValidation.ID);

            QueueSupport.ReportStatistics("Input Join Email sent! Link: " + urlLink, TimeSpan.FromDays(1));
//      bool isAccount = emailValidation.InformationInputConfirmation.AccountID != null;
//      string ownerID = isAccount
//                           ? emailValidation.InformationInputConfirmation.AccountID
//                           : emailValidation.InformationInputConfirmation.GroupID;
//      string emailMessageFormat =
//          @"Your confirmation is required to allow the following information source '{0}' to be fetched within {1} ID {2}.
//
//
//Click the following link to confirm this action:
//{3}";
//      string message = String.Format(emailMessageFormat, informationInput.Description,
//                                     isAccount ? "account" : "collaboration group", ownerID, urlLink);
//      foreach (string emailAddress in ownerEmailAddresses)
//      {
//        SendEmail(FromAddress, emailAddress, "Information Input Confirmation", message);
//      }
        }