Example
- Last UpdatedAug 26, 2016
- 1 minute read
The following sample C# code illustrates how to define, query, and use the wwMaterialDB object to populate a list of ingredients.
This example bypasses the use of the wwMaterials collection.
private void QueryMats()
{
wwMaterialDBClass mdbc = new wwMaterialDBClass();
wwMaterialUnits MatUnits=null;
wwMaterials mats;
wwMaterial Material;
if (MatStatus.GetMaterialType() == "Ingradiants" mdbc.QueryMaterialsByType(wwMtrlTypeEnum.wwTypeIngredient);
mdbc.QueryMaterialsById(MatStatus.GetMaterialId())
mats = (wwMaterials)mdbc.Materials;
if (mats.Count != 0)
{
Material = (wwMaterial)mats.Item(1);
Material.QueryMaterialUnits();
MatUnits = (wwMaterialUnits)Material.MaterialUnits;
}
}