示例#1
0
        protected void btnResizePhoto_Click(object sender, EventArgs e)
        {
            if (CommonStatistic.IsRun)
            {
                return;
            }

            CommonStatistic.Init();
            CommonStatistic.CurrentProcess     = Request.Url.PathAndQuery;
            CommonStatistic.CurrentProcessName = Request.Url.PathAndQuery;
            CommonStatistic.IsRun          = true;
            CommonStatistic.CurrentProcess = Request.Url.PathAndQuery;
            linkCancel.Visible             = true;
            OutDiv.Visible  = true;
            btnSave.Visible = false;
            try
            {
                CommonStatistic.TotalRow = PhotoService.GetCountPhotos(0, PhotoType.Product);
                CommonStatistic.StartNew(Resize);
                //CommonStatistic.ThreadImport = new Thread(Resize) { IsBackground = true };
                //CommonStatistic.ThreadImport.Start();
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
                lError.Text    = ex.Message;
                lError.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_ExportFeed_Yandex_aspx));

            if (!(CommonStatistic.IsRun))
            {
                TrialService.TrackEvent(TrialEvents.ExportProductsToFeed, "");
                CommonStatistic.Init();
            }
            if (!CommonStatistic.IsRun && string.IsNullOrEmpty(ModuleName))
            {
                Response.Redirect("ExportFeed.aspx?ModuleId=YandexMarket");
                return;
            }

            PageSubheader.Visible  = true;
            ModuleNameLiteral.Text = ModuleName;

            OutDiv.Visible  = Start;
            PhysicalAppPath = Request.PhysicalApplicationPath;

            if ((SaasDataService.IsSaasEnabled) && (!SaasDataService.CurrentSaasData.HaveExportFeeds))
            {
                mainDiv.Visible     = false;
                notInTariff.Visible = true;
            }
        }
 public static void ExportSelection(string moduleName, string requestUrlPathAndQuery)
 {
     if (CommonStatistic.IsRun)
     {
         return;
     }
     CommonStatistic.Init();
     CommonStatistic.CurrentProcess     = requestUrlPathAndQuery;
     CommonStatistic.CurrentProcessName = Resource.Admin_ExportFeed_PageSubHeader + " " + moduleName;
     CommonStatistic.StartNew(() => MakeExportFile(new[] { moduleName, PhysicalAppPath }));
 }
        protected void btnAction_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(lblError.Text))
            {
                return;
            }

            if (!FileUpload.HasFile)
            {
                return;
            }

            FileUpload.SaveAs(_fullPath);

            if (!File.Exists(_fullPath))
            {
                return;
            }

            if (CommonStatistic.IsRun)
            {
                return;
            }
            CommonStatistic.Init();
            CommonStatistic.CurrentProcess     = Request.Url.PathAndQuery;
            CommonStatistic.CurrentProcessName = Resource.Admin_ImportXLS_CatalogUpload;
            linkCancel.Visible = true;
            MsgErr(true);
            lblRes.Text = string.Empty;

            CommonStatistic.IsRun    = true;
            CommonStatistic.TotalRow = GetRowCount(_fullPath);

            CommonStatistic.StartNew(() =>
            {
                try
                {
                    ImportSubscribers(_fullPath);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                    CommonStatistic.WriteLog(ex.Message);
                }
                CommonStatistic.IsRun = false;
            });

            //CsvImport.Factory(_fullPath, true).Process();
            pUpload.Visible = false;
            OutDiv.Visible  = true;
        }
示例#5
0
        protected void btnDownload_Click(object sender, EventArgs e)
        {
            if (lError.Visible)
            {
                return;
            }
            if (CommonStatistic.IsRun)
            {
                return;
            }

            //delete old
            foreach (var item in Directory.GetFiles(_strFilePath).Where(f => f.Contains(StrFileName)))
            {
                FileHelpers.DeleteFile(item);
            }

            divAction.Visible    = false;
            divbtnAction.Visible = false;
            choseDiv.Visible     = false;

            CsvSettings.CsvEnconing  = ddlEncoding.SelectedValue;
            CsvSettings.CsvSeparator = ddlSeparetors.SelectedValue == SeparatorsEnum.Custom.StrName() ? txtCustomSeparator.Text : ddlSeparetors.SelectedValue;

            CsvSettings.CsvColumSeparator     = txtColumSeparator.Text;
            CsvSettings.CsvPropertySeparator  = txtPropertySeparator.Text;
            CsvSettings.CsvExportNoInCategory = chbCsvExportNoInCategory.Checked;

            CommonStatistic.Init();
            CommonStatistic.CurrentProcess     = Request.Url.PathAndQuery;
            CommonStatistic.CurrentProcessName = Resource.Admin_ExportExcel_CatalogDownload;
            linkCancel.Visible  = true;
            OutDiv.Visible      = true;
            btnDownload.Visible = false;

            // Directory
            foreach (var file in Directory.GetFiles(_strFilePath).Where(f => f.Contains(StrFileName)).ToList())
            {
                FileHelpers.DeleteFile(file);
            }

            ExtStrFileName = (StrFileName + StrFileExt).FileNamePlusDate();
            _strFullPath   = _strFilePath + ExtStrFileName;
            FileHelpers.CreateDirectory(_strFilePath);
            CsvExport.Factory(_strFullPath, CsvSettings.CsvEnconing, CsvSettings.CsvSeparator, CsvSettings.CsvColumSeparator, CsvSettings.CsvPropertySeparator, FieldMapping, CsvSettings.CsvExportNoInCategory).Process();

            TrialService.TrackEvent(TrialEvents.MakeCSVExport, "");
        }
示例#6
0
        protected void btnAction_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(lblError.Text))
            {
                return;
            }


            if (!_fieldMapping.ContainsKey(ProductFields.Sku.StrName()) && !_fieldMapping.ContainsKey(ProductFields.Name.StrName()))
            {
                MsgErr(Resource.Admin_ImportCsv_SelectNameOrSKU);
                return;
            }

            divAction.Visible = false;
            choseDiv.Visible  = false;
            if (!File.Exists(_fullPath))
            {
                return;
            }

            if (CommonStatistic.IsRun)
            {
                return;
            }
            _hasHeadrs = Request["hasheadrs"] == "true";
            CommonStatistic.Init();
            CommonStatistic.CurrentProcess     = Request.Url.PathAndQuery;
            CommonStatistic.CurrentProcessName = Resource.Admin_ImportXLS_CatalogUpload;
            linkCancel.Visible = true;
            MsgErr(true);
            lblRes.Text = string.Empty;
            CsvImport.Factory(_fullPath, _hasHeadrs, chboxDisableProducts.Checked, CsvSettings.CsvSeparator, CsvSettings.CsvEnconing, _fieldMapping, CsvSettings.CsvColumSeparator, CsvSettings.CsvPropertySeparator).Process();
            OutDiv.Visible = true;
            TrialService.TrackEvent(TrialEvents.MakeCSVImport, "");
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_ExportFeed_Yandex_aspx));
            if ((SaasDataService.IsSaasEnabled) && (!SaasDataService.CurrentSaasData.HaveExportFeeds))
            {
                mainDiv.Visible     = false;
                notInTariff.Visible = true;
            }

            if (!(CommonStatistic.IsRun))
            {
                CommonStatistic.Init();
            }

            if (string.IsNullOrEmpty(ModuleName))
            {
                Response.Redirect("ExportFeedDet.aspx?ModuleId=YandexMarket");
                return;
            }

            LoadSettings();

            PhysicalAppPath = Request.PhysicalApplicationPath;
        }
        protected void btnDownload_Click(object sender, EventArgs e)
        {
            if (CommonStatistic.IsRun)
            {
                lError.Visible = true;
                lError.Text    = Resource.Admin_Restrict_Action_In_demo;
                return;
            }
            var paging = new SqlPaging
            {
                TableName = "[Order].[Order]"
            };

            paging.AddField(new Field {
                Name = "*"
            });

            if (chkStatus.Checked)
            {
                paging.AddField(new Field
                {
                    Name       = "OrderStatusID",
                    NotInQuery = true,
                    Filter     = new EqualFieldFilter {
                        ParamName = "@OrderStatusID", Value = ddlStatus.SelectedValue
                    }
                });
            }

            if (chkDate.Checked)
            {
                var filter = new DateTimeRangeFieldFilter {
                    ParamName = "@RDate"
                };
                var dateFrom = txtDateFrom.Text.TryParseDateTime();
                filter.From = dateFrom != DateTime.MinValue ? dateFrom : new DateTime(2000, 1, 1);

                var dateTo = txtDateTo.Text.TryParseDateTime();
                filter.To = dateTo != DateTime.MinValue ? dateTo.AddDays(1) : new DateTime(3000, 1, 1);
                paging.AddField(new Field {
                    Name = "OrderDate", NotInQuery = true, Filter = filter
                });
            }
            var ordersCount = paging.TotalRowsCount;

            if (ordersCount == 0)
            {
                return;
            }
            CommonStatistic.Init();
            CommonStatistic.IsRun              = true;
            CommonStatistic.CurrentProcess     = Request.Url.PathAndQuery;
            CommonStatistic.CurrentProcessName = Resource.Admin_ExportOrdersExcel_DownloadOrders;
            CommonStatistic.TotalRow           = ordersCount;

            linkCancel.Visible  = true;
            OutDiv.Visible      = true;
            btnDownload.Visible = false;
            pnSearch.Visible    = false;
            try
            {
                // Directory
                if (!Directory.Exists(_strFilePath))
                {
                    Directory.CreateDirectory(_strFilePath);
                }

                CommonStatistic.StartNew(() => Save(paging));
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
                lError.Text           = ex.Message;
                lError.Visible        = true;
                CommonStatistic.IsRun = false;
            }
        }
 protected void linkCancel_Click(object sender, EventArgs e)
 {
     CommonStatistic.IsRun = false;
     CommonStatistic.Init();
 }