コード例 #1
0
ファイル: RoleEntity.cs プロジェクト: MichelZ/TVJunkie
        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;
        }
コード例 #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[] {  } );
     }
 }
コード例 #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;
 }
コード例 #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
 }