Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        public void Process(bool inBackGround = true, ProductCsvFilterModel model = null)
        {
            if (model == null)
            {
                model = new ProductCsvFilterModel()
                {
                    ModuleName         = "CsvExport",
                    ExportNoInCategory = _csvExportNoInCategory
                }
            }
            ;

            CommonStatistic.TotalRow =
                ProductService.GetCsvProdutsCount(model);

            CommonStatistic.StartNew(() =>
            {
                try
                {
                    SaveProductsToCsv(model);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                    CommonStatistic.WriteLog(ex.Message);
                }
                CommonStatistic.IsRun = false;
            }, inBackGround);
        }
    }
 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;
        }
Ejemplo n.º 5
0
 public void Process(bool inBackGround = true)
 {
     CommonStatistic.StartNew(() =>
     {
         try
         {
             _process();
         }
         catch (Exception ex)
         {
             Debug.LogError(ex);
             CommonStatistic.WriteLog(ex.Message);
         }
         CommonStatistic.IsRun = false;
     }, inBackGround);
 }
Ejemplo n.º 6
0
        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;
            }
        }