Наследование: INotifyPropertyChanging, INotifyPropertyChanged
Пример #1
0
 /// <summary>
 /// Saves a badge as a new entry in the DB.
 /// </summary>
 /// <param name="badge">Badge object to add to the DB.</param>
 /// <returns>ID of the created badge on success, 0 on failure.</returns>
 public static int CreateNewBadge(Badge badge)
 {
     try
     {
         using (SqlConnection connection = ConnectionManager.GetConnection())
         {
             var data = new ActivEarthDataProvidersDataContext(connection);
             var badgeData = new BadgeDataProvider
             {
                 user_id = badge.UserID,
                 badge_level = (byte)badge.Level,
                 progress = (byte)badge.Progress,
                 statistic = (byte)badge.StatisticBinding
             };
             data.BadgeDataProviders.InsertOnSubmit(badgeData);
             data.SubmitChanges();
             return badgeData.id;
         }
     }
     catch (Exception)
     {
         return 0;
     }
 }
		private void detach_BadgeDataProviders(BadgeDataProvider entity)
		{
			this.SendPropertyChanging();
			entity.UserDataProvider = null;
		}
 partial void DeleteBadgeDataProvider(BadgeDataProvider instance);
 partial void UpdateBadgeDataProvider(BadgeDataProvider instance);
 partial void InsertBadgeDataProvider(BadgeDataProvider instance);