public void EnterLongTimeAbsence() { if (EntityStore != null && FocusedEntity != null) { EmployeeLongTimeAbsence newAbsence = ClientEnvironment.EmployeeLongTimeAbsenceService.CreateEntity(); long focusedEmployeeID = FocusedEntity.ID; newAbsence.EmployeeID = focusedEmployeeID; newAbsence.EmployeeFullName = FocusedEntity.FullName; Context.EmployeeAbsence = newAbsence; using (FormEmployeeLongTimeAbsence form = new FormEmployeeLongTimeAbsence()) { form.Entity = Context; if (form.ShowDialog() == DialogResult.OK) { Context.EmployeeList.ResetItemById(focusedEmployeeID); } } /* * using (Baumax.ClientUI.FormEntities.TimePlanning.AbsencePlanning.FormEmployeeLongTime form = new Baumax.ClientUI.FormEntities.TimePlanning.AbsencePlanning.FormEmployeeLongTime()) * { * form.Bind(Context.EmployeeList, ClientEnvironment.LongTimeAbsenceService.FindAllByCountry(Context.CurrentCountryID), true); * form.Entity = newAbsence; * if (form.ShowDialog() == DialogResult.OK) * Context.EmployeeList.ResetItemById(focusedEmployeeID); * }*/ } }
private void FillAbsence(EmployeeLongTimeAbsence dest) { dest.BeginTime = BeginTime.Date; dest.EndTime = EndTime.Date; dest.LongTimeAbsenceID = LongTimeAbsenceID; dest.EmployeeID = EmployeeID; }
public void FireDeleteEntity() { if (Context != null && FocusedEntity != null && DeleteEnabled) { EmployeeLongTimeAbsence newAbsence = FocusedEntity; if (QuestionMessageYes(GetLocalized("QuestionRemoveEmplLongTimeAbsence"))) { try { ClientEnvironment.EmployeeLongTimeAbsenceService.DeleteByID(newAbsence.ID); EmployeesLongTimeAbsence.RemoveEntityById(newAbsence.ID); Domain.Employee employee = Context.EmployeeList.GetItemByID(newAbsence.EmployeeID); if (employee != null && newAbsence.BeginTime <= DateTime.Today && newAbsence.EndTime >= DateTime.Today) { employee.LongTimeAbsenceExist = false; Context.EmployeeList.ResetItemById(employee.ID); } } catch (EntityException ex) { ErrorMessage(GetLocalized("CantDeleteEmployeeLongTimeAbsence")); } } } }
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 EmployeeLongTimeAbsence GetEntityByRowHandle(int rowHandle) { EmployeeLongTimeAbsence absence = null; if (gridViewEntities.IsDataRow(rowHandle)) { absence = (EmployeeLongTimeAbsence)gridViewEntities.GetRow(rowHandle); } return(absence); }
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); } }
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); }
public EmployeeLongTimeAbsence SaveLongTimeAbsence(EmployeeLongTimeAbsence entity) { return(RemoteService.SaveLongTimeAbsence(entity)); }