Esempio n. 1
0
        private static Product LoadProduct(DataRow dataRow, ProductTypeList productTypeList, BrandList brandList)
        {
            int         id      = Convert.ToInt32(dataRow["PID"]);
            int         typeID  = Convert.ToInt32(dataRow["ProductType"]);
            int         brandID = Convert.ToInt32(dataRow["Brand"]);
            string      name    = dataRow["ProductName"].ToString();
            string      remark  = dataRow["Remark"].ToString();
            ProductType type    = productTypeList.GetType(typeID);

            if (type == null)
            {
                Log.Write("LoadProduct failed. Can't find type:" + typeID.ToString());
                return(null);
            }
            Brand brand = brandList.GetBrand(brandID);

            if (brand == null)
            {
                Log.Write("LoadProduct failed. Can't find brand:" + brandID.ToString());
                return(null);
            }
            Product result = new Product(id, type, name, brand, remark);

            return(result);
        }
Esempio n. 2
0
 public BrandEditor(int brandId) : this()
 {
     _brand = BrandList.GetBrand(brandId);
 }