public override bool Load(int id) { //Get the entity object from the DAL. var eNTAuditObject = new ENTAuditObjectData().Select(id); MapEntityToProperties(eNTAuditObject); _properties.Load(ID); return(eNTAuditObject != null); }
internal bool Load(HRPaidTimeOffDataContext db, string objectName) { //Get the entity object from the DAL. var eNTAuditObject = new ENTAuditObjectData().Select(db, objectName); MapEntityToProperties(eNTAuditObject); _properties.Load(db, ID); return(eNTAuditObject != 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 ENTAuditObjectData().Insert(db, ObjectName, ObjectFullyQualifiedName, userAccountId); //Add the ID to all the property objects foreach (ENTAuditObjectPropertyEO property in _properties) { property.ENTAuditObjectId = ID; } } else { //Update if (!new ENTAuditObjectData().Update(db, ID, ObjectName, ObjectFullyQualifiedName, userAccountId, Version)) { UpdateFailed(ref validationErrors); return(false); } //Delete the existing records for this object _properties.Delete(db, ID); } //Save the new settings _properties.Save(db, ref validationErrors, userAccountId); return(true); } //Didn't pass validation. return(false); } throw new Exception("DBAction not Save."); }