Esempio n. 1
0
        ///<summary>Each date should have one (and only 1) PhoneGraph entry per employee. Some may already be entered as exceptions to the default. We will fill in the gaps here. This will only be done for today's date (once Today has passed the opportunity to fill the gaps has passed). We don't want to presume that if it was missing on a past date then we should add it. This assumption would fill in gaps on past dates for employees that may not even have worked here on that date.</summary>
        public static void AddMissingEntriesForToday(List <PhoneEmpDefault> peds)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), peds);
                return;
            }
            //get all overrides created for this date
            List <PhoneGraph> listPhoneGraphs = GetAllForDate(DateTime.Today);
            List <Schedule>   listSchedules   = Schedules.GetDayList(DateTime.Today);

            //loop through all defaults and check if there are overrides added
            for (int iPed = 0; iPed < peds.Count; iPed++)
            {
                PhoneEmpDefault ped = peds[iPed];
                bool            hasPhoneGraphEntry = false;
                //we have a default, now loop through all known overrides and find a match
                for (int iPG = 0; iPG < listPhoneGraphs.Count; iPG++)
                {
                    PhoneGraph pg = listPhoneGraphs[iPG];
                    if (ped.EmployeeNum == listPhoneGraphs[iPG].EmployeeNum)                   //found a match so no op necessary for this employee
                    {
                        hasPhoneGraphEntry = true;
                        break;
                    }
                }
                if (hasPhoneGraphEntry)                 //no entry needed, it's already there
                {
                    continue;
                }
                //does employee have a schedule table entry for this date
                bool hasScheduleEntry = false;
                for (int iSch = 0; iSch < listSchedules.Count; iSch++)
                {
                    Schedule schedule = listSchedules[iSch];
                    if (ped.EmployeeNum == listSchedules[iSch].EmployeeNum)                   //found a match so no op necessary for this employee
                    {
                        hasScheduleEntry = true;
                        break;
                    }
                }
                if (!hasScheduleEntry)                  //no entry needed if not on the schedule
                {
                    continue;
                }
                //employee is on the schedule but does not have a phonegraph entry, so create one
                PhoneGraph pgNew = new PhoneGraph();
                pgNew.EmployeeNum = ped.EmployeeNum;
                pgNew.DateEntry   = DateTime.Today;
                pgNew.IsGraphed   = ped.IsGraphed;
                Insert(pgNew);
            }
        }
Esempio n. 2
0
        ///<summary></summary>
        private static bool Overlaps(Schedule sched)
        {
            //No need to check RemotingRole; no call to db.
            List <Schedule> SchedListDay = Schedules.GetDayList(sched.SchedDate);

            Schedule[] ListForType = Schedules.GetForType(SchedListDay, sched.SchedType, sched.ProvNum);
            bool       opsMatch;

            for (int i = 0; i < ListForType.Length; i++)
            {
                if (ListForType[i].SchedType == ScheduleType.Blockout)
                {
                    //skip if blockout, and ops don't interfere
                    opsMatch = false;
                    for (int s1 = 0; s1 < sched.Ops.Count; s1++)
                    {
                        if (ListForType[i].Ops.Contains(sched.Ops[s1]))
                        {
                            opsMatch = true;
                            break;
                        }
                    }
                    if (!opsMatch)
                    {
                        continue;
                    }
                }
                if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
                    sched.StartTime >= ListForType[i].StartTime &&
                    sched.StartTime < ListForType[i].StopTime)
                {
                    return(true);
                }
                if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
                    sched.StopTime > ListForType[i].StartTime &&
                    sched.StopTime <= ListForType[i].StopTime)
                {
                    return(true);
                }
                if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
                    sched.StartTime <= ListForType[i].StartTime &&
                    sched.StopTime >= ListForType[i].StopTime)
                {
                    return(true);
                }
            }
            return(false);
        }