/// <summary> /// Execute File delete gateway command. /// </summary> /// <returns></returns> internal override ReturnResultBase Execute() { ReturnResultBase result = new ReturnResult(); bool exist = false; int dataSourceNumber = clientDbDelCommand.DataSourceNumber; string dataSourceName = clientDbDelCommand.DataSourceName; DataSourceDefinition dataSourceDefintion = ClientManager.Instance.LocalManager.ApplicationDefinitions.DataSourceDefinitionManager.GetDataSourceDefinition(Task.getCtlIdx(), dataSourceNumber); //If Wrong Data Source Number is Given if (dataSourceDefintion == null) { Logger.Instance.WriteExceptionToLog("ClientDbDel - Invalid Data Source Number"); result = new ReturnResult(MsgInterface.STR_CLIENT_DB_DEL_OPERATION_FAILED); } else { if (string.IsNullOrEmpty(dataSourceName)) { dataSourceName = dataSourceDefintion.Name; } //Check for Table exist or not. if (dataSourceDefintion.CheckExist == 'N') { exist = true; } else { GatewayCommandFileExist dbFileExistCommand = GatewayCommandsFactory.CreateFileExistCommand(dataSourceName, dataSourceDefintion, LocalDataviewManager.LocalManager); result = dbFileExistCommand.Execute(); exist = result.Success; } //If Table exists then go for file delete operation. if (exist) { GatewayCommandFileDelete dbDeleteCommand = GatewayCommandsFactory.CreateFileDeleteCommand(dataSourceName, dataSourceDefintion, LocalDataviewManager.LocalManager); if (!dbDeleteCommand.Execute().Success) { Logger.Instance.WriteExceptionToLog("ClientDbDel - Cannot delete Table"); result = new ReturnResult(MsgInterface.STR_CLIENT_DB_DEL_OPERATION_FAILED); } } else { Logger.Instance.WriteExceptionToLog(string.Format("ClientDbDel - {0}", result.ErrorDescription)); result = new ReturnResult(MsgInterface.STR_CLIENT_DB_DEL_OPERATION_FAILED); } } return(result); }
public void Execute() { Logger.Instance.WriteSupportToLog("DeleteCommand.Execute():>>>>> ", true); Logger.Instance.WriteSupportToLog(string.Format("DeleteCommand.Execute(): deleting table {0}", dataSourceDefinition.Name), true); GatewayCommandFileDelete fileDeleteCommand = GatewayCommandsFactory.CreateFileDeleteCommand(dataSourceDefinition.Name, dataSourceDefinition, ClientManager.Instance.LocalManager); GatewayResult result = fileDeleteCommand.Execute(); if (!result.Success && result.ErrorCode != GatewayErrorCode.FileNotExist) { throw new DataSourceConversionFailedException(dataSourceDefinition.Name, result.ErrorDescription); } Logger.Instance.WriteSupportToLog("DeleteCommand.Execute():<<<< ", true); }