Example #1
0
        /// <summary>
        /// Gets the DC values object, whose identifier is 'id', from the data view.
        /// </summary>
        /// <param name="id">The identifier of the DC values object.</param>
        /// <returns>Returns the DC values, whose identifier is 'id', if found.
        /// If 'id' is not found - the method returns null</returns>
        internal DcValues GetDcValues(DataControlRangeDataCollection dcValuesRange)
        {
            int id;

            if (DataviewManager.TryGetDcValuesIsByRange(dcValuesRange, out id))
            {
                return(Dataview.getDcValues(id));
            }
            else
            {
                return(null);
            }
        }
        internal override UnitComputeResult Compute(IRecord record, bool checkRange, bool recompute, bool computeInitExpressions)
        {
            var rangeData = new DataControlRangeDataCollection(rangeDataSourceId, dcValuesRangeBuilder, boundControlId);
            var dcv       = (DataviewSynchronizer.GetDcValues(rangeData));

            if (dcv == null)
            {
                // The range does not exist in the map - need to create a new DcValues object.
                dcv = dcValuesBuilder.Build();
                DataviewSynchronizer.AddDcValues(dcv, rangeData);
            }

            DataviewSynchronizer.ApplyDcValues(dcv, record, boundControlId);
            return(new UnitComputeResult());
        }
Example #3
0
        /// <summary>
        /// Add new dcValues , set dcValues reference to control and refresh the control.
        /// </summary>
        /// <param name="dcValues"></param>
        /// <param name="rangeData"></param>
        /// <param name="control"></param>
        internal void ApplyDCValuesAndRefreshControl(DcValues dcValues, DataControlRangeDataCollection rangeData, MgControlBase control)
        {
            //add new DC values collection
            DataviewManager.DataviewSynchronizer.AddDcValues(dcValues, rangeData);

            //set dc values reference
            Task.SetDataControlValuesReference(control.getDitIdx(), dcValues.getId());

            //Update DCValRef of every record after fetching the dataControl values.
            for (int i = 0; i < ((DataView)Task.DataView).getSize(); i++)
            {
                ((DataView)Task.DataView).getRecByIdx(i).AddDcValuesReference(control.getDitIdx(), dcValues.getId());
            }

            //Update DCValRef of original record.
            ((DataView)Task.DataView).getOriginalRec().AddDcValuesReference(control.getDitIdx(), dcValues.getId());

            control.RefreshDisplay();
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        internal override ReturnResultBase Execute()
        {
            LocalDataviewManager localDataViewManager = Task.DataviewManager.LocalDataviewManager;

            RuntimeReadOnlyView dataControlView = localDataViewManager.TaskViews.GetDataControlViewByBoundControlId(control.getDitIdx());

            DataSourceId dataSourceId = dataControlView.DataSourceViewDefinition.TaskDataSource.DataSourceDefinition.Id;

            DataControlRangeDataCollection rangeData = new DataControlRangeDataCollection(dataSourceId, dataControlView.RangeBuilder, control.getDitIdx());

            //remove old DataControlRangeDataCollection entry from map.
            localDataViewManager.rangeToDcValuesMap.Remove(rangeData);

            //build new DC values for control
            LocallyComputedDcValuesBuilder dcValuesBuilder = new LocallyComputedDcValuesBuilder(dataControlView);
            var dataControlValues = dcValuesBuilder.Build();

            localDataViewManager.DataviewSynchronizer.ApplyDCValuesAndRefreshControl(dataControlValues, rangeData, control);

            return(new ReturnResult());
        }
Example #5
0
 /// <summary>
 /// Adds the dcValues object to the data view's DC values collection.
 /// </summary>
 /// <param name="dcValues">Object to be added to the data view.</param>
 internal void AddDcValues(DcValues dcValues, DataControlRangeDataCollection dcValuesRange)
 {
     Dataview.AddDcValues(dcValues);
     DataviewManager.MapDcValues(dcValuesRange, dcValues.getId());
 }