/// <summary> /// /// This method will assign the Attribute values for a new DataRow /// created for their respective 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 PopulateProductGroup(WonkaProduct poProduct, int pnGroupId, Dictionary <int, string> poAttrValues) { WonkaPrdGroup TempPrdGroup = poProduct.ProductGroups[pnGroupId]; WonkaPrdGroupDataRow TempDataRow = TempPrdGroup.AppendRow(); var iAttrValueEnum = poAttrValues.GetEnumerator(); while (iAttrValueEnum.MoveNext()) { int nAttrId = iAttrValueEnum.Current.Key; string sAttrValue = iAttrValueEnum.Current.Value; WonkaRefAttr TempAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(nAttrId); if (TempAttribute.GroupId != pnGroupId) { continue; } TempDataRow.SetData(nAttrId, sAttrValue); } }
/// <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); } }