private void detach_T_NotificationUsers(T_NotificationUser entity) { this.SendPropertyChanging(); entity.aspnet_User = null; }
private void attach_T_NotificationUsers(T_NotificationUser entity) { this.SendPropertyChanging(); entity.T_NotificationType = this; }
partial void DeleteT_NotificationUser(T_NotificationUser instance);
partial void UpdateT_NotificationUser(T_NotificationUser instance);
partial void InsertT_NotificationUser(T_NotificationUser instance);
public void AddDeleteNotificationToUser(Guid userID, int notificationID, bool flagAdd) { using (EngageCCTDataClassesDataContext dc = new EngageCCTDataClassesDataContext()) { aspnet_User asp_User = dc.aspnet_Users.SingleOrDefault(a => a.UserId == userID); if (asp_User == null) { throw new ApplicationException("There are no this User"); } T_NotificationType t_Ntype = dc.T_NotificationTypes.SingleOrDefault(n => n.TypeID == notificationID); if (t_Ntype == null) { throw new ApplicationException("There are no this notification"); } T_NotificationUser t_userN = dc.T_NotificationUsers.SingleOrDefault(un => un.UserID == userID && un.TypeID == notificationID); if (t_userN == null && flagAdd == true) { t_userN = new T_NotificationUser() { UserID = userID, TypeID = notificationID }; dc.T_NotificationUsers.InsertOnSubmit(t_userN); dc.SubmitChanges(); } if (t_userN != null && flagAdd == false) { dc.T_NotificationUsers.DeleteOnSubmit(t_userN); dc.SubmitChanges(); } } }