﻿//------------------------------------------------------------------------------
// <auto-generated>
//     Ce code a été généré par un outil.
//     Version du runtime :
//
//     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
//     le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TheSaucisseFactory.Services
{
    using CodeFluent.Runtime;
    using CodeFluent.Runtime.Utilities;
    
    
    // CodeFluent Entities generated .
    [System.CodeDom.Compiler.GeneratedCodeAttribute("CodeFluent Entities", "1.0.01234.05678")]
    public partial class IllustrationService : TheSaucisseFactory.Services.IIllustrationService
    {
        
        public virtual string Validate(TheSaucisseFactory.Illustration illustration, string culture)
        {
            System.Globalization.CultureInfo cultureInfo = ConvertUtilities.ToCultureInfo(culture);
            TheSaucisseFactory.Illustration illustration1 = illustration;
            if ((illustration1 == null))
            {
                return default(string);
            }
            return illustration1.Validate(cultureInfo);
        }
        
        public virtual bool Delete(TheSaucisseFactory.Illustration illustration)
        {
            TheSaucisseFactory.Illustration illustration1 = illustration;
            if ((illustration1 == null))
            {
                return CodeFluentPersistence.DefaultBooleanValue;
            }
            return illustration1.Delete();
        }
        
        public virtual TheSaucisseFactory.Illustration Load(System.Guid id)
        {
            return TheSaucisseFactory.Illustration.Load(id);
        }
        
        public virtual TheSaucisseFactory.Illustration LoadById(System.Guid id)
        {
            return TheSaucisseFactory.Illustration.LoadById(id);
        }
        
        public virtual bool Save(TheSaucisseFactory.Illustration illustration)
        {
            TheSaucisseFactory.Illustration illustration1 = illustration;
            if ((illustration1 == null))
            {
                return CodeFluentPersistence.DefaultBooleanValue;
            }
            return illustration1.Save();
        }
        
        public virtual bool SaveByRef(ref TheSaucisseFactory.Illustration illustration)
        {
            TheSaucisseFactory.Illustration illustration1 = illustration;
            if ((illustration1 == null))
            {
                return CodeFluentPersistence.DefaultBooleanValue;
            }
            bool ret = illustration1.Save();
            illustration = illustration1;
            return ret;
        }
        
        public virtual TheSaucisseFactory.Illustration LoadByEntityKey(string key)
        {
            return TheSaucisseFactory.Illustration.LoadByEntityKey(key);
        }
        
        public virtual bool DeleteByKey(System.Guid id)
        {
            TheSaucisseFactory.Illustration illustration = TheSaucisseFactory.Illustration.Load(id);
            if ((illustration == null))
            {
                return CodeFluentPersistence.DefaultBooleanValue;
            }
            return illustration.Delete();
        }
        
        public virtual void SaveAll(TheSaucisseFactory.IllustrationCollection illustrationCollection)
        {
            TheSaucisseFactory.IllustrationCollection illustrationCollection1 = illustrationCollection;
            illustrationCollection1.SaveAll();
        }
        
        public virtual TheSaucisseFactory.IllustrationCollection PageLoadAll(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions)
        {
            return TheSaucisseFactory.IllustrationCollection.PageLoadAll(pageIndex, pageSize, pageOptions);
        }
        
        public virtual TheSaucisseFactory.IllustrationCollection LoadAll()
        {
            return TheSaucisseFactory.IllustrationCollection.LoadAll();
        }
        
        public virtual TheSaucisseFactory.IllustrationCollection PageLoadByChallenge(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, string challengeEntityKey)
        {
            if ((challengeEntityKey == null))
            {
                throw new System.ArgumentNullException("challengeEntityKey");
            }
            TheSaucisseFactory.Challenge challenge = TheSaucisseFactory.Challenge.LoadByEntityKey(challengeEntityKey);
            return TheSaucisseFactory.IllustrationCollection.PageLoadByChallenge(pageIndex, pageSize, pageOptions, challenge);
        }
        
        public virtual TheSaucisseFactory.IllustrationCollection LoadByChallenge(string challengeEntityKey)
        {
            if ((challengeEntityKey == null))
            {
                throw new System.ArgumentNullException("challengeEntityKey");
            }
            TheSaucisseFactory.Challenge challenge = TheSaucisseFactory.Challenge.LoadByEntityKey(challengeEntityKey);
            return TheSaucisseFactory.IllustrationCollection.LoadByChallenge(challenge);
        }
    }
}
