private void btnImport_Click(object sender, System.EventArgs e)
        {
            if (!this.CheckItems())
            {
                return;
            }
            string            text          = this.dropFiles.SelectedValue;
            string            text2         = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(text));
            ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            int               value         = this.dropCategories.SelectedValue.Value;
            int               value2        = this.dropProductLines.SelectedValue.Value;
            int?              selectedValue = this.dropBrandList.SelectedValue;
            ProductSaleStatus saleStatus    = ProductSaleStatus.OnStock;

            text = System.IO.Path.Combine(this._dataPath, text);
            if (!System.IO.File.Exists(text))
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
                return;
            }
            importer.PrepareDataFiles(new object[]
            {
                text
            });
            text2 = text2.ToLower().Replace("cpage\\supplier\\" + Hidistro.Membership.Context.HiContext.Current.User.UserId, "data");
            object[] array = importer.ParseProductData(new object[]
            {
                text2
            });
            Methods.Supplier_PtImportProducts((System.Data.DataTable)array[0], value, value2, selectedValue, saleStatus, false);
            System.IO.File.Delete(text);
            System.IO.Directory.Delete(text2, true);
            this.BindFiles();
            this.ShowMsg("此次商品批量导入操作已成功!", true);
        }
Example #2
0
        private void PrepareZipFile(string filename)
        {
            if (string.IsNullOrEmpty(filename) || filename.Length == 0)
            {
                this.chkFlag.Checked = false;
                this.txtPTXml.Text   = string.Empty;
                return;
            }
            filename = System.IO.Path.Combine(this._dataPath, filename);
            if (!System.IO.File.Exists(filename))
            {
                this.chkFlag.Checked = false;
                this.txtPTXml.Text   = string.Empty;
                return;
            }
            ImportAdapter importer = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            string        text     = importer.PrepareDataFiles(new object[]
            {
                filename
            });

            object[] array = importer.ParseIndexes(new object[]
            {
                text
            });
            this.lblVersion.Text             = (string)array[0];
            this.lblQuantity.Text            = array[1].ToString();
            this.chkIncludeCostPrice.Checked = (bool)array[2];
            this.chkIncludeStock.Checked     = (bool)array[3];
            this.chkIncludeImages.Checked    = (bool)array[4];
            this.txtPTXml.Text   = (string)array[5];
            this.chkFlag.Checked = true;
        }
Example #3
0
 private void PrepareZipFile(string filename)
 {
     if (string.IsNullOrEmpty(filename) || (filename.Length == 0))
     {
         chkFlag.Checked = false;
         txtPTXml.Text   = string.Empty;
     }
     else
     {
         filename = Path.Combine(_dataPath, filename);
         if (!File.Exists(filename))
         {
             chkFlag.Checked = false;
             txtPTXml.Text   = string.Empty;
         }
         else
         {
             ImportAdapter importer = TransferHelper.GetImporter(dropImportVersions.SelectedValue, new object[0]);
             string        str      = importer.PrepareDataFiles(new object[] { filename });
             object[]      objArray = importer.ParseIndexes(new object[] { str });
             lblVersion.Text             = (string)objArray[0];
             lblQuantity.Text            = objArray[1].ToString();
             chkIncludeCostPrice.Checked = (bool)objArray[2];
             chkIncludeStock.Checked     = (bool)objArray[3];
             chkIncludeImages.Checked    = (bool)objArray[4];
             txtPTXml.Text   = (string)objArray[5];
             chkFlag.Checked = true;
         }
     }
 }
Example #4
0
 private void btnImport_Click(object sender, System.EventArgs e)
 {
     if (this.CheckItems())
     {
         string            selectedValue = this.dropFiles.SelectedValue;
         string            path          = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue));
         ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
         int               categoryId    = this.dropCategories.SelectedValue.Value;
         int?              brandId       = this.dropBrandList.SelectedValue;
         ProductSaleStatus delete        = ProductSaleStatus.Delete;
         if (this.radInStock.Checked)
         {
             delete = ProductSaleStatus.OnStock;
         }
         if (this.radUnSales.Checked)
         {
             delete = ProductSaleStatus.UnSale;
         }
         if (this.radOnSales.Checked)
         {
             delete = ProductSaleStatus.OnSale;
         }
         selectedValue = System.IO.Path.Combine(this._dataPath, selectedValue);
         if (!System.IO.File.Exists(selectedValue))
         {
             this.ShowMsg("选择的数据包文件有问题!", false);
         }
         else
         {
             importer.PrepareDataFiles(new object[] { selectedValue });
             try
             {
                 ProductHelper.ImportProducts((System.Data.DataTable)importer.ParseProductData(new object[] { path })[0], categoryId, 0, brandId, delete, false);
                 System.IO.File.Delete(selectedValue);
                 System.IO.Directory.Delete(path, true);
                 this.BindFiles();
                 this.ShowMsg("此次商品批量导入操作已成功!", true);
             }
             catch
             {
                 System.IO.File.Delete(selectedValue);
                 System.IO.Directory.Delete(path, true);
                 this.ShowMsg("选择的数据包文件有问题!", false);
             }
         }
     }
 }
Example #5
0
        private void btnImport_Click(object sender, System.EventArgs e)
        {
            if (!this.CheckItems())
            {
                return;
            }
            string            text          = this.dropFiles.SelectedValue;
            string            text2         = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(text));
            ImportAdapter     importer      = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]);
            int               value         = this.dropCategories.SelectedValue.Value;
            int               value2        = this.dropProductLines.SelectedValue.Value;
            int?              selectedValue = this.dropBrandList.SelectedValue;
            ProductSaleStatus saleStatus    = ProductSaleStatus.Delete;

            if (this.radInStock.Checked)
            {
                saleStatus = ProductSaleStatus.OnStock;
            }
            if (this.radUnSales.Checked)
            {
                saleStatus = ProductSaleStatus.UnSale;
            }
            if (this.radOnSales.Checked)
            {
                saleStatus = ProductSaleStatus.OnSale;
            }
            text = System.IO.Path.Combine(this._dataPath, text);
            if (!System.IO.File.Exists(text))
            {
                this.ShowMsg("选择的数据包文件有问题!", false);
                return;
            }
            importer.PrepareDataFiles(new object[]
            {
                text
            });
            object[] array = importer.ParseProductData(new object[]
            {
                text2
            });
            ProductHelper.ImportProducts((System.Data.DataTable)array[0], value, value2, selectedValue, saleStatus, true);
            System.IO.File.Delete(text);
            System.IO.Directory.Delete(text2, true);
            this.BindFiles();
            this.ShowMsg("此次商品批量导入操作已成功!", true);
        }
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (CheckItems())
     {
         string            selectedValue = dropFiles.SelectedValue;
         string            path          = Path.Combine(_dataPath, Path.GetFileNameWithoutExtension(selectedValue));
         ImportAdapter     importer      = TransferHelper.GetImporter(dropImportVersions.SelectedValue, new object[0]);
         int               categoryId    = dropCategories.SelectedValue.Value;
         int               lineId        = dropProductLines.SelectedValue.Value;
         int?              brandId       = dropBrandList.SelectedValue;
         ProductSaleStatus delete        = ProductSaleStatus.Delete;
         if (radInStock.Checked)
         {
             delete = ProductSaleStatus.OnStock;
         }
         if (radUnSales.Checked)
         {
             delete = ProductSaleStatus.UnSale;
         }
         if (radOnSales.Checked)
         {
             delete = ProductSaleStatus.OnSale;
         }
         selectedValue = Path.Combine(_dataPath, selectedValue);
         if (!File.Exists(selectedValue))
         {
             ShowMsg("选择的数据包文件有问题!", false);
         }
         else
         {
             importer.PrepareDataFiles(new object[] { selectedValue });
             ProductHelper.ImportProducts((DataTable)importer.ParseProductData(new object[] { path })[0], categoryId, lineId, brandId, delete);
             if (chkDeleteFiles.Checked)
             {
                 File.Delete(selectedValue);
                 Directory.Delete(path, true);
             }
             BindFiles();
             ShowMsg("此次商品批量导入操作已成功!", true);
         }
     }
 }