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 ENTWFItemStateHistoryData().Insert(db, ENTWFItemId, ENTWFStateId, ENTUserAccountId, userAccountId); } else { //Update if (!new ENTWFItemStateHistoryData().Update(db, ID, ENTWFItemId, ENTWFStateId, ENTUserAccountId, userAccountId, Version)) { UpdateFailed(ref validationErrors); return(false); } } return(true); } //Didn't pass validation. return(false); } throw new Exception("DBAction not Save."); }
public override bool Load(int id) { //Get the entity object from the DAL. var eNTWFItemStateHistory = new ENTWFItemStateHistoryData().Select(id); MapEntityToProperties(eNTWFItemStateHistory); return(true); }