private void CreateSchedule(WeekNumber weekNumber = null)
        {
            var room = new Room(1);
            var week = weekNumber ?? Week.Current.Number + 1;

            schedule = null;
        }
        public void Test_WeekNumber_ToString_1()
        {
            var x = new WeekNumber(new List <int> {
                1, 2, 3, 4, 5
            });

            Assert.AreEqual(x.ToString(), "1-5");
        }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            WeekNumber weekNumber = db.WeekNumbers.Find(id);

            db.WeekNumbers.Remove(weekNumber);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void Test_WeekNumber_ToString_4()
        {
            var x = new WeekNumber(new List <int> {
                1, 4, 5, 6, 8, 9, 10
            });

            Assert.AreEqual(x.ToString(), "1,4-6,8-10");
        }
Пример #5
0
        public void Test_WeekNumber_ToString_5()
        {
            var x = new WeekNumber(new List <int> {
                1, 2, 3, 4, 8, 11, 12, 13, 14
            });

            Assert.AreEqual(x.ToString(), "1-4,8,11-14");
        }
Пример #6
0
 public DashboardViewModel(IList <Project> projects, int id)
 {
     //Projects = projects;
     SelectProjects = SelectListGen.SelectProjects(projects);
     ProjectID      = id;
     SelectWeeks    = WeekNumber.SelectWeeks();
     WeekId         = WeekNumber.CurrentWeek;
 }
        public void Test_WeekNumber_ToString_0()
        {
            var x = new WeekNumber(new List <int> {
                1, 3, 5
            });

            Assert.AreEqual("1,3,5", x.ToString());
        }
        public void Test_WeekNumber_ToString_3()
        {
            var x = new WeekNumber(new List <int> {
                1, 4, 5, 6
            });

            Assert.AreEqual(x.ToString(), "1,4-6");
        }
Пример #9
0
        public void SetLiveVideos()
        {
            if (GroupNumber.Equals("0") || WeekNumber.Equals("0"))
            {
                return;
            }

            _serviceAgent.SetLiveVideos(GroupNumber, WeekNumber, SelectedVideoInput, SelectedHomeTeams, SelectedAwayTeams);
        }
Пример #10
0
        public void Test_WeekNumber_ClashesWith_5()
        {
            var input1  = "1-7";
            var input2  = "7-14";
            var actual1 = WeekNumber.Parse(input1);
            var actual2 = WeekNumber.Parse(input2);

            Assert.True(actual1.IntersectWith(actual2));
        }
Пример #11
0
 public Slot()
 {
     WeekNumber = new WeekNumber(new List <int>());
     UID        = _nextUid++;
     IsSelected = false;
     StartTime  = Time.CreateTime_24HourFormat(0, 0);
     EndTime    = Time.CreateTime_24HourFormat(0, 0);
     _day       = Day.Unassigned;
 }
Пример #12
0
 public ActionResult Edit([Bind(Include = "Id,Number")] WeekNumber weekNumber)
 {
     if (ModelState.IsValid)
     {
         db.Entry(weekNumber).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(weekNumber));
 }
Пример #13
0
        public void Test_WeekNumber_Parse_5()
        {
            var input    = "1-3,4,5,11-14";
            var expected = new WeekNumber(new List <int> {
                1, 2, 3, 4, 5, 11, 12, 13, 14
            });
            var actual = WeekNumber.Parse(input);

            Assert.True(expected.Equals(actual));
        }
Пример #14
0
 private bool TryParseWeekAndVenue(ITokenStream ts, ref Slot resultSlot)
 {
     if (!ts.PreviousToken().IsPositiveNumberThatContainDecimalPoint() || !ts.NextToken().IsPossiblyVenuValue())
     {
         return(false);
     }
     resultSlot.WeekNumber = WeekNumber.Parse(ts.CurrentToken().Value());
     resultSlot.Venue      = ts.NextToken().Value();
     return(true);
 }
        public void Test_WeekNumber_Parse_4()
        {
            var input    = "1-3,7-9,11,13";
            var expected = new WeekNumber(new List <int> {
                1, 2, 3, 7, 8, 9, 11, 13
            });
            var actual = WeekNumber.Parse(input);

            Assert.True(expected.Equals(actual));
        }
        public void Test_WeekNumber_Parse_2()
        {
            var input    = "1-5";
            var expected = new WeekNumber(new List <int> {
                1, 2, 3, 4, 5
            });
            var actual = WeekNumber.Parse(input);

            Assert.True(expected.Equals(actual));
        }
Пример #17
0
 public bool EqualsExceptNumberAndVenue(Slot b)
 {
     return
         (SubjectName == b.SubjectName &&
          Type == b.Type &&
          Day.Equals(b.Day) &&
          StartTime.Equals(b.StartTime) &&
          EndTime.Equals(b.EndTime) &&
          WeekNumber.Equals(b.WeekNumber)
         );
 }
        public void Test_WeekNumber_ClashesWith_1()
        {
            var input1 = new WeekNumber(new List <int> {
                1, 2, 3, 4, 5
            });
            var input2 = new WeekNumber(new List <int> {
                5, 6, 7, 8, 9
            });

            Assert.True(input1.IntersectWith(input2));
        }
        public void Test_WeekNumber_ClashesWith_4()
        {
            var input1 = new WeekNumber(new List <int> {
                1, 3, 7, 9, 11, 13
            });
            var input2 = new WeekNumber(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
            });

            Assert.True(input1.IntersectWith(input2));
        }
        public void Test_WeekNumber_ClashesWith_3()
        {
            var input1 = new WeekNumber(new List <int> {
                6, 8
            });
            var input2 = new WeekNumber(new List <int> {
                4, 3
            });

            Assert.False(input1.IntersectWith(input2));
        }
Пример #21
0
        public ActionResult Create([Bind(Include = "Id,Number")] WeekNumber weekNumber)
        {
            if (ModelState.IsValid)
            {
                db.WeekNumbers.Add(weekNumber);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(weekNumber));
        }
Пример #22
0
 public bool Equals(Slot b)
 {
     return
         (SubjectName == b.SubjectName &&
          Code == b.Code &&
          Number == b.Number &&
          Type == b.Type &&
          Venue == b.Venue &&
          Day.Equals(b.Day) &&
          StartTime.Equals(b.StartTime) &&
          EndTime.Equals(b.EndTime) &&
          WeekNumber.Equals(b.WeekNumber));
 }
        public void Test_WeekNumber_ClashesWith_2()
        {
            var input1 = new WeekNumber(new List <int> {
                1, 3, 5, 7, 9
            });
            var input2 = new WeekNumber(new List <int> {
                2, 4, 6, 8, 10
            });

            Console.WriteLine(Convert.ToString(input1._weekNumberInBinary, 2));
            Console.WriteLine(Convert.ToString(input2._weekNumberInBinary, 2));
            Assert.False(input1.IntersectWith(input2));
        }
Пример #24
0
 public Slot(int uid, string code, string subjectName, string number, string type, Day day, string venue,
             TimePeriod timePeriod, WeekNumber weekNumber)
 {
     UID         = uid;
     Code        = code;
     SubjectName = subjectName;
     Number      = number;
     Type        = type;
     Day         = day;
     Venue       = venue;
     TimePeriod  = timePeriod;
     WeekNumber  = weekNumber;
     IsSelected  = true;
 }
Пример #25
0
        // GET: WeekNumbers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WeekNumber weekNumber = db.WeekNumbers.Find(id);

            if (weekNumber == null)
            {
                return(HttpNotFound());
            }
            return(View(weekNumber));
        }
        private List <WeekNumber> ConvertWeekNumbers(string[] weekNumbers)
        {
            List <WeekNumber> ListofWeekNumbers = new List <WeekNumber>();

            foreach (var weekNumber in weekNumbers)
            {
                WeekNumber item = (WeekNumber)Enum.Parse(typeof(WeekNumber), weekNumber, true);
                if (!ListofWeekNumbers.Contains(item))
                {
                    ListofWeekNumbers.Add(item);
                }
            }

            return(ListofWeekNumbers);
        }
Пример #27
0
 public bool IntersectWith(Slot other)
 {
     if (Code == other.Code && Type == other.Type && Number != other.Number)
     {
         return(true);
     }
     if (!Day.Equals(other.Day))
     {
         return(false);
     }
     if (!TimePeriod.IntersectWith(other.TimePeriod))
     {
         return(false);
     }
     return(WeekNumber.IntersectWith(other.WeekNumber));
 }
Пример #28
0
        public int CompareTo(object obj)
        {
            if (!(obj is WeeklyRecipe))
            {
                throw new ApplicationException("object is not a WeeklyRecipe");
            }

            WeeklyRecipe recipe = obj as WeeklyRecipe;

            if (YearNumber.CompareTo(recipe.YearNumber) == 0)
            {
                return(WeekNumber.CompareTo(recipe.WeekNumber));
            }
            else
            {
                return(YearNumber.CompareTo(recipe.YearNumber));
            }
        }
Пример #29
0
        public void Test_TimetableRow_Add()
        {
            var input1 = new Slot();

            input1.StartTime  = Time.CreateTime_24HourFormat(8, 0);
            input1.EndTime    = Time.CreateTime_24HourFormat(10, 0);
            input1.WeekNumber = WeekNumber.Parse("1-14");

            var input2 = new Slot();

            input2.StartTime  = Time.CreateTime_24HourFormat(8, 0);
            input2.EndTime    = Time.CreateTime_24HourFormat(9, 0);
            input2.WeekNumber = WeekNumber.Parse("2,5");
            var ttr = new TimetableRow();

            ttr.Add(input1);
            Assert.False(ttr.Add(input2));
        }
Пример #30
0
        //Home/Index
        public IActionResult Index(int id)
        {
            //Initialize week number generator
            if (WeekNumber.IsLoaded == false)
            {
                WeekNumber.WeekGenerator();
                WeekNumber.IsLoaded = true;
            }
            ;

            DashboardViewModel dashboardViewModel = new DashboardViewModel(context.Projects.ToList(), id);

            if (id != 0)
            {
                dashboardViewModel.Worktimes = context.Worktimes
                                               .Where(w => w.ProjectID == id)
                                               .Where(w => w.OpenStatus == true)
                                               .Include(w => w.Project)
                                               .OrderBy(w => w.WeekRange)
                                               .ToList();

                dashboardViewModel.DashboardTitle = context.Projects.Single(p => p.ProjectID == id).Name;
                ViewBag.SingleProject             = context.Projects.Include(p => p.Client).Single(p => p.ProjectID == id);
            }

            else
            {
                dashboardViewModel.Worktimes      = context.Worktimes.Where(w => w.OpenStatus == true).OrderBy(w => w.Project.Name).ToList();
                dashboardViewModel.DashboardTitle = "Showing all Projects";

                dashboardViewModel.SelectProjects.Add(new SelectListItem
                {
                    Value = "0",
                    Text  = "Add Project...",
                });
            }

            return(View(dashboardViewModel));
        }
Пример #31
0
            public Recurrence(byte pattern, byte subPattern,
				byte frequency, byte weekDays, byte dayOfMonth,
				byte weekNumber, byte monthNumber, int endAfter,
				DateTime startDate, DateTime finishDate, int timeZoneId)
            {
                Pattern = (RecurPattern)pattern;
                SubPattern = (RecurSubPattern)subPattern;
                Frequency = frequency;
                WeekDays = weekDays;
                DayOfMonth = dayOfMonth;
                RecurWeekNumber = (WeekNumber)weekNumber;
                MonthNumber = monthNumber;
                EndAfter = endAfter;
                StartDate = startDate.Date;
                FinishDate = finishDate.Date;
                TimeZoneId = timeZoneId;
            }