示例#1
0
        /// <summary>
        /// commit changes that made to data sources
        /// </summary>
        internal void Commit()
        {
            SourcesSyncStatus sourcesSyncStatus = ApplicationSourcesManager.GetInstance().SourcesSyncStatus;

            if (_convertCommandList.Count > 0)
            {
                // It is about to start committing the tables. So save the status. If process get terminated during commit,
                // in next execution, client will get to know the status of data sources synchronization and take action accordingly.
                // This flag will be set to false after commiting sources successfully.
                sourcesSyncStatus.TablesIncompatibleWithDataSources = true;
                sourcesSyncStatus.SaveToFile();
            }

            try
            {
                foreach (IConvertCommand command in _convertCommandList)
                {
                    command.Execute();
                }
            }
            catch (Exception e)
            {
                String errorMessage = ClientManager.Instance.getMessageString(MsgInterface.RC_ERROR_INCOMPATIBLE_DATASOURCES);
                throw new InvalidSourcesException(errorMessage, e);
            }
        }
示例#2
0
        /// <summary> Loads the first response for executing the first program from the local file. </summary>
        private void ExecuteInitialRequest()
        {
            // Before starting the execution, check if any failure was occurred during updating the local data in last execution
            SourcesSyncStatus sourcesSyncStatus = ApplicationSourcesManager.GetInstance().SourcesSyncStatus;

            if (sourcesSyncStatus.TablesIncompatibleWithDataSources == true)
            {
                // structures of tables in local database does not match with their sources
                String errorMessage = ClientManager.Instance.getMessageString(MsgInterface.RC_ERROR_INCOMPATIBLE_DATASOURCES);
                throw new InvalidSourcesException(errorMessage, null);
            }
            else if (sourcesSyncStatus.InvalidSources == true)
            {
                // sources are not synchronized
                String errorMessage = ClientManager.Instance.getMessageString(MsgInterface.RC_ERROR_OFFLINE_NEXT_EXECUTION_INVALID_SOURCES);
                throw new InvalidSourcesException(errorMessage, null);
            }

            String initialResponseString = GetLastOfflineInitialResponse();

            FlowMonitorQueue.Instance.enable(false);
            ClientManager.Instance.ProcessResponse(initialResponseString, 0, new OpeningTaskDetails(), null);
        }