public WonkaPrdGroupDataRow(WonkaRefGroup poGroup) { GroupId = poGroup.GroupId; GroupName = poGroup.GroupName; MasterGroup = poGroup; AttrIds = WonkaRefEnvironment.GetInstance().IdXref.GroupIdToAttrIds[poGroup.GroupId]; if (this.MasterGroup.IsSequenced) { GroupSeqAttrId = WonkaRefEnvironment.GetInstance().GetGroupSeqAttrId(MasterGroup.GroupId); // NOTE: Should KeyAttrIds be required for a group? //if (!WonkaRefEnvironment.GetInstance().IdXref.GroupIdToKeyAttrIds.ContainsKey(poGroup.GroupId)) // throw new Exception("ERROR! No keys found for the group with ID(" + poGroup.GroupId + ")"); if (WonkaRefEnvironment.GetInstance().IdXref.GroupIdToKeyAttrIds.ContainsKey(poGroup.GroupId)) { KeyAttrIds = WonkaRefEnvironment.GetInstance().IdXref.GroupIdToKeyAttrIds[poGroup.GroupId]; } } else { GroupSeqAttrId = 0; } Key = new WonkaPrdGroupDataRowKey(this); }
/// <summary> /// /// This method will find the DataRow within this Group that matches the provided Key (if it exists). /// /// <param name="poSoughtRowKey">The Key of the Row that we are interested in finding</param> /// <returns>The DataRow that matches the provided Key</returns> /// </summary> internal WonkaPrdGroupDataRow GetRow(WonkaPrdGroupDataRowKey poSoughtRowKey) { int nRowIndex = GetRowIndex(poSoughtRowKey); if (nRowIndex != -1) { return(GetRow(nRowIndex)); } else { throw new Exception("ERROR! WonkaPrdGroup::GetRow(WonkaPrdGroupDataRowKey) -> Key not found."); } }
/// <summary> /// /// This method will find the index of the DataRow within this Group that matches the provided Key (if it exists). /// /// <param name="poSoughtRowKey">The Key of the Row that we are interested in finding</param> /// <returns>Index of the DataRow that matches the provided Key</returns> /// </summary> internal int GetRowIndex(WonkaPrdGroupDataRowKey poSoughtRowKey) { int nTmpRowIndex = 0; int nRowIndex = -1; for (nTmpRowIndex = 0; nTmpRowIndex < this.DataRowVector.Count; ++nTmpRowIndex) { if (this.DataRowVector[nTmpRowIndex].GetKey() == poSoughtRowKey) { nRowIndex = nTmpRowIndex; } } return(nRowIndex); }