Esempio n. 1
0
        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"));
                    }
                }
            }
        }
Esempio n. 2
0
        public void FireEditEntity()
        {
            if (Context != null && FocusedEntity != null && EditEnabled)
            {
                Context.EmployeeAbsence = FocusedEntity;
                using (Employee.FormEmployeeLongTimeAbsence form = new Employee.FormEmployeeLongTimeAbsence())
                {
                    form.Entity = Context;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        EmployeesLongTimeAbsence.ResetItemById(Context.EmployeeAbsence.ID);
                        Context.EmployeeList.ResetItemById(Context.EmployeeAbsence.EmployeeID);
                    }
                }
            }
        }
Esempio n. 3
0
        public void FireNewEntity()
        {
            if (Context != null)
            {
                Context.EmployeeAbsence = new EmployeeLongTimeAbsence();
                using (FormEmployeeLongTimeAbsence form = new FormEmployeeLongTimeAbsence())
                {
                    form.Entity = Context;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        EmployeesLongTimeAbsence.Add(Context.EmployeeAbsence);
                        Context.EmployeeList.ResetItemById(Context.EmployeeAbsence.EmployeeID);
                    }
                }
            }
        }