Пример #1
0
        static void Main(string[] args)
        {
            string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            Console.WriteLine("BV Migrate | " + version);
            Console.WriteLine();

            if (args.Length < 2)
            {
                ShowHelp();
                return;
            }

            Console.WriteLine("Parsing Arguments");

            MigrationSettings data = new MigrationSettings();

            foreach (string arg in args)
            {
                ParseArg(data, arg);
            }

            data.PrepArgs();

            MigrationService migrator = new MigrationService(data);
            migrator.ProgressReport += new MigrationService.ProgressReportDelegate(builder_ProgressReport);
            migrator.StartMigration();            
        }
Пример #2
0
        private void LoadSettingsFromSaved(MigrationSettings s)
        {
            s.ApiKey = Properties.Settings.Default.ApiKey;
            s.ClearAffiliates = Properties.Settings.Default.ClearAffiliates;
            s.ClearCategories = Properties.Settings.Default.ClearCategories;
            s.ClearOrders = Properties.Settings.Default.ClearOrders;
            s.ClearProducts = Properties.Settings.Default.ClearProducts;
            s.ClearUsers = Properties.Settings.Default.ClearUsers;
            s.DestinationServiceRootUrl = Properties.Settings.Default.DestinationRootUrl;
            s.ImportAffiliates = Properties.Settings.Default.ImportAffiliates;
            s.ImportCategories = Properties.Settings.Default.ImportCategories;
            s.ImportOrders = Properties.Settings.Default.ImportOrders;
            s.ImportOtherSettings = Properties.Settings.Default.ImportOther;
            s.ImportProducts = Properties.Settings.Default.ImportProducts;
            s.ImportUsers = Properties.Settings.Default.ImportUsers;
            if (Properties.Settings.Default.SingleOrderOn)
            {
                s.SingleOrderImport = Properties.Settings.Default.SingleOrderImport;
            }
            if (Properties.Settings.Default.SingleSkuOn)
            {
                s.SingleSkuImport = Properties.Settings.Default.SingleSkuImport;
            }
            s.SourceType = Properties.Settings.Default.SourceType;
            s.SQLDatabase = Properties.Settings.Default.SQLDatabase;
            s.SQLServer = Properties.Settings.Default.SQLServer;
            s.SQLUsername = Properties.Settings.Default.SQLUsername;
            s.SQLPassword = Properties.Settings.Default.SQLPassword;
            s.UseMetricUnits = Properties.Settings.Default.UseMetricUnits;

            s.ImagesRootFolder = Properties.Settings.Default.ImagesRootFolder;

            int userStartpage = 1;
            if (int.TryParse(Properties.Settings.Default.UserStartPage, out userStartpage))
            {
                s.UserStartPage = userStartpage;
            }
            int productStartPage = 1;
            
            if (int.TryParse(Properties.Settings.Default.ProductStartPage, out productStartPage))
            {
                s.ProductStartPage = productStartPage;
            }
            s.DisableMultiThreading = Properties.Settings.Default.DisableMultiThreading;
            s.ImportProductImagesOnly = Properties.Settings.Default.ProductImagesOnly;

            s.SkipProductPrerequisites = Properties.Settings.Default.SkipProductPrerequisites;

            s.SourceServiceRootUrl = Properties.Settings.Default.SourceRootUrl;
            s.SourceApiKey = Properties.Settings.Default.SourceApiKey;

            s.SkipInactiveProducts = Properties.Settings.Default.SkipInactiveProducts;
            
            s.PrepArgs();
        }
Пример #3
0
        private void btnReIndex_Click(object sender, EventArgs e)
        {
            ReindexForm s = new ReindexForm();
            if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                MigrationSettings settings = new MigrationSettings();
                LoadSettingsFromSaved(settings);
                settings.SourceType = MigrationSourceType.ReIndexOnly;

                WorkerForm worker = new WorkerForm();
                worker.Show();
                worker.Focus();
                worker.StartMigration(settings);
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OptionsForm s = new OptionsForm();
            if (s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                MigrationSettings settings = new MigrationSettings();
                LoadSettingsFromSaved(settings);

                WorkerForm worker = new WorkerForm();
                worker.Show();
                worker.Focus();
                worker.StartMigration(settings);                
            }
            else
            {
                this.Focus();
            }
        }
Пример #5
0
        private static void ParseArg(MigrationSettings data, string arg)
        {
            string[] argParts = arg.Split('=');
            if (argParts.Length < 2) return;

            switch (argParts[0].Trim().ToLowerInvariant())
            {
                case "-bv6":
                    data.DestinationServiceRootUrl = argParts[1];
                    break;
                case "-apikey":
                    data.ApiKey = argParts[1];
                    break;
                case "-imagefolder":
                    data.ImagesRootFolder = argParts[1];
                    break;
                case "-mode":
                    if (argParts[1] == "2004")
                    {
                        data.SourceType = MigrationSourceType.BVC2004;
                    }
                    else
                    {
                        data.SourceType = MigrationSourceType.BV5;
                    }
                    break;
                case "-sqlserver":
                    data.SQLServer = argParts[1];
                    break;
                case "-sqldatabase":
                    data.SQLDatabase = argParts[1];
                    break;
                case "-sqluser":
                    data.SQLUsername = argParts[1];
                    break;
                case "-sqlpassword":
                    data.SQLPassword = argParts[1];
                    break;
                case "-usemetric":
                    data.UseMetricUnits = argParts[1] == "Y" ? true : false;
                    break;
                case "-importproducts":
                    data.ImportProducts = argParts[1] == "Y" ? true : false;
                    break;
                case "-importcategories":
                    data.ImportCategories = argParts[1] == "Y" ? true : false;
                    break;
                case "-importusers":
                    data.ImportUsers = argParts[1] == "Y" ? true : false;
                    break;
                case "-importaffiliates":
                    data.ImportAffiliates = argParts[1] == "Y" ? true : false;
                    break;
                case "-importorders":
                    data.ImportOrders = argParts[1] == "Y" ? true : false;
                    break;
                case "-importothers":
                    data.ImportOtherSettings = argParts[1] == "Y" ? true : false;
                    break;
                case "-clearproducts":
                    data.ClearProducts = argParts[1] == "Y" ? true : false;
                    break;
                case "-clearcategories":
                    data.ClearCategories = argParts[1] == "Y" ? true : false;
                    break;
                case "-clearorders":
                    data.ClearOrders = argParts[1] == "Y" ? true : false;
                    break;
                case "-clearaffiliates":
                    data.ClearAffiliates = argParts[1] == "Y" ? true : false;
                    break;
                case "-singleorder":
                    data.SingleOrderImport = argParts[1];
                    break;
                case "-singlesku":
                    data.SingleSkuImport = argParts[1];
                    break;            
                case "-importproductlimit":
                    int temp = -1;
                    int.TryParse(argParts[1], out temp);
                    data.ImportProductLimit = temp;
                    break;
            }
        }
Пример #6
0
 public MigrationService(MigrationSettings settings)
 {
     _Settings = settings;
 }
Пример #7
0
 public void StartMigration(MigrationSettings data)
 {            
     _Settings = data;
     this.OutputField.Text = string.Empty;
     this.backgroundWorker1.RunWorkerAsync(data);
 }
Пример #8
0
 public WorkerForm()
 {            
     InitializeComponent();
     _Settings = null;
 }