Beispiel #1
0
        public List <WorkingTimePlanning> GetWorkingTimePlanningEntities(DateTime date)
        {
            int starttime = -1;
            int endtime   = -1;
            List <WorkingTimePlanning> resultList = new List <WorkingTimePlanning>();

            for (int i = 0; i <= 24 * 4; i++)
            {
                if (IsWorkingTime(i))
                {
                    if (starttime == -1)
                    {
                        starttime = i * 15;
                        endtime   = i * 15 + 15;
                        continue;
                    }
                    endtime = i * 15 + 15;;
                }
                else
                {
                    if (starttime != -1)
                    {
                        WorkingTimePlanning entity = new WorkingTimePlanning(
                            date,
                            (short)(starttime),
                            (short)(endtime),
                            (short)(endtime - starttime),
                            EmployeeId);

                        resultList.Add(entity);
                        starttime = -1;
                    }
                }
            }

            return(resultList);
        }
Beispiel #2
0
            public void AssignTo(EmployeePlanningDay employeeday)
            {
                if (employeeday.WorkingTimeList == null)
                    employeeday.WorkingTimeList = new List<WorkingTimePlanning>();
                else employeeday.WorkingTimeList.Clear();

                WorkingTimePlanning entity = null;
                foreach (WorkingTimePlanning wtp in WorkingTimes)
                {
                    entity = new WorkingTimePlanning();

                    entity.ID = 0;
                    entity.EmployeeID = employeeday.EmployeeId;
                    entity.Date = employeeday.Date;
                    entity.Begin = wtp.Begin;
                    entity.End = wtp.End;
                    entity.Time = (short)(entity.End - entity.Begin);

                    employeeday.WorkingTimeList.Add(entity);

                }

                if (employeeday.AbsenceTimeList == null)
                    employeeday.AbsenceTimeList = new List<AbsenceTimePlanning>();
                else employeeday.AbsenceTimeList.Clear();

                AbsenceTimePlanning entity1 = null;
                foreach (AbsenceTimePlanning atp in AbsenceTimes)
                {
                    entity1 = new AbsenceTimePlanning();
                    entity1.ID = 0;
                    entity1.EmployeeID = employeeday.EmployeeId;
                    entity1.Date = employeeday.Date;
                    entity1.Begin = atp.Begin;
                    entity1.End = atp.End;
                    entity1.AbsenceID = atp.AbsenceID;
                    entity1.Absence = atp.Absence;

                    employeeday.AbsenceTimeList.Add(entity1);
                }

                employeeday.Modified = true;
            }