public override bool Load(int id) { //Get the entity object from the DAL. ENTNotificationENTUserAccount eNTNotificationENTUserAccount = new ENTNotificationENTUserAccountData().Select(id); MapEntityToProperties(eNTNotificationENTUserAccount); return(eNTNotificationENTUserAccount != null); }
public override bool Save(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors, int userAccountId) { if (DBAction == DBActionEnum.Save) { //Validate the object Validate(db, ref validationErrors); //Check if there were any validation errors if (validationErrors.Count == 0) { if (IsNewRecord()) { //Add ID = new ENTNotificationENTUserAccountData().Insert(db, ENTNotificationId, ENTUserAccountId, userAccountId); foreach (ENTNotificationENTWFStateEO notificationState in _notificationStates) { notificationState.ENTNotificationENTUserAccountId = ID; } } else { //Update if (!new ENTNotificationENTUserAccountData().Update(db, ID, ENTNotificationId, ENTUserAccountId, userAccountId, Version)) { UpdateFailed(ref validationErrors); return(false); } } //Delete all the states associated with this user _notificationStates.Delete(db, ID); //Add the states that were selected. return(_notificationStates.Save(db, ref validationErrors, userAccountId)); } else { //Didn't pass validation. return(false); } } else { throw new Exception("DBAction not Save."); } }