public string GetEvents(string start, string end) { var results = ResetEventRepo.Get().GetResetEvents(start, end); var jsonData = JArray.FromObject(results.ToArray()); return(jsonData.ToString()); }
public ActionResult DeleteAll() { int deleteCount = ResetEventRepo.Get().Clear(); ViewBag.message = string.Format("{0} deleted.", deleteCount); return(RedirectToAction("Index")); }
public ActionResult DeleteByName(string name) { if ("" != name) { int deleteCount = ResetEventRepo.Get().Clear("", "", name); ViewBag.message = string.Format("{0} deleted.", deleteCount); } return(RedirectToAction("Index")); }
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); }
// GET: ResetEvent public ActionResult Index() { var results = ResetEventRepo.Get().GetResetEvents(); return(View(results)); }