예제 #1
0
        private void HandleLevels(AbsRowData rowdata, SourceMappingsElement item, List <KeyValuePair <T, T> > retlist)
        {
            for (var i = 0; i < item.Labels.Length; i++)
            {
                var dimension = _schema.Dimensions[item.Labels[i]];

                if (dimension.TypeOf == DimensionType.Date)
                {
                    var dtDimension = (DimensionDateTime <T>)dimension;
                    var value       = ((DateTime?)rowdata[item.Field]).Value;
                    T   segment     = DateTimeMemberGenerator.TransformToDateId <T>(value, dtDimension.DateLevel);

                    KeyValuePair <T, T> pair = new KeyValuePair <T, T>(dimension.ID, segment);
                    retlist.Add(pair);

                    if (!dtDimension.Members.ContainsKey(segment))
                    {
                        dtDimension.Members.Add(new Member <T>
                        {
                            ID   = segment,
                            Name = DateTimeMemberGenerator.GetLevelName(value, dtDimension.DateLevel)
                        });
                    }
                }
            }
        }
예제 #2
0
        private void HandleSimpleDimension(AbsRowData rowdata, SourceMappingsElement item, List <KeyValuePair <T, T> > retlist)
        {
            Dimension <T> dimension = _schema.Dimensions[item.Dimension];
            T             segment   = (T)Convert.ChangeType(rowdata[item.Field], typeof(T));

            if (dimension.Members.ContainsKey(segment))
            {
                KeyValuePair <T, T> pair = new KeyValuePair <T, T>(dimension.ID, segment);
                retlist.Add(pair);
            }
        }