Exemplo n.º 1
0
		private void detach_Buggs_Users1(Buggs_User entity)
		{
			this.SendPropertyChanging();
			entity.User1 = null;
		}
Exemplo n.º 2
0
		private void attach_Buggs_Users1(Buggs_User entity)
		{
			this.SendPropertyChanging();
			entity.User1 = this;
		}
Exemplo n.º 3
0
 partial void DeleteBuggs_User(Buggs_User instance);
Exemplo n.º 4
0
 partial void UpdateBuggs_User(Buggs_User instance);
Exemplo n.º 5
0
 partial void InsertBuggs_User(Buggs_User instance);
Exemplo n.º 6
0
        /// <summary>
        /// Associate a user with a Bugg.
        /// </summary>
        /// <param name="Bugg">The Bugg to associate the user with.</param>
        /// <param name="UserNameId">The id of a user to associate with the Bugg.</param>
        /// <returns>true if a new relationship was added, false otherwise.</returns>
        public bool LinkUserToBugg( Bugg Bugg, int UserNameId )
        {
            try
            {
                int BuggUserCount = BuggsDataContext.Buggs_Users.Where( BuggUserInstance => BuggUserInstance.BuggId == Bugg.Id && BuggUserInstance.UserNameId == UserNameId ).Count();
                if( BuggUserCount < 1 )
                {
                    Buggs_User NewBuggsUser = new Buggs_User();
                    NewBuggsUser.BuggId = Bugg.Id;
                    NewBuggsUser.UserNameId = UserNameId;

                    BuggsDataContext.Buggs_Users.InsertOnSubmit( NewBuggsUser );
                    return true;
                }
            }
            catch( Exception Ex )
            {
                Debug.WriteLine( "Exception in LinkCrashToBugg: " + Ex.ToString() );
            }

            return false;
        }