示例#1
0
 protected void btnGoodsNumberImport_Click(object sender, EventArgs e)
 {
     this.strSavePath = this.path.Value;
     if (File.Exists(this.strSavePath))
     {
         if (this.bolMainIndex)
         {
             DataTable dtGoods     = DataExcelInfo.CheckGoodsNumDataExcel(this.strSavePath);
             DataTable dtGoodsCopy = this.CheckGoodsNumData(dtGoods, true, this._UserShopID);
             if (DataExcelInfo.GoodsImportNums(dtGoodsCopy, this._UserID, this._UserShopID))
             {
                 base.OutputWarn("恭喜您,导入商品库存成功!");
                 this.strSavePath  = "";
                 this.bolMainIndex = false;
             }
             else
             {
                 File.Delete(this.strSavePath);
                 base.OutputWarn("导入商品库存失败,请再次检验并改正商品数据!");
             }
         }
         else
         {
             File.Delete(this.strSavePath);
             base.OutputWarn("您导入的商品库存数据还没有检验成功,请通过检验再导入商品数据。");
         }
     }
     else
     {
         base.OutputWarn("您还没有检验商品库存数据,请先检验数据");
     }
 }
示例#2
0
        protected void btnGoodsNumberCheck_Click(object sender, EventArgs e)
        {
            string strUploadPath = this.fileUploadGoodsNumber.FileName;

            this.strSavePath = base.Server.MapPath("~/Upload/Goods/GoodsNumber" + DateTime.Now.ToString("yyMMddHHmmssffff") + ".xls");
            this.path.Value  = this.strSavePath;
            if (strUploadPath == "")
            {
                base.OutputWarn("请先选择Excel文件。");
            }
            else
            {
                string strFileFix = Path.GetExtension(strUploadPath).ToLower();
                if (strFileFix != ".xls")
                {
                    base.OutputWarn("选择文件的文件格式错误,请重新选择Excel文件。");
                }
                else
                {
                    if (!Directory.Exists(base.Server.MapPath("~/Upload/Goods")))
                    {
                        Directory.CreateDirectory(base.Server.MapPath("~/Upload/Goods"));
                    }
                    if (File.Exists(this.strSavePath))
                    {
                        File.Delete(this.strSavePath);
                    }
                    this.fileUploadGoodsNumber.PostedFile.SaveAs(this.strSavePath);
                }
                if (File.Exists(this.strSavePath))
                {
                    DataTable dtGoods     = DataExcelInfo.CheckGoodsNumDataExcel(this.strSavePath);
                    DataTable dtGoodsCopy = this.CheckGoodsNumData(dtGoods, false, this._UserShopID);
                    this.GridView1.Visible    = true;
                    this.gvErrorGoods.Visible = false;
                    this.Get_ParameterList(dtGoodsCopy);
                    if (dtGoodsCopy.Rows.Count <= 0 && dtGoods.Rows.Count > 0)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "message", "<Script Language='JavaScript' defer>art.dialog({title: '系统提示',time: 2,content:'您提交的商品库存数据检验通过,请导入商品库存信息。',close: function () {  }});</script>");
                        this.bolMainIndex = true;
                    }
                }
                else
                {
                    File.Delete(this.strSavePath);
                    base.OutputWarn("商品库存数据有错误,请改正。");
                }
            }
        }