/// <summary> /// fetch-and-compute loop /// </summary> /// <returns></returns> private bool FindMatchingRecord() { bool recordFound = false; if (!StartPosition.IsZero) { GatewayResult result = TaskViews.OpenCursors(Reverse, StartPosition); if (result.Success) { IRecord record; // Looking for one record only do { record = GetBasicRecord(); if (record != null && RecordComputer.Compute(record, true, false, false).Success) { recordFound = true; break; } } while (record != null); } TaskViews.CloseMainCursor(); } return(recordFound); }
/// <summary> /// Build /// </summary> /// <returns></returns> internal override RecordComputer Build() { RecordComputer recordComputer = base.Build(); recordComputer.Add(new LocateNextComputeStrategy(StartPosition)); return(recordComputer); }
internal override ReturnResultBase Execute() { GatewayResult result = new GatewayResult(); RecordComputer recordComputer = TaskViews.RecordComputer; recordComputer.RecomputeUnit(UnitId, Record); return(result); }
public GatewayResult AddDataControlView(RuntimeReadOnlyView view, DcValuesBuilderBase dcValuesBuilder) { GatewayResult result = null; DataControlViews.Add(view); int boundControlId = ((DataControlSourceViewDefinition)view.DataSourceViewDefinition).BoundControlId; var dsId = view.DataSourceViewDefinition.TaskDataSource.DataSourceDefinition.Id; var strategy = new DataControlValuesComputeStrategy(boundControlId, dcValuesBuilder, view.RangeBuilder, dsId); var unitId = RecomputeIdFactory.GetRecomputeId(typeof(DcValues), boundControlId); RecordComputer.Add(unitId, strategy); result = view.OpenDataSource(); view.BuildCursor(); if (result.Success) { view.Prepare(); } return(result); }
/// <summary> /// Execute /// </summary> /// <returns></returns> internal override ReturnResultBase Execute() { ReturnResultBase result = new ReturnResult(); // initialize the start position from which next record to be located. initStartPosition(); //Build Record computer RecordComputerBuilder recordComputerBuilder = new LocateNextRecordComputerBuilder(StartPosition) { LocalDataviewManager = LocalDataviewManager, TaskViews = TaskViews }; recordComputer = recordComputerBuilder.Build(); //Locate Next record from current start position. base.Execute(); return(result); }
/// <summary> /// /// </summary> /// <returns></returns> internal override ReturnResultBase Execute() { IRangeDataBuilder origRangeDataBuilder = null; IFieldView fieldView = TaskViews.Fields[fieldId]; // Initialize the stuff needed to locate the right record if (!fieldView.IsVirtual && !fieldView.IsLink) { // set the range builder, which will pass the data to the gateway origRangeDataBuilder = TaskViews.ViewMain.RangeBuilder; TaskViews.ViewMain.RangeBuilder = new IncrementalLocateRangeDataBuilder(TaskViews.ViewMain.ViewBoundaries, minValue, fieldView); // use the base record computer - no need for extra computing after the fetch recordComputer = base.RecordComputer; } else { // the gateway will not compute it for us - need to use a special record computer RecordComputerBuilder recordComputerBuilder = new IncrementalLocateRecordComputerBuilder(fieldView, minValue) { LocalDataviewManager = LocalDataviewManager, TaskViews = TaskViews }; recordComputer = recordComputerBuilder.Build(); } TaskViews.ViewMain.CurrentCursor = TaskViews.ViewMain.LocateCursor; // try and get a matching record base.Execute(); TaskViews.ViewMain.CurrentCursor = TaskViews.ViewMain.defaultCursor; // restore ViewMain state if (origRangeDataBuilder != null) { TaskViews.ViewMain.RangeBuilder = origRangeDataBuilder; } return(new GatewayResult()); }
internal override ReturnResultBase Execute() { bool isEmptyDataView = ((DataView)(Task.DataView)).isEmptyDataview(); DataviewSynchronizer.SetupDataview(Reverse); IRecord origRecord = DataviewSynchronizer.GetCurrentRecord(); TaskViews.ViewMain.IgnorePositionCache = true; GatewayResult result = TaskViews.OpenCursors(Reverse, new DbPos(true)); if (result.Success) { IRecord record; while ((record = GetBasicRecord()) != null) { if (RecordComputer.Compute(record, true, false, false).Success) { //execute event OnRecordFetchEvent onRecordFetch((Record)record); DataviewSynchronizer.RemoveRecord(record); } } } TaskViews.CloseMainCursor(); TaskViews.ViewMain.IgnorePositionCache = false; if (origRecord != null) { DataviewSynchronizer.SetCurrentRecord(origRecord != null ? origRecord.getId() : Int32.MinValue); ((DataView)(Task.DataView)).takeFldValsFromCurrRec(); } ((DataView)(Task.DataView)).setEmptyDataview(isEmptyDataView); return(result); }
/// <summary> /// execute command /// </summary> internal override ReturnResultBase Execute() { DataviewSynchronizer.SetupDataview(Reverse); GatewayResult gatewayResult = SetupMainCursor(); ReturnResultBase result; int fetchedRecordNumber = 0; if (gatewayResult.Success) { for (fetchedRecordNumber = 0; !StopFetches(fetchedRecordNumber);) { IRecord record = GetBasicRecord(); if (record != null && RecordComputer.Compute(record, true, false, false).Success) { fetchedRecordNumber++; } } } else { UpdateViewEnd(gatewayResult); } TaskViews.CloseMainCursor(); //If PerformUpdateAfterFetch is false , the UpdateAterFetch () should be called only if recs are fetched. if (gatewayResult.Success && (PerformUpdateAfterFetch || fetchedRecordNumber > 0)) { result = UpdateAfterFetch(); } else { result = gatewayResult; } return(result); }
internal void SetLocateExpressionRecordComputer(RecordComputer recordComputer) { // This method should be called once only. Debug.Assert(LocateExpressionRecordComputer == null); LocateExpressionRecordComputer = recordComputer; }
internal void SetRecordsComputer(RecordComputer recordComputer) { // This method should be called once only. Debug.Assert(RecordComputer == null); RecordComputer = recordComputer; }