Beispiel #1
0
 protected void linkCancel_Click(object sender, EventArgs e)
 {
     if (ImportPropertiesElbuzCsvStatistic.ThreadImport.IsAlive)
     {
         ImportPropertiesElbuzCsvStatistic.ThreadImport.Abort();
         ImportPropertiesElbuzCsvStatistic.Init();
         hlDownloadImportLog.Attributes.CssStyle["display"] = "inline";
     }
 }
Beispiel #2
0
    protected void btnLoad_Click(object sender, EventArgs e)
    {
        try
        {
            if (fupZipPhotos.HasFile)
            {
                fupZipPhotos.SaveAs(HttpContext.Current.Server.MapPath("~/App_Data/elbuzZipPhotos.zip"));
                if (File.Exists(HttpContext.Current.Server.MapPath("~/App_Data/elbuzZipPhotos.zip")))
                {
                    FileHelpers.UnZipFile(HttpContext.Current.Server.MapPath("~/App_Data/elbuzZipPhotos.zip"),
                                          HttpContext.Current.Server.MapPath("~/pictures_elbuz"));
                }
            }
            if (!FileUpload1.HasFile)
            {
                MsgErr(Resource.Admin_ImportXLS_ChooseFile);
                return;
            }

            if (ImportPropertiesElbuzCsvStatistic.IsRun == false)
            {
                ImportPropertiesElbuzCsvStatistic.Init();
                ImportPropertiesElbuzCsvStatistic.IsRun = true;
                linkCancel.Visible = true;
                MsgErr(true);

                lblRes.Text = "";

                var boolSuccess = true;

                try
                {
                    if (Directory.Exists(_filePath) == false)
                    {
                        Directory.CreateDirectory(_filePath);
                    }

                    if (File.Exists(_fullPath))
                    {
                        File.Delete(_fullPath);
                    }
                }
                catch (Exception ex)
                {
                    MsgErr(ex.Message + " at Files");
                    boolSuccess = false;
                }

                if (boolSuccess == false)
                {
                    return;
                }
                pUploadExcel.Visible = false;
                // Save file

                FileUpload1.SaveAs(_fullPath);
                var tr = new Thread(ProcessData);
                ImportPropertiesElbuzCsvStatistic.ThreadImport = tr;
                tr.Start();

                pUploadExcel.Visible = false;

                OutDiv.Visible = true;
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
        }
    }