示例#1
0
 private void removeNotOpens(ref List <TutorMaster.Commitment> cmtList, DateTime start, bool weekly)
 {
     if (weekly)                                                                                                                                     //if this is a weekly commitments
     {
         for (int i = 0; i < cmtList.Count() - 1; i++)
         {
             if (!Commits.isOpen(cmtList[i]) || DateTime.Compare(start, Convert.ToDateTime(cmtList[i].StartTime)) > 0 || cmtList[i].Weekly != weekly)//remove them if they are not after start, and if they are not open or weekly
             {
                 cmtList.Remove(cmtList[i]);
                 i--;
             }
         }
     }
     else                                                                                                                                            //if its not weekly
     {
         for (int i = 0; i < cmtList.Count() - 1; i++)
         {
             if (!Commits.isOpen(cmtList[i]) || DateTime.Compare(start, Convert.ToDateTime(cmtList[i].StartTime)) > 0)                               //only eliminate the commit if its not open or not after start
             {
                 cmtList.Remove(cmtList[i]);
                 i--;
             }
         }
     }
 }
示例#2
0
        //this function makes sure that we do not take a time that is already at 3 hours and add to it
        private void checkMax(ref List <TutorMaster.Commitment> cmtList)
        {
            int consec = 1;

            for (int i = 0; i < cmtList.Count() - 1; i++)
            {
                DateTime currentCommit = Convert.ToDateTime(cmtList[i].StartTime);                                                                                          //get the current commitment's starttime
                DateTime nextCommit    = Convert.ToDateTime(cmtList[i + 1].StartTime);                                                                                      //get the next commitment's starttime

                if (consec > 11)                                                                                                                                            //if the consecutive counter is above 11, then remove the next commitment
                {
                    if (DateTime.Compare(currentCommit.AddMinutes(15), nextCommit) == 0 && Commits.sameCategory(cmtList[i], cmtList[i + 1]) && !Commits.isOpen(cmtList[i])) //if it is adjacent as well, remove the next commitment
                    {
                        cmtList.Remove(cmtList[i + 1]);
                        i--;
                    }
                    consec = 1;                                                                                                                                         //set commit counter to 0
                }
                if (DateTime.Compare(currentCommit.AddMinutes(15), nextCommit) == 0 && Commits.sameCategory(cmtList[i], cmtList[i + 1]) && !Commits.isOpen(cmtList[i])) //if the next commit is adjacent, then increment consec counter
                {
                    consec++;
                }
                else
                {
                    consec = 1;
                }
            }
        }
示例#3
0
 public static bool openOrSameTypeDespiteLoc(Commitment listCommit, Commitment midCommit)
 {
     return(midCommit.Open == true || Commits.sameCategoryExceptLocation(listCommit, midCommit));
 }
示例#4
0
 public static bool openOrSameType(Commitment listCommit, Commitment midCommit)
 {
     return(midCommit.Open == true || Commits.sameCategory(listCommit, midCommit));
 }