Ejemplo n.º 1
0
        protected virtual SrvEmployeeRecordingDayList CreateDictionItem(long emplid)
        {
            SrvEmployeeRecordingDayList list = new SrvEmployeeRecordingDayList(emplid);

            _EmployeeToDayState[emplid] = list;
            return(list);
        }
Ejemplo n.º 2
0
        public SrvEmployeeRecordingDayList GetList(long emplid)
        {
            SrvEmployeeRecordingDayList list = null;

            _EmployeeToDayState.TryGetValue(emplid, out list);

            return(list);
        }
Ejemplo n.º 3
0
        public void CalculateWorkingSundayAndSaturday(long emplid, DateTime fromdate, DateTime toDate,
                                                      out int countSunday, out int countSaturday)
        {
            SrvEmployeeRecordingDayList list = GetList(emplid);

            countSunday   = 0;
            countSaturday = 0;
            if (list != null)
            {
                list.CalculateWorkingSundayAndSaturday(fromdate, toDate, out countSunday, out countSaturday);
            }
        }
Ejemplo n.º 4
0
        public int GetCountWorkingDayBefore(long emplid, DateTime beforeDate)
        {
            SrvEmployeeRecordingDayList list = GetList(emplid);

            int result = 0;

            if (list != null)
            {
                result = list.GetCountWorkingDayBefore(beforeDate);
            }

            return(result);
        }
Ejemplo n.º 5
0
        public int GetAdditionalChargesForWeekRange(long emplid, DateTime monday, DateTime sunday)
        {
            SrvEmployeeRecordingDayList list = GetList(emplid);

            int result = 0;

            if (list != null)
            {
                result = list.GetAdditionalChargesForWeekRange(monday, sunday);
            }

            return(result);
        }
Ejemplo n.º 6
0
        private void BuildDiction(List <EmployeeDayStateRecording> list)
        {
            _EmployeeToDayState.Clear();
            if (list == null || list.Count == 0)
            {
                return;
            }
            SrvEmployeeRecordingDayList dictionItem = null;

            foreach (EmployeeDayStateRecording entity in list)
            {
                if (!_EmployeeToDayState.TryGetValue(entity.EmployeeID, out dictionItem))
                {
                    dictionItem = CreateDictionItem(entity.EmployeeID);
                }
                dictionItem.AddEntity(entity);
            }
        }
Ejemplo n.º 7
0
        public void CompareAndSave(EmployeeDay day)
        {
            if (day == null)
            {
                throw new ArgumentNullException();
            }


            SrvEmployeeRecordingDayList list = GetList(day.EmployeeId);

            if (list == null)
            {
                list = CreateDictionItem(day.EmployeeId);
            }

            EmployeeDayStateRecording entity = list[day.Date];

            if (entity == null)
            {
                if (day.IsValidDay)
                {
                    entity = EmployeeDayProcessor.CreateRecordingEntity(day);
                    UpdateEntity(entity);
                    list.AddEntity(entity);
                }
            }
            else
            {
                if (day.IsValidDay)
                {
                    if (!EmployeeDayProcessor.IsEqual(entity, day))
                    {
                        EmployeeDayProcessor.AssignToRecording(entity, day);
                        UpdateEntity(entity);
                    }
                }
                else
                {
                    DeleteEntity(entity);
                }
            }
        }