Exemple #1
0
        internal BusinessObjectActionReport <DataRepositoryActionStatus> DeleteTemporaryFiles(IUserBasic userBasic, FileType fileType)
        {
            BusinessObjectActionReport <DataRepositoryActionStatus> businessObjectActionReport = new BusinessObjectActionReport <DataRepositoryActionStatus>(DataRepositoryActionStatus.Success);
            int num = 0;

            try
            {
                using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext())
                {
                    num = dataStoreContext.cms_FilesTemp_DeleteByUserId(userBasic.UserId, fileType);
                }
            }
            catch (Exception ex)
            {
                _Log.Error("Error at cms_FilesTemp_DeleteByUserId", ex);
                throw new DataStoreException(ex, true);
            }
            if (num != -1002)
            {
                if (num != 0)
                {
                    businessObjectActionReport.Status = DataRepositoryActionStatus.SqlError;
                    _Log.ErrorFormat("Temporary profile images of user with id {0} were not deleted from the database (ErrorCode: {1}).", userBasic.UserId
                                     , num);
                }
            }
            else
            {
                businessObjectActionReport.Status = DataRepositoryActionStatus.NoRecordRowAffected;
                _Log.ErrorFormat("Temporary profile images of user with id {0} were not deleted from the database (ErrorCode: {1}).", userBasic.UserId
                                 , num);
            }
            return(businessObjectActionReport);
        }