コード例 #1
0
        public string GetEvents(string start, string end)
        {
            var results  = ResetEventRepo.Get().GetResetEvents(start, end);
            var jsonData = JArray.FromObject(results.ToArray());

            return(jsonData.ToString());
        }
コード例 #2
0
        public ActionResult DeleteAll()
        {
            int deleteCount = ResetEventRepo.Get().Clear();

            ViewBag.message = string.Format("{0} deleted.", deleteCount);

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public ActionResult DeleteByName(string name)
        {
            if ("" != name)
            {
                int deleteCount = ResetEventRepo.Get().Clear("", "", name);
                ViewBag.message = string.Format("{0} deleted.", deleteCount);
            }

            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public int MakeEventsEachRaid(RaidInfo info, string start, string end)
        {
            DateTime          startDate = DateTime.Parse(start);
            DateTime          endDate   = DateTime.Parse(end);
            List <ResetEvent> events    = new List <ResetEvent>();
            DateTime          termDate  = DateTime.Parse(info.start);

            while (startDate < endDate)
            {
                if (true == info.isThurReset)
                {
                    if ((DayOfWeek.Thursday == startDate.DayOfWeek) &&
                        (startDate >= termDate))
                    {
                        var newEvent = new ResetEvent(info.name, startDate, info.resourceId);
                        events.Add(newEvent);
                        startDate = startDate.AddDays(7f);
                    }
                    else
                    {
                        startDate = startDate.AddDays(1f);
                    }
                }
                else
                {
                    while (startDate > termDate)
                    {
                        termDate = termDate.AddDays(info.term);
                    }

                    if (startDate == termDate)
                    {
                        var newEvent = new ResetEvent(info.name, startDate, info.resourceId);
                        events.Add(newEvent);
                        startDate = startDate.AddDays(info.term);
                        termDate  = termDate.AddDays(info.term);
                    }
                    else
                    {
                        startDate = startDate.AddDays(1f);
                    }
                }
            }

            int insertCount = ResetEventRepo.Get().Add(events);

            return(insertCount);
        }
コード例 #5
0
        // GET: ResetEvent
        public ActionResult Index()
        {
            var results = ResetEventRepo.Get().GetResetEvents();

            return(View(results));
        }