コード例 #1
0
ファイル: AzureAdapter.cs プロジェクト: antonioffranco/mvc
        public void RunNow(ScheduleExecutionJobInformation scheduler, string queueName)
        {
            var storageAccount = CloudStorageAccount
                .Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString);

            var queueClient = storageAccount.CreateCloudQueueClient();
            var queue = queueClient.GetQueueReference(queueName);
            queue.CreateIfNotExists();

            var jsonScheduler = JSONHelper.SerializeJson(scheduler);
            var message = new CloudQueueMessage(jsonScheduler);
            queue.AddMessage(message);
        }
コード例 #2
0
        public void RunNow(ApplicationContext context, SchedulerDto schedule)
        {
            schedule.Name = "On Demand";
            schedule.IsActive = false;
            schedule = SaveScheduling(context, schedule);

            var crmConnection = GetConnectionById(context.TenantDomainName, schedule.SourceConnectionId);
            var sharepointConnection = GetConnectionById(context.TenantDomainName, schedule.TargetConnectionId);
            var scheduler = new ScheduleExecutionJobInformation
            {
                SourceViewId = schedule.SourceViewId,
                Source = new Connection
                {
                    Login = crmConnection.UserName,
                    Password = crmConnection.Password,
                    Url = crmConnection.Url
                },
                Target = new Connection
                {
                    Login = sharepointConnection.UserName,
                    Password = sharepointConnection.Password,
                    Url = sharepointConnection.Url
                }
            };
            var excecution = new ExecutionDto
            {
                ScheduleId = schedule.ScheduleId,
                IsOnDemenad = true,
                CreatedBy = schedule.CreatedBy
            };
            SaveExecution(context.TenantDomainName, excecution);
            AzureAdapterService.RunNow(scheduler, context.TenantDomainName);
            scheduler.ExecutionId = excecution.ExecutionId;
        }