protected override IOperation BuildOperation()
 {
     return(FluentOperationBuilder
            .Receive <FilesFromLocalDirectory>()
            .WithOption(x => x.Pattern = "*.xslx")
            .Debatch()
            .Transform <WorkFileToStream>()
            .Transform <FromExcelStreamToDataTable>()
            .Transform <DataTableToProductList>()
            .Send <ProductListToUCommerce>()
            .WithOption(x => x.ConnectionString = "server=.;database=U4;integrated security=SSPI;")
            .ToOperation());
 }
 protected override IOperation BuildOperation()
 {
     return(FluentOperationBuilder
            .Receive <ProductListFromUCommerce>()
            .WithOption(x => x.ConnectionString = "server=.;database=u7dev;integrated security=SSPI;")
            .Transform <ProductListToDataTable>()
            .Transform <FromDataTableToExcelStream>()
            .Transform <StreamToWorkfileWithTimestampName>()
            .WithOption(a => a.Extension = ".xlsx")
            .Batch(size: 1)
            .Send <FilesToLocalDirectory>()
            .WithOption(x => x.Overwrite = true)
            .ToOperation());
 }
Esempio n. 3
0
 protected override IOperation BuildOperation()
 {
     return(FluentOperationBuilder
            .Receive <FilesFromLocalDirectory>()
            .WithOption(x => x.Pattern = "*.xml")
            .Debatch()
            .Transform <WorkFileToXDocument>()
            .Debatch <XDocumentToXElements>()
            .Transform <XElementToCsvRow>()
            .Batch(size: 10)
            .Send <StringsToFileInLocalDirectory>()
            .WithRetryStrategy <SimpleRetryStrategy>()
            .WithExceptionNotifier <SimpleExceptionNotifier>()
            .WithOption(x => x.EmailAddress = "*****@*****.**")
            .ToOperation());
 }
 protected override IOperation BuildOperation()
 {
     return(FluentOperationBuilder
            .Receive <FilesFromLocalDirectory>()                         // receives IEnumerable<WorkFile>
            .WithOption(x => x.Pattern = "*.xml")
            .Debatch()                                                   // IEnumerable<WorkFile> to WorkFile
            .Transform <WorkFileToXDocument>()                           // WorkFile to XDocument
            .Transform <XDocumentToXElements>()                          // XDocument to IEnumerable<XElement>
            .WithOption(x => x.DescendendsName = "author")
            .Debatch()                                                   // IEnumerable<XElement> to XElement
            .Transform <XElementToValue>()                               // XElement to string
            .Batch()                                                     // string to IEnumerable<string>
            .Transform <DistinctFilter <string> >()                      // IEnumerable<string> to IEnumerable<string>
            .Send <StringsToFileInLocalDirectory>()                      // sends IEnumerable<string> to a file.
            .ToOperation());
 }
        /// <summary>
        /// Fluent operation for migrating product definitions
        /// </summary>
        /// <returns>operation</returns>
        public IOperation BuildOperation()
        {
            var uCommerceConnectionString = ConfigurationManager.ConnectionStrings["UCommerceConnectionString"].ConnectionString;

            return(FluentOperationBuilder
                   .Receive <ProductTypesFromSitefinity>()
                   .WithOption(x => x.SitefinityBaseUrl = MigrationSettings.Settings.SitefinityBaseUrl)
                   .WithOption(x => x.SitefinityUsername = MigrationSettings.Settings.SitefinityUsername)
                   .WithOption(x => x.SitefinityPassword = MigrationSettings.Settings.SitefinityPassword)
                   .WithOption(x => x.Log = Log)
                   .Transform <SfProductTypesToUcProductDefinitions>()
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .Send <ProductDefinitionsToUCommerce>()
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .ToOperation());
        }
Esempio n. 6
0
        public ActionResult Download(int?id, string typeName, DownloadAs?type)
        {
            var typeInfo = new TypeInfo
            {
                Id       = id.GetValueOrDefault(0),
                TypeName = typeName ?? "",
                Type     = type.GetValueOrDefault(DownloadAs.Excel),
            };

            WorkFile   output = null;
            IOperation operation;

            if (typeInfo.Type == DownloadAs.Excel)
            {
                var builder = FluentOperationBuilder
                              .Receive <InvokeMethodReceiver <TypeInfo> >().WithOption(x => x.Method = () => typeInfo)
                              .Transform <TypeInfoToProductListCog>()
                              .Transform <ProductListToDataTable>()
                              .Transform <FromDataTableToExcelStream>()
                              .Transform <NamingCog>().WithOption(a => a.Extension = ".xlsx")
                              .Send <InvokeMethodSender <WorkFile> >().WithOption(x => x.Method = (value) => output = value);
                operation = builder.ToOperation();
            }
            else
            {
                var builder = FluentOperationBuilder
                              .Receive <InvokeMethodReceiver <TypeInfo> >().WithOption(x => x.Method = () => typeInfo)
                              .Transform <TypeInfoToProductListCog>()
                              .Transform <ProductListToDataTable>()
                              .Transform <FromDataTableToCsvStream>()
                              .Transform <NamingCog>().WithOption(a => a.Extension = ".csv")
                              .Send <InvokeMethodSender <WorkFile> >().WithOption(x => x.Method = (value) => output = value);
                operation = builder.ToOperation();
            }

            var runner = new OperationEngine();

            runner.Execute(operation);
            output.Stream.Flush();
            output.Stream.Position = 0;
            return(File(output.Stream, MediaTypeNames.Application.Octet, output.Name));
        }
        /// <summary>
        /// Fluent operation for migrating category taxonomy
        /// </summary>
        /// <returns>operation</returns>
        public IOperation BuildOperation()
        {
            var uCommerceConnectionString = ConfigurationManager.ConnectionStrings["UCommerceConnectionString"].ConnectionString;

            return(FluentOperationBuilder
                   .Receive <TaxonomyFromSitefinity>()
                   .WithOption(x => x.SitefinityBaseUrl = MigrationSettings.Settings.SitefinityBaseUrl)
                   .WithOption(x => x.SitefinityUsername = MigrationSettings.Settings.SitefinityUsername)
                   .WithOption(x => x.SitefinityPassword = MigrationSettings.Settings.SitefinityPassword)
                   .WithOption(x => x.SitefinityDepartmentTaxonomyId = MigrationSettings.Settings.SitefinityDepartmentTaxonomyId)
                   .WithOption(x => x.Log = Log)
                   .Transform <SfTaxonomyToUcTaxonomy>()
                   .WithOption(x => x.DefaultCatalogName = MigrationSettings.Settings.SitefinitySiteName)
                   .WithOption(x => x.DefaultCategoryDefinitionName = MigrationSettings.Settings.DefaultUcommerceCategoryDefinitionName)
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .Send <TaxonomyToUCommerce>()
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .ToOperation());
        }
        /// <summary>
        /// Fluent operation for migrating catalogs
        /// </summary>
        /// <returns>operation</returns>
        public IOperation BuildOperation()
        {
            var uCommerceConnectionString  = ConfigurationManager.ConnectionStrings["UCommerceConnectionString"].ConnectionString;
            var sitefinityConnectionString = ConfigurationManager.ConnectionStrings["SitefinityConnectionString"].ConnectionString;

            return(FluentOperationBuilder
                   .Receive <CatalogsFromSitefinity>()
                   .WithOption(x => x.SitefinitySiteName = MigrationSettings.Settings.SitefinitySiteName)
                   .WithOption(x => x.SitefinityConnectionString = sitefinityConnectionString)
                   .WithOption(x => x.SitefinityBaseUrl = MigrationSettings.Settings.SitefinityBaseUrl)
                   .WithOption(x => x.SitefinityUsername = MigrationSettings.Settings.SitefinityUsername)
                   .WithOption(x => x.SitefinityPassword = MigrationSettings.Settings.SitefinityPassword)
                   .WithOption(x => x.Log = Log)
                   .Transform <SfCatalogsToUcCatalogs>()
                   .WithOption(x => x.DefaultCatalogGroupName = MigrationSettings.Settings.DefaultUcommerceCatalogGroupName)
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .Send <ProductCatalogsToUCommerce>()
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .ToOperation());
        }
Esempio n. 9
0
        /// <summary>
        /// Fluent operation for migrating product data
        /// </summary>
        /// <returns>operation</returns>
        public IOperation BuildOperation()
        {
            var uCommerceConnectionString  = ConfigurationManager.ConnectionStrings["UCommerceConnectionString"].ConnectionString;
            var sitefinityConnectionString = ConfigurationManager.ConnectionStrings["SitefinityConnectionString"].ConnectionString;

            return(FluentOperationBuilder
                   .Receive <ProductListFromSitefinity>()
                   .WithOption(x => x.SitefinityBaseUrl = MigrationSettings.Settings.SitefinityBaseUrl)
                   .WithOption(x => x.SitefinityUsername = MigrationSettings.Settings.SitefinityUsername)
                   .WithOption(x => x.SitefinityPassword = MigrationSettings.Settings.SitefinityPassword)
                   .WithOption(x => { })
                   .WithOption(x => x.Skip = Skip)
                   .WithOption(x => x.Take = Take)
                   .WithOption(x => x.Log = Log)
                   .Transform <SfProductListToUcProductList>()
                   .WithOption(x => x.SitefinitySiteName = MigrationSettings.Settings.SitefinitySiteName)
                   .WithOption(x => x.Log = Log)
                   .Send <ProductListToUCommerce>()
                   .WithOption(x => x.ConnectionString = uCommerceConnectionString)
                   .WithOption(x => x.Log = Log)
                   .ToOperation());
        }