public EmployeeLongTimeAbsence SaveLongTimeAbsence(EmployeeLongTimeAbsence entity) { return RemoteService.SaveLongTimeAbsence(entity); }
public override bool Commit() { if (IsValid() && !Context.SuspendedCall) { if (IsModified()) { try { EmployeeLongTimeAbsence safeCopy = new EmployeeLongTimeAbsence(); CopyAbsence(Context.EmployeeAbsence, safeCopy); FillAbsence(safeCopy); safeCopy = ClientEnvironment.EmployeeService.EmployeeTimeService.SaveLongTimeAbsence(safeCopy); CopyAbsence(safeCopy, Context.EmployeeAbsence); Domain.Employee empl = Context.EmployeeList.GetItemByID(safeCopy.EmployeeID); if (empl != null) { Context.EmployeeAbsence.EmployeeFullName = empl.FullName; // // If new long time absence falls on today, set LongTimeAbsenceExtits flag to employee // if (Context.EmployeeAbsence.BeginTime <= DateTime.Today && Context.EmployeeAbsence.EndTime >= DateTime.Today) { empl.LongTimeAbsenceExist = true; } } Context.EmployeeAbsence.LongTimeAbsenceName = m_ListAbsence.GetAbsenceName(Context.EmployeeAbsence.LongTimeAbsenceID); Modified = true; return base.Commit(); } catch (ValidationException) { ErrorMessage(GetLocalized("ErrorLongTimeAbsenceRange")); //ProcessEntityException(ex); return false; } catch (EntityException ex) { ProcessEntityException(ex); return false; } } return true; } else if (Context.SuspendedCall) { Context.EmployeeAbsence.EmployeeID = (long)gridLookUpEditEmployees.EditValue; Context.EmployeeAbsence.LongTimeAbsenceID = (long)lookUpAbsence.EditValue; Context.EmployeeAbsence.BeginTime = deBeginDate.DateTime; Context.EmployeeAbsence.EndTime = deEndDate.DateTime; return Modified = true; } return false; }
private void CopyAbsence(EmployeeLongTimeAbsence source, EmployeeLongTimeAbsence dest) { dest.ID = source.ID; dest.BeginTime = source.BeginTime; dest.EndTime = source.EndTime; dest.LongTimeAbsenceID = source.LongTimeAbsenceID; dest.EmployeeFullName = source.EmployeeFullName; dest.EmployeeID = source.EmployeeID; }
private void FillAbsence(EmployeeLongTimeAbsence dest) { dest.BeginTime = BeginTime.Date; dest.EndTime = EndTime.Date; dest.LongTimeAbsenceID = LongTimeAbsenceID; dest.EmployeeID = EmployeeID; }
public EmployeeLongTimeAbsence SaveLongTimeAbsence(EmployeeLongTimeAbsence entity) { if (entity != null) { ClearEmployeeTimeRange(entity.EmployeeID, entity.BeginTime, entity.EndTime); EmployeeLongTimeAbsence ent = _employeeLongTimeAbsenceService.SaveOrUpdate(entity); return ent; } else return null; }