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);
        }
Example #2
0
        /// <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);
        }