コード例 #1
0
ファイル: BizCrudFuntion.cs プロジェクト: diegosal/Servicio
 /// <summary>
 /// Bizs the insert supplier.
 /// </summary>
 /// <param name="bizSupplier">The biz supplier.</param>
 /// <returns>System.String.</returns>
 public string BizInsertSupplier(BizSupplier bizSupplier)
 {
     return(BizCall(
                new Action(() =>
     {
         crudFuntion.InsertSupplier(bizSupplier);
     }
                           )
                ));
 }
コード例 #2
0
ファイル: BizCrudFuntion.cs プロジェクト: diegosal/Servicio
 /// <summary>
 /// Bizs the update supplier.
 /// </summary>
 /// <param name="bizSupplier">The biz supplier.</param>
 /// <returns>System.String.</returns>
 public string BizUpdateSupplier(BizSupplier bizSupplier)
 {
     return(BizCall(
                new Action(() =>
     {
         crudFuntion.UpdateSupplier(bizSupplier);
     }
                           )
                ));
 }
コード例 #3
0
ファイル: BaseAdapter.cs プロジェクト: diegosal/Servicio
        /// <summary>
        /// Datas the supplier to biz supplier.
        /// </summary>
        /// <param name="DataSupplier">The data supplier.</param>
        /// <returns>BizSupplier.</returns>
        public static BizSupplier DataSupplierToBizSupplier(this SYSGetCatSupplier_Result DataSupplier)
        {
            BizSupplier bizSupplier = new BizSupplier
            {
                Id           = DataSupplier.Id,
                SupplierName = DataSupplier.SupplierName,
                ContactNumer = DataSupplier.ContactNumer,
                Active       = DataSupplier.Active,
            };

            return(bizSupplier);
        }
コード例 #4
0
ファイル: BaseAdapter.cs プロジェクト: diegosal/Servicio
        /// <summary>
        /// Bizs the supplier to web supplier.
        /// </summary>
        /// <param name="DataSupplier">The data supplier.</param>
        /// <returns>WebSupplier.</returns>
        public static WebSupplier BizSupplierToWebSupplier(this BizSupplier DataSupplier)
        {
            WebSupplier webSupplier = new WebSupplier
            {
                Id           = DataSupplier.Id,
                SupplierName = DataSupplier.SupplierName,
                ContactNumer = DataSupplier.ContactNumer,
                Active       = DataSupplier.Active,
            };

            return(webSupplier);
        }
コード例 #5
0
ファイル: SingleFolderImport.cs プロジェクト: phiree/NTSBase
 public void ImportWithDBCheck(BizProduct bizProduct, BizSupplier bizSupplier)
 {
 }
コード例 #6
0
ファイル: SingleFolderImport.cs プロジェクト: phiree/NTSBase
        /// <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(
        }
コード例 #7
0
ファイル: CheckFormatTest.cs プロジェクト: phiree/NTSBase2
        private void CheckSingleFolder2Test(
            string folderName
           , int amountProductsHasPicture
           , int amountProductNotHasPicture
           , int amountProductExistsInDb
           , int amountImagesHasNotProduct
           , bool needCheckDataBase
           , DALProduct dalProduct
           , DALSupplier dalSupplier
            , IFormatSerialNoPersistent ifsp
            , DalBase<Product> dalBaseProduct)
        {
            string folderFullPath = Environment.CurrentDirectory + "\\TestFiles\\FormatCheck\\" + folderName + "\\";
            SingleFolderImport checker = new SingleFolderImport(folderFullPath);
            BizProduct bizP = new BizProduct();
            bizP.DalProduct = dalProduct;
            bizP.DalBase = dalBaseProduct;
            BizSupplier bizS = new BizSupplier();
            bizS.DalSupplier = dalSupplier;
            bizP.DalSupplier = dalSupplier;
            checker.NeedCheckWithDB = needCheckDataBase;
            checker.Import(bizP, bizS, ifsp);

            IList<Product> productsHasPicture = checker.ProductsPassedDBCheck
                          , productsNotHasPicture = checker.ProductsNotHasImage
                          , productsExistedInDB = checker.ProductsExistedInDB;
            IList<FileInfo> imagesHasProduct = checker.ImagesHasProduct
                          , imagesHasNotProduct = checker.ImagesNotHasProduct;

            // Assert.AreEqual("Success", FormatChecker.Check(folderContainsExcelAndImages));
            Assert.AreEqual(amountProductsHasPicture, checker.ProductsPassedDBCheck.Count);
            Assert.AreEqual(amountProductNotHasPicture, checker.ProductsNotHasImage.Count);
            Assert.AreEqual(amountProductExistsInDb, checker.ProductsExistedInDB.Count);
            Assert.AreEqual(amountImagesHasNotProduct, checker.ImagesNotHasProduct.Count);
            DateTime beginSaveResult = DateTime.Now;
            string saveFolder = Environment.CurrentDirectory + "\\TestFiles\\FormatCheck\\检测结果\\";
            string saveFolderOfSupplier;
            if (productsHasPicture.Count > 0) saveFolderOfSupplier = bizS.GetByCode(productsHasPicture[0].SupplierCode).Name;
            else if (productsNotHasPicture.Count > 0) saveFolderOfSupplier = bizS.GetByCode(productsNotHasPicture[0].SupplierCode).Name;
            else throw new Exception();

            DirectoryInfo dirOfSavedSupplier = new DirectoryInfo(saveFolder + "合格数据\\" + saveFolderOfSupplier + "\\");
            if (dirOfSavedSupplier.Exists)
            {
                dirOfSavedSupplier.Delete(true);
            }
            string supplierName = string.Empty;
            if (productsExistedInDB.Count > 0) supplierName = bizS.GetByCode(productsExistedInDB[0].SupplierCode).Name;
            else if (productsHasPicture.Count > 0) supplierName = bizS.GetByCode(productsHasPicture[0].SupplierCode).Name;
            else if (productsNotHasPicture.Count > 0) supplierName = bizS.GetByCode(productsNotHasPicture[0].SupplierCode).Name;
            else
            {
                return;
            }
            supplierName = StringHelper.ReplaceInvalidChaInFileName(supplierName, string.Empty);
            checker.HandlerCheckResult(
                supplierName,
                 saveFolder,
                 WebProductImagesPath
                 );

            Assert.AreEqual(productsHasPicture.Count, dirOfSavedSupplier.GetImageFiles().ToArray().Length);

            Console.WriteLine("Time Cost CheckImage:" + (DateTime.Now - beginSaveResult).TotalSeconds);
        }
コード例 #8
0
ファイル: SingleFolderImport.cs プロジェクト: phiree/NTSBase2
        private IList<string> GetSupplierCodeList(IList<Product> products,BizSupplier bizSupplier)
        {
            IList<string> supplierCodeList = new List<string>();
            foreach (Product p in products)
            {

                if (!supplierCodeList.Contains(p.SupplierCode))
                {
                    supplierCodeList.Add(p.SupplierCode);
                }
            }
            return supplierCodeList;
        }
コード例 #9
0
ファイル: SingleFolderImport.cs プロジェクト: phiree/NTSBase2
        /// <summary>
        /// 导入总方法
        /// </summary>
        public void Import(BizProduct bizProduct, BizSupplier bizSupplier,IFormatSerialNoPersistent formatSerialnoPersisitent)
        {
            //1 读取Excel列表
            IList<Product> ProductsInExcel = ReadProductsFromExcel(CheckExcelFile());
            //2 检查图片是否存在
            CheckProductImages(ProductsInExcel);
            //检查数据库
            if (NeedCheckWithDB)
            {
                //1 检查 供应商是否存在
                IList<string> supplierCodeList = GetSupplierCodeList(ProductsInExcel,bizSupplier);
                IList<string> supplierCodeList_NotExists;
                IList<Supplier> supplierList = bizSupplier.GetListByCodeList(supplierCodeList, out supplierCodeList_NotExists);

                if (supplierCodeList_NotExists.Count > 0)
                {
                    foreach (string supplierCode in supplierCodeList_NotExists)
                    {
                        sbImportMsg.AppendLine("不存在该供应商:" + supplierCode);
                    }
                    return;
                }

                //2 检查数据是否已经导入  && 更新产品的供应商信息
                IList<Product> productsExisted;
                ProductsPassedDBCheck = bizProduct.CheckSupplierExisted(ProductsHasImage, out productsExisted);
                ProductsExistedInDB = productsExisted;
                foreach (Product productExist in ProductsExistedInDB)
                {
                    sbImportMsg.AppendLine("已存在该产品.供应商/型号:"+bizSupplier.GetByCode(productExist. SupplierCode).Name+"/"+productExist.ModelNumber);
                }
            }
            //数据保存到数据库-- 分配NTS编码
            FormatSerialNoUnit serialNoMgr=new FormatSerialNoUnit(formatSerialnoPersisitent);

            foreach(Product p in ProductsPassedDBCheck)
            {
                 p.NTSCode=serialNoMgr.GetFormatedSerialNo(p.CategoryCode+"."+p.SupplierCode );
            }

            bizProduct.SaveList(ProductsPassedDBCheck);
            serialNoMgr.Save();

            //图片复制至web的虚拟路径,  不合格数据拷贝
        }