Exemplo n.º 1
0
        public JsonResult GetCurrentEvent(int month, int year)
        {
            long key = month + year * 100;
            bool heb = CultureHelper.IsRighToLeft();
            CalendarEvent generatedEvent = null;
            generatedEvent = db.CalendarEvents.Where(i => i.CalendaryOrder == key).FirstOrDefault();
            if (generatedEvent == null)
                generatedEvent = GetNext(key);
            if (generatedEvent == null)
                generatedEvent = GetPrev(key);
            if (generatedEvent == null)
                return null;
            bool hasNext = HasNext(generatedEvent);
            bool hasPrev = HasPrev(generatedEvent);

            var res = new EventItem()
            {
                Month = generatedEvent.Month,
                Year = generatedEvent.Year,
                Data = heb ?
                generatedEvent.Text_Heb :
                generatedEvent.Text_Eng,
                HasNext = hasNext,
                HasPrev = hasPrev
            };
            return Json(res);
        }
Exemplo n.º 2
0
        public JsonResult GetNextEvent(int month, int year)
        {
            long key = month + year * 100;
            bool heb = CultureHelper.IsRighToLeft();

            var next = GetNext(key);
            if (next == null)
                return null;
            bool hasNext = HasNext(next);
            var res = new EventItem() { Month = next.Month, Year = next.Year, Data = heb ? next.Text_Heb : next.Text_Eng, HasNext = hasNext, HasPrev = true };
            return Json(res);
        }
Exemplo n.º 3
0
        public JsonResult GetPrevEvent(int month, int year)
        {
            long key = month + year * 100;
            bool heb = CultureHelper.IsRighToLeft();

            var prev = GetPrev(key);
            if (prev == null)
                return null;
            bool hasPrev = HasPrev(prev);
            var res = new EventItem() { Month = prev.Month, Year = prev.Year, Data = heb ? prev.Text_Heb : prev.Text_Eng, HasPrev = hasPrev, HasNext = true };
            return Json(res);
        }