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 PTOVacationBankData().Insert(db, ENTUserAccountId, VacationYear, PersonalDays, VacationDays, userAccountId); } else { //Update if (!new PTOVacationBankData().Update(db, ID, ENTUserAccountId, VacationYear, PersonalDays, VacationDays, 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 pTOVacationBank = new PTOVacationBankData().Select(id); MapEntityToProperties(pTOVacationBank); return(true); }
public static ArrayList GetDistinctYears() { var years = new ArrayList(); var ptoYears = new PTOVacationBankData().SelectDistinctYears(); foreach (var ptoYear in ptoYears) { years.Add(ptoYear.VacationYear); } return(years); }
public void Load(int userAccountId, short year) { var pTOVacationBank = new PTOVacationBankData().SelectByUserAccountIdYear(userAccountId, year); MapEntityToProperties(pTOVacationBank); }