public virtual void Visit(DimensionWholePartHierarchy dimensionWholePartHierarchy) { int depth = dimensionWholePartHierarchy.Members.Min(z => z.Level); ExtendedHierarchyMember rootExtendedHierarchyMember = dimensionWholePartHierarchy.Members.FirstOrDefault(x => x.Level == depth); List <ExtendedHierarchyMember> childExtendedHierarchyMembers = dimensionWholePartHierarchy.Members.Where(x => x.Level == depth + 1).ToList(); List <GLRecord> gLRecords = data.Where(x => childExtendedHierarchyMembers.Select(z => z.Id).Contains(x.GLMembers.Get(SegmentID))).ToList(); Dictionary <int, int> childrenOperators = new Dictionary <int, int>(); childExtendedHierarchyMembers.ForEach(x => { childrenOperators.Add(x.Id, Utility.GetMemberOperator(x.Operator)); }); if (gLRecords != null && gLRecords.Count > 0) { foreach (GLRecord gLRecord in gLRecords) { string newUniqueKey = Utility.GetGLUniqueKey(gLRecord, VisitorType.Segment, rootExtendedHierarchyMember.Id, SegmentID); GLRecord objGLRecord = data.FirstOrDefault(x => x.UniqueKey == newUniqueKey); if (objGLRecord == null) { objGLRecord = gLRecord.CloneObjectSerializable <GLRecord>(); foreach (KeyValuePair <int, GLRecordAmount> gLRecordAmount in objGLRecord.Values.Amounts) { gLRecordAmount.Value.Mtd = 0; gLRecordAmount.Value.Qtd = 0; gLRecordAmount.Value.Ytd = 0; } objGLRecord.GLMembers.AddOrUpdate(SegmentID, rootExtendedHierarchyMember.Id); data.Add(objGLRecord); } int Operator = childrenOperators[gLRecord.GLMembers.Get(SegmentID)]; foreach (KeyValuePair <int, GLRecordAmount> cell in gLRecord.Values.Amounts) { GLRecordAmount existingRecordAmount = objGLRecord.Values.Amounts.FirstOrDefault(x => x.Key == cell.Key).Value; GLRecordAmount gLRecordAmount = new GLRecordAmount(existingRecordAmount.Mtd + (cell.Value.Mtd * Operator), existingRecordAmount.Qtd + (cell.Value.Qtd * Operator), existingRecordAmount.Ytd + (cell.Value.Ytd * Operator)); objGLRecord.Values.AddOrUpdate(cell.Key, null, (updated) => { return(gLRecordAmount); }); } } } }
public override void Visit(DimensionWholePartHierarchy dimensionWholePartHierarchy) { }