예제 #1
0
 public EmployeeWorkingModel(EmployeePlanningWorkingModel plwm)
 {
     ID = plwm.ID;
     Hours = plwm.Hours;
     WorkingModelID = plwm.WorkingModelID;
     EmployeeID = plwm.EmployeeID;
     AdditionalCharge = plwm.AdditionalCharge;
     Date = plwm.Date;
 }
예제 #2
0
        public void SaveEmployeeWorkingModel(List<EmployeeWeek> lstWeeks)
        {
            if (lstWeeks == null || lstWeeks.Count == 0) return;

            long[] ids = EmployeeWeekProcessor.GetEmployeeIds(lstWeeks);
            List<EmployeePlanningWorkingModel> lstEntities = new List<EmployeePlanningWorkingModel>(lstWeeks.Count*10);
            DateTime begin, end;

            begin = lstWeeks[0].BeginDate;
            end = lstWeeks[0].EndDate;
            EmployeePlanningWorkingModel entity = null;

            foreach (EmployeeWeek week in lstWeeks)
            {
                foreach (EmployeeDay day in week.DaysList)
                {
                    if (day.WorkingModels != null && day.WorkingModels.Count > 0)
                    {
                        foreach (EmployeeWorkingModel model in day.WorkingModels)
                        {
                            entity = new EmployeePlanningWorkingModel();
                            model.AssignTo(entity);
                            lstEntities.Add(entity);
                        }
                    }
                }
            }

            SaveEmployeesWorkingModel(ids, lstEntities, begin, end);
        }
예제 #3
0
        public void SaveEmployeeWorkingModel(EmployeeWeek week)
        {
            List<EmployeeWorkingModel> lst = EmployeeWeekProcessor.GetWorkingModels(week);

            List<EmployeePlanningWorkingModel> lstEntities = new List<EmployeePlanningWorkingModel>(lst.Count);
            EmployeePlanningWorkingModel entity = null;
            foreach (EmployeeWorkingModel model in lst)
            {
                entity = new EmployeePlanningWorkingModel();
                model.AssignTo(entity);
                lstEntities.Add(entity);
            }

            SaveEmployeeWorkingModel(week.EmployeeId, lstEntities, week.BeginDate, week.EndDate);
        }
예제 #4
0
 public void AssignTo(EmployeePlanningWorkingModel plwm)
 {
     plwm.ID = ID;
     plwm.Hours = Hours;
     plwm.WorkingModelID = WorkingModelID;
     plwm.EmployeeID = EmployeeID;
     plwm.AdditionalCharge = AdditionalCharge;
     plwm.Date = Date;
 }
예제 #5
0
        private void CalculateWeeklyWorkingModels(EmployeePlanningWeek planningweek)
        {
            if (planningweek.IsValidWeek)
            {
                EmployeePlanningDay epday = planningweek.Days[planningweek.EndDate];
                EmployeePlanningWorkingModel entity = null;
                foreach (WorkingModelWrapper wrap in _weeklyModels)
                {
                    if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime,
                        planningweek.BeginDate, planningweek.EndDate)) continue;

                    if (wrap.Validate(/*daysInfo, */planningweek, planningweek.BeginDate))
                    {
                        entity = new EmployeePlanningWorkingModel();
                        entity.EmployeeID = epday.EmployeeId;
                        entity.Date = epday.Date;
                        entity.WorkingModelID = wrap.Model.ID;

                        if (!wrap.IsMessageModel)
                        {
                            entity.AdditionalCharge = wrap.Model.AddCharges ;
                            entity.Hours += wrap.GetModelValue; ;

                            if (wrap.Model.AddCharges)
                            {
                                epday.CountDailyAdditionalCharges += entity.Hours;// result += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue));
                            }
                            else
                            {
                                epday.CountDailyPlannedWorkingHours  += entity.Hours; //result += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours));
                            }
                        }
                        if (epday.WorkingModels == null)
                            epday.WorkingModels = new List<EmployeePlanningWorkingModel>();
                        epday.WorkingModels.Add(entity);
                    }
                }
            }
        }
예제 #6
0
        private void CalculateWeeklyMessageOrSaldoWorkingModels(EmployeePlanningWeek planningweek)
        {
            if (planningweek.IsValidWeek)
            {
                EmployeePlanningDay epday = planningweek.Days[planningweek.EndDate];
                EmployeePlanningWorkingModel entity = null;
                foreach (WorkingModelWrapper wrap in _weeklyMessagesModels)
                {
                    if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime,
                        planningweek.BeginDate, planningweek.EndDate)) continue;

                    if (wrap.Validate(planningweek, planningweek.BeginDate))
                    {
                        entity = new EmployeePlanningWorkingModel();
                        entity.EmployeeID = epday.EmployeeId;
                        entity.Date = epday.Date;
                        entity.WorkingModelID = wrap.Model.ID;

                        if (epday.WorkingModels == null)
                            epday.WorkingModels = new List<EmployeePlanningWorkingModel>();

                        epday.WorkingModels.Add(entity);
                    }
                }
            }
        }
예제 #7
0
        private void CalculateDailyWorkingModels(EmployeePlanningWeek planningweek)
        {
            #region daily calculation
            if (planningweek.IsValidWeek)
            {
                EmployeePlanningWorkingModel entity = null;
                foreach (EmployeePlanningDay epd in planningweek.Days.Values)
                {
                    epd.CountDailyAdditionalCharges = 0;
                    epd.WorkingModels = null;
                    // if day don't have - contractr, relation or it under long absence
                    if (epd.IsBlockedDay) continue;

                    foreach (WorkingModelWrapper wrap in _dailyModels)
                    {
                        if (!DateTimeHelper.Between(epd.Date, wrap.Model.BeginTime, wrap.Model.EndTime)) continue;

                        if (wrap.Validate(planningweek, epd.Date))
                        {
                            entity = new EmployeePlanningWorkingModel();
                            entity.EmployeeID = epd.EmployeeId;
                            entity.Date = epd.Date;
                            entity.WorkingModelID = wrap.Model.ID;

                            if (!wrap.IsMessageModel)
                            {
                                entity.Hours = wrap.GetModelValue;
                                entity.AdditionalCharge = wrap.Model.AddCharges;

                                if (wrap.Model.AddCharges)
                                {
                                    epd.CountDailyAdditionalCharges += entity.Hours;
                                }
                                else
                                {
                                    epd.CountDailyPlannedWorkingHours += entity.Hours;
                                }
                            }

                            if (epd.WorkingModels == null)
                                epd.WorkingModels = new List<EmployeePlanningWorkingModel>();
                            epd.WorkingModels.Add(entity);
                        }
                    }

                }
            }
            #endregion
        }