/// <summary> /// /// This method will iterate through a list of Products and apply the default value to every instance /// of an empty Attribute (i.e., in every DataRow of its Group). /// /// <param name="poProducts">The product list that we are iterating through</param> /// <param name="poDefaultValues">The default values for Attributes</param> /// <returns>None</returns> /// </summary> public static void ApplyDefaults(List <WonkaProduct> poProducts, Dictionary <int, string> poDefaultValues) { foreach (WonkaProduct TempProduct in poProducts) { var iDefaultValEnumerator = poDefaultValues.GetEnumerator(); while (iDefaultValEnumerator.MoveNext()) { int nDefaultAttrId = iDefaultValEnumerator.Current.Key; string sDefaultAttrValue = iDefaultValEnumerator.Current.Value; WonkaRefAttr TempAttr = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(nDefaultAttrId); WonkaPrdGroup TargetGroup = TempProduct.GetProductGroup(TempAttr.GroupId); foreach (WonkaPrdGroupDataRow TempDataRow in TargetGroup) { string sTempValue = TempDataRow[TempAttr.AttrId]; if (String.IsNullOrEmpty(sTempValue)) { TempDataRow.SetData(TempAttr.AttrId, sDefaultAttrValue); } } } } }
public void DeleteRows() { foreach (WonkaPrdGroupDataRow TempDataRow in DataRowVector) { TempDataRow.ClearData(); } DataRowVector.Clear(); }
/// <summary> /// /// This method will detect if all DataRows contained in this Group are considered 'null' (i.e., empty of values). /// /// <returns>Bool that indicates if there are any rows present inside the Group that are not null</returns> /// </summary> public bool IsNull() { if (GetRowCount() == 0) { return(true); } foreach (WonkaPrdGroupDataRow TempDataRow in DataRowVector) { if (!TempDataRow.IsNull()) { return(false); } } return(true); }