Ejemplo n.º 1
0
        internal BusinessObjectActionReport <DataRepositoryActionStatus> Delete(CMSContentUser cmsContentUser)
        {
            BusinessObjectActionReport <DataRepositoryActionStatus> businessObjectActionReport = new BusinessObjectActionReport <DataRepositoryActionStatus>(DataRepositoryActionStatus.Success);

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