Exemplo n.º 1
0
        public static int Add(int personId, string roleFirstName, string roleLastName, string roleFullName)
        {
            if (string.IsNullOrEmpty(roleFullName))
            {
                roleFullName = string.Empty;
                if (!string.IsNullOrEmpty(roleFirstName))
                {
                    roleFullName = roleFirstName;
                }

                if (!string.IsNullOrEmpty(roleLastName))
                {
                    roleFullName = string.Format("{0} {1}", roleFullName, roleLastName);
                }
            }

            var entity = new RoleEntity { PersonId = personId, FirstName = roleFirstName, LastName = roleLastName, FullName = roleFullName };
            var filter = new PredicateExpression { RoleFields.FirstName == roleFirstName, RoleFields.LastName == roleLastName, RoleFields.FullName == roleFullName, RoleFields.PersonId == personId };

            return Database.AddOrUpdateEntity(entity, filter, false).RoleId;
        }
Exemplo n.º 2
0
 /// <summary> setups the sync logic for member _role</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRole(IEntityCore relatedEntity)
 {
     if(_role!=relatedEntity)
     {
         DesetupSyncRole(true, true);
         _role = (RoleEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _role, new PropertyChangedEventHandler( OnRolePropertyChanged ), "Role", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticArtworkToRoleRelations.RoleEntityUsingRoleIdStatic, true, new string[] {  } );
     }
 }
Exemplo n.º 3
0
 /// <summary> Removes the sync logic for member _role</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncRole(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _role, new PropertyChangedEventHandler( OnRolePropertyChanged ), "Role", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticArtworkToRoleRelations.RoleEntityUsingRoleIdStatic, true, signalRelatedEntity, "ArtworkToRoles", resetFKFields, new int[] { (int)ArtworkToRoleFieldIndex.RoleId } );
     _role = null;
 }
Exemplo n.º 4
0
 protected ArtworkToRoleEntity(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if(SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _artwork = (ArtworkEntity)info.GetValue("_artwork", typeof(ArtworkEntity));
         if(_artwork!=null)
         {
             _artwork.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _role = (RoleEntity)info.GetValue("_role", typeof(RoleEntity));
         if(_role!=null)
         {
             _role.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }