protected override void _UpdateSaldo(EmployeeWeekTimePlanning entity, int lastSaldo, bool allin) { Debug.Assert(entity != null); if (entity != null) { int oldSaldo = entity.Saldo; base._UpdateSaldo(entity, lastSaldo, allin); if (oldSaldo != entity.Saldo) { UpdateEntity(entity); } } }
protected virtual void DoDeleteEntity(EmployeeWeekTimePlanning entity) { if (entity.IsNew) return; ServerEnvironment.EmployeeWeekTimePlanningService.Delete(entity); }
protected virtual void DoUpdateEntity(EmployeeWeekTimePlanning entity) { if (entity.IsNew) ServerEnvironment.EmployeeWeekTimePlanningService.Save(entity); else ServerEnvironment.EmployeeWeekTimePlanningService.Update(entity); //ServerEnvironment.EmployeeWeekTimePlanningService.SaveOrUpdate(entity); }
public void UpdateSaldoAfterPlanning(EmployeeWeek week) { EmployeeWeekTimePlanning entity = GetByDate(week.EmployeeId, week.BeginDate); if (entity == null) { entity = new EmployeeWeekTimePlanning(); EmployeeWeekProcessor.AssignTo(entity, week); UpdateEntity(entity); } else { if (EmployeeWeekProcessor.IsModified(entity, week)) { EmployeeWeekProcessor.AssignTo(entity, week); UpdateEntity(entity); } } UpdateSaldoFrom(week.EmployeeId, DateTimeHelper.GetNextMonday(week.BeginDate), week.Saldo); }
public void UpdateEntity(EmployeeWeekTimePlanning entity) { DoUpdateEntity(entity); }
public EmployeeWeekTimePlanning AssignTo(EmployeeWeekTimePlanning weekinfo) { if (weekinfo == null) throw new ArgumentNullException (); //weekinfo.ID = ID; weekinfo.WorkingHours = CountWeeklyWorkingHours ; weekinfo.ContractHours = ContractHoursPerWeek ; weekinfo.PlusMinusHours = CountWeeklyPlusMinusHours ; weekinfo.PlannedHours = CountWeeklyPlanningWorkingHours ; weekinfo.AdditionalCharge = CountWeeklyAdditionalCharges ; weekinfo.EmployeeID = EmployeeId; weekinfo.Saldo = Saldo; weekinfo.WeekBegin = BeginDate; weekinfo.WeekEnd = EndDate; weekinfo.CustomEdit = _CustomEdit; weekinfo.AllIn = AllIn; return weekinfo; }
public EmployeeWeekTimePlanning Assign(EmployeeWeekTimePlanning weekinfo) { if (weekinfo == null) throw new NullReferenceException(); ID = weekinfo.ID; CountWeeklyWorkingHours = weekinfo.WorkingHours; ContractHoursPerWeek = weekinfo.ContractHours; CountWeeklyPlusMinusHours = weekinfo.PlusMinusHours; CountWeeklyPlanningWorkingHours = weekinfo.PlannedHours; CountWeeklyAdditionalCharges = weekinfo.AdditionalCharge; Saldo = weekinfo.Saldo; _CustomEdit = weekinfo.CustomEdit; AllIn = weekinfo.AllIn; return weekinfo; }
public static bool IsModified(EmployeeWeekTimePlanning entity, EmployeeWeek week) { return (entity.EmployeeID != week.EmployeeId || entity.Saldo != week.Saldo || entity.WeekBegin != week.BeginDate || entity.WeekEnd != week.EndDate || entity.WeekNumber != DateTimeHelper.GetWeekNumber(week.BeginDate, week.EndDate) || entity.AdditionalCharge != week.CountWeeklyAdditionalCharges || entity.PlannedHours != week.CountWeeklyPlanningWorkingHours || entity.PlusMinusHours != week.CountWeeklyPlusMinusHours || entity.WorkingHours != week.CountWeeklyWorkingHours || entity.ContractHours != week.ContractHoursPerWeek || entity.CustomEdit != week.CustomEdit || entity.AllIn != week.AllIn); }