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;
 }
Beispiel #2
0
 public void RemoveProduct(Product product)
 {
     Products.Remove(product);
 }
Beispiel #3
0
 public void AddProduct(Product product)
 {
     Products.Add(product);
 }