Exemple #1
0
 public NModel.Terms.CompoundTerm DoAction(NModel.Terms.CompoundTerm action)
 {
     DoAction(action.Name);
     return null;
 }
        public void Export(IList<Product> products, string rootPathExport, string rootPathOriginal, NModel.Enums.ImageOutPutStratage stratage)
        {
            List<ImageExportModel> images = new List<ImageExportModel>();
            foreach (Product p in products)
            {

                if (p.ProductImageList.Count == 0)
                {
                    NLogger.Logger.Debug(string.Format("skip,({0})对应图片数量为0", p.NTSCode));
                    continue;
                }

                Stack<string> pathStacks = p.BuildImageOutputName(stratage);
                if (pathStacks.Count == 0)
                {
                    NLogger.Logger.Debug(string.Format("(skip,{0})生成路径节点为0", p.NTSCode));

                    continue;
                }
                string pathFromStack = string.Empty;//根据stack中的节点值 构建路径.

                switch (stratage)
                {
                    case NModel.Enums.ImageOutPutStratage.Category_NTsCode:
                        //获取分类的名称
                        string cc = pathStacks.Pop();
                        pathFromStack = "(" + cc + ")" + bizCate.GetCateName(cc);

                        break;
                    case NModel.Enums.ImageOutPutStratage.SupplierName_ModelNumber:
                    case NModel.Enums.ImageOutPutStratage.Supplier_OriginalName:
                        pathFromStack = pathStacks.Pop();
                        break;
                    default: throw new Exception("No Such Stratage");
                }
                string imageFileNew = pathStacks.Pop();
                string fullPath = rootPathExport + pathFromStack + "\\" + imageFileNew;

                foreach (ProductImage pi in p.ProductImageList)
                {

                    ImageExportModel iem =
                        new ImageExportModel
                        {
                            ImageName = rootPathOriginal + pi.ImageName
                            ,
                            TargetImageFullName = fullPath
                        };
                    images.Add(iem);
                }
            }
            NLibrary.NLogger.Logger.Debug("待拷贝图片数量" + images.Count);
            foreach (ImageExportModel iem in images)
            {

                if (System.IO.File.Exists(iem.ImageName))
                { IOHelper.EnsureFileDirectory(iem.TargetImageFullName);
                    System.IO.File.Copy(iem.ImageName, iem.TargetImageFullName, true);
                }
                else
                {
                    NLogger.Logger.Debug("图片不存在:"+iem.ImageName);
                }
            }
        }
Exemple #3
0
 public Product PopulateFromRowWithLanguage(DataRow row, NModel.Enums.LanguageType lang)
 {
     throw new NotImplementedException();
 }