Пример #1
0
        internal BusinessObjectActionReport <DataRepositoryActionStatus> Delete(CMSContentRating cmsContentRating)
        {
            BusinessObjectActionReport <DataRepositoryActionStatus> businessObjectActionReport = new BusinessObjectActionReport <DataRepositoryActionStatus>(DataRepositoryActionStatus.Success);

            businessObjectActionReport.ValidationResult = BusinessObjectManager.Validate(cmsContentRating);
            if (businessObjectActionReport.ValidationResult.IsValid)
            {
                int num = 0;
                try
                {
                    using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext())
                    {
                        num = dataStoreContext.cms_ContentRatings_Delete(cmsContentRating.CMSUserId, cmsContentRating.CMSContentId);
                    }
                }
                catch (Exception ex)
                {
                    _Log.Error("Error at cms_ContentRatings_Delete", ex);
                    throw new DataStoreException(ex, true);
                }
                if (num != 0)
                {
                    businessObjectActionReport.Status = DataRepositoryActionStatus.SqlError;
                    _Log.WarnFormat("CMSContentRating {0} was not deleted from the database (ErrorCode: {1})."
                                    , DebugUtility.GetObjectString(cmsContentRating), num);
                }
            }
            else
            {
                businessObjectActionReport.Status = DataRepositoryActionStatus.ValidationFailed;
                _Log.WarnFormat("CMSContentRating {0} was not deleted from the database because the validation failed.\nReport: {1}"
                                , DebugUtility.GetObjectString(cmsContentRating)
                                , businessObjectActionReport.ValidationResult.ToString(TextFormat.ASCII));
            }
            return(businessObjectActionReport);
        }