public override bool Save(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors, int userAccountId) { if (DbAction == DBActionEnum.Save) { Validate(db, ref validationErrors); if (validationErrors.Count == 0) { if (IsNewRecord()) { ID = new ENTRoleUserAccountData().Insert(db, ENTRoleId, ENTUserAccountId, userAccountId); } else { if (!new ENTRoleUserAccountData().Update(db, ID, ENTRoleId, ENTUserAccountId, userAccountId, Version)) { UpdateFailed(ref validationErrors); return(false); } } return(true); } else { return(false); } } else { throw new Exception("DB Action is not Save"); } }
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 (ID <= 0) { //Add ID = new ENTRoleUserAccountData().Insert(db, ENTRoleId, ENTUserAccountId, userAccountId); } else { //Update if (!new ENTRoleUserAccountData().Update(db, ID, ENTRoleId, ENTUserAccountId, userAccountId, Version)) { UpdateFailed(ref validationErrors); return(false); } } return(true); } //Didn't pass validation. return(false); } throw new Exception("DBAction not delete."); }
public override bool Load(int id) { //Get a data reader from the database. var userRole = new ENTRoleUserAccountData().Select(id); MapEntityToProperties(userRole); return(true); }
public override bool Load(int id) { var roleUserAccount = new ENTRoleUserAccountData().Select(id); if (roleUserAccount != null) { MapEntityToProperties(roleUserAccount); return(true); } else { return(false); } }