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