Example #1
0
        /// <summary>
        /// Build the ranges using the unique key segments.
        /// </summary>
        /// <param name="record"></param>
        /// <param name="runtimeCursor"></param>
        /// <returns></returns>
        private void BuildRanges(RecordForDataViewToDataSource record, RuntimeCursor runtimeCursor)
        {
            int recordFieldIndex = 0;

            if (uniqueKey != null)
            {
                runtimeCursor.RuntimeCursorData.Ranges = new List <RangeData>();

                foreach (DBSegment segment in uniqueKey.Segments)
                {
                    for (int fldIndex = 0; fldIndex < destinationColumnList.Count; fldIndex++)
                    {
                        DBField dbField = destinationColumnList[fldIndex];

                        if (dbField.Equals(segment.Field))
                        {
                            RangeData rngData = new RangeData();
                            rngData.FieldIndex = dbField.IndexInRecord;

                            rngData.Max.Type    = RangeType.RangeParam;
                            rngData.Max.Discard = false;

                            rngData.Min.Type    = RangeType.RangeParam;
                            rngData.Min.Discard = false;

                            FieldValue fieldValue = new FieldValue();
                            destinationToSourceFieldIndexMapping.TryGetValue(dbField.Name, out recordFieldIndex);
                            fieldValue.Value = record.GetFieldValue(recordFieldIndex);

                            rngData.Max.Value = fieldValue;
                            rngData.Min.Value = fieldValue;

                            runtimeCursor.RuntimeCursorData.Ranges.Add(rngData);
                            break;
                        }
                    }
                }
            }
        }