Esempio n. 1
0
 public static IEmployeeWeek AssignTo(IEmployeeWeek entity, EmployeeWeek week)
 {
     //entity.ID = week.ID;
     entity.EmployeeID       = week.EmployeeId;
     entity.OrderHWGR        = week.OrderHWGR;
     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;
     return(entity);
 }
Esempio n. 2
0
 public static EmployeeWeek Assign(IEmployeeWeek entity, EmployeeWeek week)
 {
     //week.ID = entity.ID;
     if (entity.ID > 0)
     {
         week.NewWeek = false;
     }
     week.EmployeeId = entity.EmployeeID;
     week.OrderHWGR  = entity.OrderHWGR;
     week.Saldo      = entity.Saldo;
     week.BeginDate  = entity.WeekBegin;
     week.EndDate    = entity.WeekEnd;
     week.CountWeeklyAdditionalCharges    = entity.AdditionalCharge;
     week.CountWeeklyPlanningWorkingHours = entity.PlannedHours;
     week.CountWeeklyPlusMinusHours       = entity.PlusMinusHours;
     week.CountWeeklyWorkingHours         = entity.WorkingHours;
     week.ContractHoursPerWeek            = entity.ContractHours;
     week.CustomEdit = entity.CustomEdit;
     week.AllIn      = entity.AllIn;
     return(week);
 }
Esempio n. 3
0
 public EmployeeWeek(IEmployeeWeek week)
 {
     EmployeeWeekProcessor.Assign(week, this);
     BuildDays();
 }
Esempio n. 4
0
        public void RecalculateAfterImport(DateTime monday)
        {
            long id = BzEmployee.Employee.ID;

            if (!IsNeedRecalculationAfterImport(id, monday))
            {
                return;
            }

            int lastSaldo = 0;

            if (BzEmployee.AustriaEmployee)
            {
                lastSaldo = Convert.ToInt32(BzEmployee.Employee.BalanceHours);
            }
            else
            {
                DateTime prevMonday = monday.AddDays(-7);

                IEmployeeWeek week = RecordingWeeks.GetByDate(id, prevMonday);
                if (week == null)
                {
                    week = GetByDate(id, prevMonday);

                    if (week == null)
                    {
                        lastSaldo = BzEmployee.GetLastSaldoForPlanning(monday);
                    }
                    else
                    {
                        lastSaldo = week.Saldo;
                    }
                }
                else
                {
                    lastSaldo = week.Saldo;
                }
            }

            List <EmployeeWeekTimePlanning> list = GetEntitiesByEmployeeId(id);

            if (list != null && list.Count > 0)
            {
                int  contract   = 0;
                bool allin      = false;
                bool customedit = false;
                bool bModified  = false;
                foreach (EmployeeWeekTimePlanning entity in list)
                {
                    contract   = 0;
                    allin      = false;
                    customedit = false;
                    bModified  = false;
                    if (entity.EmployeeID == id && entity.WeekBegin >= monday)
                    {
                        allin = AllInManager.GetAllIn(id, entity.WeekBegin, entity.WeekEnd);

                        if (RecordingWeeks != null)
                        {
                            EmployeeWeekTimeRecording rec = RecordingWeeks.GetByDate(id, entity.WeekBegin);
                            if (rec != null)
                            {
                                customedit = rec.CustomEdit;
                            }
                        }

                        contract = Contracts.GetContractHours(entity.EmployeeID, entity.WeekBegin, entity.WeekEnd);


                        bModified = (entity.CustomEdit != customedit) |
                                    (entity.AllIn != allin) |
                                    (entity.ContractHours != contract);
                        if (bModified)
                        {
                            entity.CustomEdit    = customedit;
                            entity.AllIn         = allin;
                            entity.ContractHours = contract;
                        }
                        if (entity.CalculateSaldo(lastSaldo) | bModified)
                        {
                            UpdateEntity(entity);
                        }

                        lastSaldo = entity.Saldo;
                    }
                }
            }
        }
Esempio n. 5
0
 public EmployeeWeek(IEmployeeWeek week)
 {
     EmployeeWeekProcessor.Assign(week, this);
     BuildDays();
 }
Esempio n. 6
0
 public static IEmployeeWeek AssignTo(IEmployeeWeek entity, EmployeeWeek week)
 {
     //entity.ID = week.ID;
     entity.EmployeeID = week.EmployeeId;
     entity.OrderHWGR = week.OrderHWGR;
     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 ;
     return entity;
 }
Esempio n. 7
0
 public static EmployeeWeek Assign(IEmployeeWeek entity, EmployeeWeek week)
 {
     //week.ID = entity.ID;
     if (entity.ID > 0)
         week.NewWeek = false;
     week.EmployeeId = entity.EmployeeID;
     week.OrderHWGR = entity.OrderHWGR;
     week.Saldo = entity.Saldo;
     week.BeginDate = entity.WeekBegin;
     week.EndDate = entity.WeekEnd;
     week.CountWeeklyAdditionalCharges = entity.AdditionalCharge;
     week.CountWeeklyPlanningWorkingHours = entity.PlannedHours;
     week.CountWeeklyPlusMinusHours = entity.PlusMinusHours;
     week.CountWeeklyWorkingHours = entity.WorkingHours;
     week.ContractHoursPerWeek = entity.ContractHours;
     week.CustomEdit = entity.CustomEdit;
     week.AllIn = entity.AllIn;
     return week;
 }