示例#1
0
    public void Execute(IJobExecutionContext context)
    {
        if (TrialService.IsTrialEnabled)
        {
            return;
        }

        if (!context.CanStart())
        {
            return;
        }
        context.WriteLastRun();
        string strFileName             = ExportFeed.GetModuleSetting("GoogleBase", "FileName");
        string strPhysicalTargetFolder = SettingsGeneral.AbsolutePath;
        string strPhysicalFilePath     = strPhysicalTargetFolder + strFileName;
        var    exportFeedModule        = new ExportFeedModuleGoogleBase();

        exportFeedModule.GetExportFeedString(strPhysicalFilePath);
    }
示例#2
0
    private static void MakeExportFile(object parameters)
    {
        var myParams = parameters as string[];

        try
        {
            var moduleName      = myParams[0];
            var applicationPath = myParams[1];

            var fileName  = ExportFeed.GetModuleSetting(moduleName, "FileName");
            var directory = applicationPath + "\\";
            var filePath  = directory + fileName;

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            ExportFeedModule exportFeedModule = null;
            switch (moduleName)
            {
            case "YandexMarket":
                exportFeedModule = new ExportFeedModuleYandex();
                break;

            case "GoogleBase":
                exportFeedModule = new ExportFeedModuleGoogleBase();
                break;

            case "PriceGrabber":
                exportFeedModule = new ExportFeedModulePriceGrabber();
                break;

            case "ShoppingCom":
                exportFeedModule = new ExportFeedModuleShoppingCom();
                break;

            case "YahooShopping":
                exportFeedModule = new ExportFeedModuleYahooShopping();
                break;

            case "Amazon":
                exportFeedModule = new ExportFeedModuleAmazon();
                break;

            case "Shopzilla":
                exportFeedModule = new ExportFeedModuleShopzilla();
                break;
            }

            if (exportFeedModule != null)
            {
                exportFeedModule.GetExportFeedString(filePath);
            }

            var fileInfo = new FileInfo(filePath);

            ExportFeedStatistic.FileName = SettingsMain.SiteUrl + "/" + fileInfo.Name;
            ExportFeedStatistic.FileSize = " (" + Math.Ceiling(Convert.ToDecimal(fileInfo.Length) / 1024) + " Kb)";
        }
        catch (Exception ex)
        {
            AdvantShop.Diagnostics.Debug.LogError(ex, "on MakeExportFile in exportFeed");
        }
        finally
        {
            ExportFeedStatistic.IsRun = false;
        }
    }
        private static void MakeExportFile(string[] myParams)
        {
            try
            {
                var moduleName      = myParams[0];
                var applicationPath = myParams[1];

                FileName = ExportFeed.GetModuleSetting(moduleName, "FileName");
                var filePath  = applicationPath + "/" + FileName;
                var directory = filePath.Substring(0, filePath.LastIndexOf('/'));


                if (directory != null && !Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                //if (File.Exists(filePath))
                //{
                //    File.Delete(filePath);
                //}

                ExportFeedModule exportFeedModule = null;
                switch (moduleName)
                {
                case "YandexMarket":
                    exportFeedModule = new ExportFeedModuleYandex();
                    break;

                case "GoogleBase":
                    exportFeedModule = new ExportFeedModuleGoogleBase();
                    break;

                case "PriceGrabber":
                    exportFeedModule = new ExportFeedModulePriceGrabber();
                    break;

                case "ShoppingCom":
                    exportFeedModule = new ExportFeedModuleShoppingCom();
                    break;

                case "YahooShopping":
                    exportFeedModule = new ExportFeedModuleYahooShopping();
                    break;

                case "Amazon":
                    exportFeedModule = new ExportFeedModuleAmazon();
                    break;

                case "Shopzilla":
                    exportFeedModule = new ExportFeedModuleShopzilla();
                    break;
                }

                if (exportFeedModule != null)
                {
                    exportFeedModule.GetExportFeedString(filePath);
                }

                var fileInfo = new FileInfo(filePath);

                CommonStatistic.FileName = SettingsMain.SiteUrl + "/" + FileName;
                CommonStatistic.FileSize = " (" + Math.Ceiling(SQLDataHelper.GetDecimal(fileInfo.Length) / 1024) + " Kb)";
            }
            catch (Exception ex)
            {
                AdvantShop.Diagnostics.Debug.LogError(ex, "on MakeExportFile in exportFeed");
            }
            finally
            {
                CommonStatistic.IsRun = false;
            }
        }