Example #1
0
        public TaskQueueData GetTaskEnd(IAsyncResult ar)
        {
            bool bResult = false;

            if (ErrorTypes.NoError == m_GetTask.m_eError)
            {
                try
                {
                    if (null != m_GetTask.m_delegateNonQuery)
                    {
                        if (m_GetTask.m_delegateNonQuery.EndInvoke(ar) > 0)
                        {
                            bResult = true;
                        }
                        else
                        {
                            bResult = false;
                        }
                    }
                    m_GetTask.Close();
                }
                catch (Exception e)
                {
                    _log.Error("Exception cathed in GetTaskEnd:", e);
                    m_GetTask.Dispose();
                }
            }
            return((bResult) ? m_GetTask.m_oTaskQueueData : null);
        }
 public ErrorTypes ReadFileEnd(IAsyncResult ar, out int nReadWriteBytes)
 {
     nReadWriteBytes = 0;
     try
     {
         nReadWriteBytes = m_oReadFile.m_nTotalReadWriteBytes;
         m_oReadFile.Close();
     }
     catch
     {
         m_oReadFile.m_eError = ErrorTypes.StorageRead;
         m_oReadFile.Dispose();
     }
     return(m_oReadFile.m_eError);
 }
 public ErrorTypes RemoveTaskEnd(IAsyncResult ar)
 {
     if (ErrorTypes.NoError == m_oRemoveTask.m_eError)
     {
         try
         {
             m_oRemoveTask.m_delegateRemover.EndInvoke(ar);
             m_oRemoveTask.Close();
         }
         catch
         {
             m_oRemoveTask.Dispose();
         }
     }
     return(ErrorTypes.NoError);
 }
 public ErrorTypes WriteFileEnd(IAsyncResult ar, out int nReadWriteBytes)
 {
     nReadWriteBytes = 0;
     try
     {
         m_oWriteFile.m_oS3Client.EndPutObject(ar);
         nReadWriteBytes = m_oWriteFile.m_nReadWriteBytes;
         m_oWriteFile.Close();
     }
     catch
     {
         m_oWriteFile.m_eError = ErrorTypes.StorageWrite;
         m_oWriteFile.Dispose();
     }
     return(m_oWriteFile.m_eError);
 }
        public ErrorTypes AddTaskEnd(IAsyncResult ar)
        {
            ErrorTypes eResult = m_oAddTask.m_eError;

            if (ErrorTypes.NoError == m_oAddTask.m_eError)
            {
                try
                {
                    m_oAddTask.m_delegateAdder.EndInvoke(ar);
                    m_oAddTask.Close();
                }
                catch
                {
                    m_oAddTask.Dispose();
                }
            }
            return(eResult);
        }
 public ErrorTypes WriteFileEnd(IAsyncResult ar, out int nReadWriteBytes)
 {
     nReadWriteBytes = 0;
     if (ErrorTypes.NoError == m_oWriteFile.m_eError)
     {
         try
         {
             m_oWriteFile.m_oOutput.EndWrite(ar);
             nReadWriteBytes = m_oWriteFile.m_aBuffer.Length;
             m_oWriteFile.Close();
         }
         catch
         {
             m_oWriteFile.Dispose();
         }
     }
     return(m_oWriteFile.m_eError);
 }
        public TaskQueueData GetTaskEnd(IAsyncResult ar)
        {
            TaskQueueData oTaskQueueDate = null;

            if (ErrorTypes.NoError == m_oGetTask.m_eError)
            {
                try
                {
                    if (null != m_oGetTask.m_delegateGetter)
                    {
                        oTaskQueueDate = m_oGetTask.m_delegateGetter.EndInvoke(ar);
                    }
                    m_oGetTask.Close();
                }
                catch
                {
                    m_oGetTask.Dispose();
                }
            }
            return(oTaskQueueDate);
        }
Example #8
0
 private void AddRandomKeyCallback(IAsyncResult ar)
 {
     try
     {
         bool bExist = false;
         try
         {
             m_oAddRandomKey.m_delegateNonQuery.EndInvoke(ar);
             if (null != m_oAddRandomKey.m_oCommand)
             {
                 m_oAddRandomKey.m_oCommand.Dispose();
                 m_oAddRandomKey.m_oCommand = null;
             }
         }
         catch
         {
             bExist = true;
         }
         if (bExist)
         {
             string sNewKey = m_oAddRandomKey.m_oTast.sKey + "_" + m_oRandom.Next(mc_nRandomMaxNumber);
             m_oAddRandomKey.m_oTast.sKey = sNewKey;
             IDbCommand oSelCommand = m_oAddRandomKey.m_oSqlCon.CreateCommand();
             m_oAddRandomKey.m_oCommand         = oSelCommand;
             oSelCommand.CommandText            = GetINSERTString(m_oAddRandomKey.m_oTast);
             m_oAddRandomKey.m_delegateNonQuery = new ExecuteNonQuery(oSelCommand.ExecuteNonQuery);
             m_oAddRandomKey.m_delegateNonQuery.BeginInvoke(AddRandomKeyCallback, null);
         }
         else
         {
             m_oAddRandomKey.Close();
             m_oAddRandomKey.FireCallback();
         }
     }
     catch
     {
         m_oAddRandomKey.DisposeAndCallback();
     }
 }
 public ErrorTypes RemovePathEnd(IAsyncResult ar)
 {
     try
     {
         if (m_oRemoveDirectory.m_oListObjectsResponse.S3Objects.Count > 0)
         {
             using (Amazon.S3.Model.DeleteObjectsResponse oDeleteObjectsResponse = m_oRemoveDirectory.m_oS3Client.EndDeleteObjects(ar))
             {
                 if (oDeleteObjectsResponse.DeletedObjects.Count != m_oRemoveDirectory.m_oListObjectsResponse.S3Objects.Count)
                 {
                     m_oRemoveDirectory.m_eError = ErrorTypes.StorageRemoveDir;
                 }
             }
         }
         m_oRemoveDirectory.Close();
     }
     catch
     {
         m_oRemoveDirectory.m_eError = ErrorTypes.StorageRemoveDir;
         m_oRemoveDirectory.Dispose();
     }
     return(m_oRemoveDirectory.m_eError);
 }
 public ErrorTypes RemovePathEnd(IAsyncResult ar)
 {
     if (ErrorTypes.NoError == m_oRemovePath.m_eError)
     {
         try
         {
             if (null != m_oRemovePath.m_delegateDirectoryDelete)
             {
                 m_oRemovePath.m_delegateDirectoryDelete.EndInvoke(ar);
             }
             else if (null != m_oRemovePath.m_delegateFileDelete)
             {
                 m_oRemovePath.m_delegateFileDelete.EndInvoke(ar);
             }
             m_oRemovePath.Close();
         }
         catch
         {
             m_oRemovePath.Dispose();
         }
     }
     return(m_oRemovePath.m_eError);
 }
Example #11
0
 public ErrorTypes GetOrCreateEnd(IAsyncResult ar, out TaskResultData oDataAdded, out bool bCreate)
 {
     bCreate    = m_oGetOrCreate.m_bCreate;
     oDataAdded = null;
     if (ErrorTypes.NoError == m_oGetOrCreate.m_eError)
     {
         try
         {
             if (null != m_oGetOrCreate.m_delegateReader)
             {
                 using (IDataReader oReader = m_oGetOrCreate.m_delegateReader.EndInvoke(ar))
                 {
                     if (true == oReader.Read())
                     {
                         m_oGetOrCreate.m_oTast = new TaskResultData();
                         TaskResultFromReader(m_oGetOrCreate.m_oTast, oReader);
                     }
                     else
                     {
                         m_oGetOrCreate.m_eError = ErrorTypes.TaskResult;
                     }
                 }
             }
             m_oGetOrCreate.Close();
             if (null != m_oGetOrCreate.m_oTast)
             {
                 oDataAdded = m_oGetOrCreate.m_oTast.Clone();
             }
         }
         catch (Exception e)
         {
             _log.Error("Exception catch in GetOrCreateEnd:", e);
             m_oGetOrCreate.Dispose();
         }
     }
     return(m_oGetOrCreate.m_eError);
 }