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 ENTAuditData().Insert(db, ObjectName, RecordId, PropertyName, OldValue, NewValue, Convert.ToByte(AuditType), userAccountId); } else { //Update if (!new ENTAuditData().Update(db, ID, ObjectName, RecordId, PropertyName, OldValue, NewValue, Convert.ToByte(AuditType), 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 eNTAudit = new ENTAuditData().Select(id); MapEntityToProperties(eNTAudit); return(eNTAudit != null); }