/// <summary> /// Open a Employee record from the database. /// </summary> /// <param name="Id">The id (primary key) of the Employee to open.</param> /// <remarks>Created: Werner Scheffer 24/07/2012</remarks> public override void OpenRecord(Int64 Id) { try { base.OpenRecord(Id); hrsEmployee = BL.HRS.HRS_Employee.Load(Id, DataContext); sysPerson = BL.SYS.SYS_Person.Load(hrsEmployee.PersonId.Value, DataContext); } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }
internal static String Save(DB.HRS_Employee entry, DataContext dataContext) { try { if (dataContext.EntityHumanResourcesContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached) { dataContext.EntityHumanResourcesContext.HRS_Employee.Add(entry); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
/// <summary> /// The binding source is bound to a new instance of an Employee. This is for the instances where a new record is to be created. /// </summary> /// <remarks>Created: Werner Scheffer 24/07/2012</remarks> protected override void OnNewRecord() { try { base.OnNewRecord(); hrsEmployee = BL.HRS.HRS_Employee.New; sysPerson = BL.SYS.SYS_Person.New; txtDateOfBirth.EditValue = DateTime.Now; } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }