public virtual void Visit(DimensionMember dimensionMember)
        {
            List <T2>       ancestors = memberAncestors.Where(x => x.AncestorId == dimensionMember.Member.Id).ToList();
            List <GLRecord> gLRecords = data.Where(x => ancestors.Select(z => z.Id).Contains(x.GLMembers.Get(SegmentID))).ToList();

            if (gLRecords != null && gLRecords.Count > 0)
            {
                foreach (GLRecord gLRecord in gLRecords)
                {
                    string   newUniqueKey = Utility.GetGLUniqueKey(gLRecord, VisitorType.Segment, dimensionMember.Member.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, dimensionMember.Member.Id);
                        data.Add(objGLRecord);
                    }
                    T2 ancestor = ancestors.FirstOrDefault(x => x.Id == 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 * ancestor.Operator),
                                                                                 existingRecordAmount.Qtd + (cell.Value.Qtd * ancestor.Operator),
                                                                                 existingRecordAmount.Ytd + (cell.Value.Ytd * ancestor.Operator));
                        objGLRecord.Values.AddOrUpdate(cell.Key, null, (updated) => { return(gLRecordAmount); });
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void Visit(DimensionMember dimensionMember)
 {
 }