/// <summary> /// /// This method will compare two Groups to see if they are equal. It will compare /// them by finding a corresponding DataRow within ThisGroup and ThatGroup, based /// on the key. /// /// NOTE: This Group (i.e., the left-hand data row) usually represents incoming/new data /// /// NOTE: Currently, it doesn't compare them exactly. It just ensures that /// the contents of 'r1' are the same in 'r2', implying that 'r2' can be a /// superset of 'r1'. /// /// <param name="ThatGroup">The right-hand data row (usually representing old data from persistence/storage)</param> /// <returns>Bool that indicates whether or not the two Groups are equal</returns> public bool Equals(WonkaPrdGroup poThatGroup) { foreach (WonkaPrdGroupDataRow ThisRow in this) { int nThatRowIndex = poThatGroup.GetRowIndex(ThisRow.GetKey()); if (nThatRowIndex != -1) { if (ThisRow != poThatGroup.GetRow(nThatRowIndex)) { return(false); } } else { return(false); } } return(true); }
/// <summary> /// /// This method will assign the Attribute values specifically to the first DataRow /// of their respective Group. /// /// NOTE: This method will nullify Attributes only for the first DataRow of the Group. /// /// <param name="poProduct">The Product that we are assigning these Attribute values</param> /// <param name="poAttrValues">The Attribute values that we are going to set inside the provided Product</param> /// <returns>None</returns> /// </summary> public static void PopulateProduct(WonkaProduct poProduct, Dictionary <int, string> poAttrValues) { var iAttrValueEnum = poAttrValues.GetEnumerator(); while (iAttrValueEnum.MoveNext()) { int nAttrId = iAttrValueEnum.Current.Key; string sAttrValue = iAttrValueEnum.Current.Value; WonkaRefAttr TempAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(nAttrId); WonkaPrdGroup TempPrdGroup = poProduct.ProductGroups[TempAttribute.GroupId]; if (TempPrdGroup.GetRowCount() <= 0) { TempPrdGroup.AppendRow(); } WonkaPrdGroupDataRow GrpDataRow = TempPrdGroup.GetRow(0); GrpDataRow.SetData(nAttrId, sAttrValue); } }