Ejemplo n.º 1
0
        private async Task ExportMaps()
        {
            if (importedMaps != null)
            {
                try
                {
                    await mMigrator.MigrateToCloudIA(importedMaps.ToList(), this.ApplicationContext.GetService <IntegrationAccountDetails>());
                }
                catch (Exception ex)
                {
                    StatusBarViewModel.ShowError("(Error) " + ExceptionHelper.GetExceptionMessage(ex));
                }
                finally
                {
                    foreach (var map in importedMaps)
                    {
                        ExportedItems.Where(item => item.ArtifactName == map.MigrationEntity.fullNameOfMapToUpload).First().ExportStatus     = map.ExportStatus;
                        ExportedItems.Where(item => item.ArtifactName == map.MigrationEntity.fullNameOfMapToUpload).First().ExportStatusText = map.ExportStatusText;
                        countArtifactsMigrated++;
                        UpdateProgress();
                    }
                }

                foreach (var item in importedMaps)
                {
                    if (item.ExportStatus == MigrationStatus.Failed)
                    {
                        StatusBarViewModel.StatusInfoType = StatusInfoType.Error;
                        StatusBarViewModel.ShowError("Error(s) were encountered. Please refer the Status Tool Tip / Log File for more details.");
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private async Task ExportPartners()
        {
            try
            {
                if (importedPartners != null)
                {
                    foreach (var partner in importedPartners)
                    {
                        try
                        {
                            await pMigrator.ExportToIA(partner, this.ApplicationContext.GetService <IntegrationAccountDetails>());
                        }
                        catch (Exception ex)
                        {
                            partner.ExportStatus     = MigrationStatus.Failed;
                            partner.ExportStatusText = ex.Message;
                            TraceProvider.WriteLine(string.Format("An exception occured:{0}", ex.Message));
                        }
                        finally
                        {
                            ExportedItems.Where(item => item.ArtifactName == partner.MigrationEntity.Name).First().ExportStatus     = partner.ExportStatus;
                            ExportedItems.Where(item => item.ArtifactName == partner.MigrationEntity.Name).First().ExportStatusText = partner.ExportStatusText;
                            countArtifactsMigrated++;
                            UpdateProgress();
                        }
                    }

                    foreach (var item in importedPartners)
                    {
                        if (item.ExportStatus == MigrationStatus.Failed)
                        {
                            StatusBarViewModel.StatusInfoType = StatusInfoType.Error;
                            StatusBarViewModel.ShowError("Error(s) were encountered. Please refer the Status Tool Tip / Log File for more details.");
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StatusBarViewModel.StatusInfoType = StatusInfoType.Error;
                StatusBarViewModel.ShowError("Error was encountered. Reason: " + ex.Message);
                TraceProvider.WriteLine("Error was encountered. Reason: " + ex.InnerException.StackTrace);
            }
        }
Ejemplo n.º 3
0
        private async Task ExportAgreements()
        {
            try
            {
                AuthenticationResult        authresult  = this.ApplicationContext.GetProperty("IntegrationAccountAuthorization") as AuthenticationResult;
                Dictionary <string, string> schemasInIA = await AgreementMigrator.GetAllSchemasInIA(this.ApplicationContext.GetService <IntegrationAccountDetails>(), authresult);

                Dictionary <KeyValuePair <string, string>, string> partnerIdentitiesInIA = await AgreementMigrator.GetAllPartnerIdentitiesInIA(this.ApplicationContext.GetService <IntegrationAccountDetails>(), authresult);

                this.ApplicationContext.SetProperty("SchemasInIntegrationAccount", schemasInIA);
                this.ApplicationContext.SetProperty("PartnerIdentitiesInIntegrationAccount", partnerIdentitiesInIA);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Following error occured : " + ExceptionHelper.GetExceptionMessage(ex));
                TraceProvider.WriteLine("Following error occured : " + ExceptionHelper.GetExceptionMessage(ex));
            }
            try
            {
                if (importedAgreements != null)
                {
                    foreach (var agreement in importedAgreements)
                    {
                        try
                        {
                            await aMigrator.ExportToIA(agreement, this.ApplicationContext.GetService <IntegrationAccountDetails>());
                        }
                        catch (Exception ex)
                        {
                            agreement.ExportStatus     = MigrationStatus.Failed;
                            agreement.ExportStatusText = ex.Message;
                            TraceProvider.WriteLine(string.Format("An exception occured:{0}", ex.Message));
                            TraceProvider.WriteLine();
                        }
                        finally
                        {
                            ExportedItems.Where(item => item.ArtifactName == agreement.Name).First().ExportStatus     = agreement.ExportStatus;
                            ExportedItems.Where(item => item.ArtifactName == agreement.Name).First().ExportStatusText = agreement.ExportStatusText;
                            countArtifactsMigrated++;
                            UpdateProgress();
                        }
                    }

                    foreach (var item in importedAgreements)
                    {
                        if (item.ExportStatus == MigrationStatus.Failed)
                        {
                            StatusBarViewModel.StatusInfoType = StatusInfoType.Error;
                            StatusBarViewModel.ShowError("Error(s) were encountered. Please refer the Status Tool Tip / Log File for more details.");
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StatusBarViewModel.StatusInfoType = StatusInfoType.Error;
                StatusBarViewModel.ShowError("Error was encountered. Reason: " + ex.Message);
                TraceProvider.WriteLine("Error was encountered. Reason: " + ex.InnerException.StackTrace);
            }
        }