Пример #1
0
        // user can change saldo from Employee manager
        // here recalculate saldo for planning week
        public void UpdateCustomSaldo(int saldo)
        {
            CheckAndInit();

            if (!AustriaEmployee)
            {
                EmployeeWeekTimeRecording entity = RecordingWeeks.UpdateLastSaldoAsCustom(Employee.ID, saldo);

                int lastsaldo = saldo;

                DateTime date = DateTimeSql.FirstMinMonday;

                if (entity != null)
                {
                    date = entity.WeekBegin.AddDays(7);
                }
                else
                {
                    _employee.BalanceHours = Convert.ToDecimal(saldo);
                    (ServerEnvironment.EmployeeService as EmployeeService).EmployeeDao.UpdateSaldo(Employee.ID, Employee.BalanceHours);
                }
                PlanningWeeks = new SrvEmployeeWeekPlanningList();

                if (entity != null)
                {
                    PlanningWeeks.InitList(Employee.ID, entity.WeekBegin);
                    PlanningWeeks.SetCustomEditFlag(Employee.ID, entity.WeekBegin, saldo);
                }
                else
                {
                    PlanningWeeks.InitList(Employee.ID, date);
                }

                PlanningWeeks.AllInManager = AllInManagers;
                PlanningWeeks.UpdateSaldoFrom(Employee.ID, date, lastsaldo);
            }
        }