Exemplo n.º 1
0
        private static void AddActorToTitle(Dao.Title title, string actor, string role, PeopleRole type)
        {
            if (actor.Length > 255)
            {
                throw new FormatException("Actor must be 255 characters or less.");
            }
            if (role != null && role.Length > 255)
            {
                throw new FormatException("Role must be 255 characters or less.");
            }

            if (string.IsNullOrEmpty(actor))
            {
                return;
            }

            Dao.BioData bioData = Dao.TitleCollectionDao.GetPersonBioDataByName(actor);

            if (bioData == null)
            {
                bioData          = new OMLEngine.Dao.BioData();
                bioData.FullName = actor;
                Dao.DBContext.Instance.BioDatas.InsertOnSubmit(bioData);
                Dao.DBContext.Instance.SubmitChanges();
            }

            Dao.Person person = new OMLEngine.Dao.Person();
            person.MetaData      = bioData;
            person.CharacterName = role;
            person.Role          = (byte)type;
            title.People.Add(person);
        }
Exemplo n.º 2
0
        private static void AddActorToTitle(Dao.Title title, string actor, string role, PeopleRole type)
        {
            if (actor.Length > 255)
                throw new FormatException("Actor must be 255 characters or less.");
            if (role != null && role.Length > 255)
                throw new FormatException("Role must be 255 characters or less.");

            if (string.IsNullOrEmpty(actor))
                return;

            Dao.BioData bioData = Dao.TitleCollectionDao.GetPersonBioDataByName(actor);

            if (bioData == null)
            {
                bioData = new OMLEngine.Dao.BioData();
                bioData.FullName = actor;
                Dao.DBContext.Instance.BioDatas.InsertOnSubmit(bioData);
                Dao.DBContext.Instance.SubmitChanges();
            }

            Dao.Person person = new OMLEngine.Dao.Person();
            person.MetaData = bioData;
            person.CharacterName = role;
            person.Role = (byte)type;
            title.People.Add(person);
        }