Пример #1
0
        /// <summary>
        /// 导入总方法
        /// </summary>
        public void Import(BizProduct bizProduct, BizSupplier bizSupplier)
        {
            //1 读取Excel列表
            IList <Product> ProductsInExcel = ReadProductsFromExcel(CheckExcelFile());

            //2 检查图片是否存在
            CheckProductImages(ProductsInExcel);
            //检查数据库
            if (NeedCheckWithDB)
            {
                //1 检查 供应商是否存在
                IList <string>   supplierNameList = GetSupplierNameList(ProductsInExcel);
                IList <string>   supplierNameList_NotExists;
                IList <Supplier> supplierList = bizSupplier.GetListByNameList(supplierNameList, out supplierNameList_NotExists);

                if (supplierNameList_NotExists.Count > 0)
                {
                    foreach (string supplierName in supplierNameList_NotExists)
                    {
                        sbImportMsg.AppendLine("不存在该供应商:" + supplierName);
                    }
                    return;
                }
                //2 检查数据是否已经导入
                IList <Product> productsExisted;
                ProductsPassedDBCheck = bizProduct.CheckDB(ProductsHasImage, out productsExisted);
                ProductsExistedInDB   = productsExisted;
                foreach (Product productExist in ProductsExistedInDB)
                {
                    sbImportMsg.AppendLine("已存在该产品.供应商/型号:" + productExist.SupplierName + "/" + productExist.ModelNumber);
                }
            }
            //数据保存到数据库
            // bizProduct.SaveList(
        }
Пример #2
0
 public void ImportWithDBCheck(BizProduct bizProduct, BizSupplier bizSupplier)
 {
 }