public Product(ProductType type, string name, Brand brand, string remark) { ID = -1; Type = type; Name = name; Brand = brand; Remark = remark; }
private static ProductType LoadProductType(DataRow dataRow) { int id = Convert.ToInt32(dataRow["PID"]); string name = dataRow["ProductType"].ToString(); int parentID = Convert.ToInt32(dataRow["ParentPID"]); ProductType productType = new ProductType(id, name, parentID); return productType; }
public bool AddProductType(string typeName, int parentID) { int id = DBAccessor.AddProductType(typeName, parentID); if (id == -1) { return false; } ProductType type = new ProductType(id, typeName, parentID); productTypeList.AddType(type); return true; }
public void RemoveType(ProductType type) { Types.Remove(type); }
public void AddType(ProductType type) { Types.Add(type); }
public ProductType GetType(string typeName) { ProductType result = Types.Find(type => type.Name == typeName); return(result); }
public ProductType GetType(int id) { ProductType result = Types.Find(type => type.ID == id); return(result); }
public void DeleteProductType(ProductType type) { productTypeList.RemoveType(type); DBAccessor.DeleteProductType(type.ID); }