Пример #1
0
        private static void GetProCatInfo(System.Data.DataSet dataset, List <ProductEntity> list)
        {
            var rows = dataset.Tables[0].Rows;

            if (rows.Count > 2)
            {
                ProductCategoryProvider ProductCategory = new ProductCategoryProvider();
                for (var i = 2; i < rows.Count; i++)
                {
                    ProductEntity         entity   = new ProductEntity();
                    ProductCategoryEntity PCEntity = new ProductCategoryEntity();
                    var row = rows[i];
                    entity.SnNum = row[1].ToString();
                    if (string.IsNullOrEmpty(entity.SnNum))
                    {
                        continue;
                    }
                    entity.BarCode     = row[2].ToString();
                    entity.ProductName = row[3].ToString();
                    entity.CateName    = row[4].ToString();
                    PCEntity           = ProductCategory.GetSingleCateName(entity.CateName);
                    if (PCEntity.IsNotNull())
                    {
                        entity.CateNum = PCEntity.CateNum;
                    }
                    else
                    {
                        entity.CateNum = "";
                    }
                    entity.Num         = ConvertHelper.ToType <int>(row[5].ToString());
                    entity.MinNum      = ConvertHelper.ToType <int>(row[6].ToString());
                    entity.MaxNum      = ConvertHelper.ToType <int>(row[7].ToString());
                    entity.UnitName    = row[8].ToString();
                    entity.UnitNum     = entity.UnitNum;
                    entity.AvgPrice    = ConvertHelper.ToType <double>(row[9].ToString());
                    entity.InPrice     = ConvertHelper.ToType <double>(row[10].ToString());
                    entity.OutPrice    = ConvertHelper.ToType <double>(row[11].ToString());
                    entity.NetWeight   = ConvertHelper.ToType <double>(row[12].ToString());
                    entity.GrossWeight = ConvertHelper.ToType <double>(row[13].ToString());
                    entity.Remark      = row[14].ToString();

                    entity.IsDelete = (int)EIsDelete.NotDelete;

                    entity.CreateTime = DateTime.Now;
                    list.Add(entity);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 根据类别名称查询类别信息
        /// </summary>
        /// <param name="cateName"></param>
        /// <returns></returns>
        public ProductCategory_CE GetSingleCateName(string cateName)
        {
            if (cateName.IsEmpty())
            {
                return(null);
            }
            ProductCategoryProvider provider = new ProductCategoryProvider();
            ProductCategoryEntity   entity   = provider.GetSingleCateName(cateName);

            if (entity.IsNotNull())
            {
                ProductCategory_CE ce = ProductCategory_To.ToCE(entity);
                return(ce);
            }
            return(null);
        }