public async Task <EventDetailsModel> GetEventDetailsAsync(string value, int id)
        {
            var date      = _dateTimeHelper.GetDateTime(value);
            var startDate = _dateTimeHelper.GetFirstDayOfWeek(date);
            var endDate   = _dateTimeHelper.GetLastDayOfWeek(date);

            var model = new EventDetailsModel();
            var e     = await _eventService.GetEventByIdAsync(startDate, endDate, id);

            model.Category = e?.Category;

            model.Members = _mapper.Map <List <EventMember>, List <MemberModel> >(e?.Members);

            if (model.Members?.Count() > 0)
            {
                foreach (var m in model.Members)
                {
                    var result = await _memberService.GetMemberByIdAsync(m.Id);

                    m.FullTitle  = result.FullTitle;
                    m.MemberFrom = result.MemberFrom;
                    m.Party      = result.Party?.Text;
                }
            }

            return(model);
        }
Ejemplo n.º 2
0
        //[ActionName("GetEventDetails")]
        public HttpResponseMessage GetEventDetails(long EventId)
        {
            EventDetailsViewModel _EventDetailsViewModel = new EventDetailsViewModel();

            _EventDetailsViewModel.MESSAGE = "Event Details";
            _EventDetailsViewModel.Flag    = "false";
            List <EventDetailsModel> _lstEventDetailsModel = new List <EventDetailsModel>();
            var _Event = _db.Events.FirstOrDefault(e => e.EventId == EventId);

            if (null != _Event)
            {
                _EventDetailsViewModel.Flag = "true";
                EventDetailsModel _EventDetailsModel = new EventDetailsModel();
                _EventDetailsModel.EventId         = _Event.EventId;
                _EventDetailsModel.EventTitle      = _Event.EventTitle;
                _EventDetailsModel.Image           = _Event.Image;
                _EventDetailsModel.Description     = _Event.Description;
                _EventDetailsModel.Status          = _Event.Status;
                _EventDetailsModel.CreatedDate     = _Event.CreatedDate;
                _EventDetailsModel.CreatedBy       = _Event.CreatedBy;
                _EventDetailsModel.EventSubHeading = "" + _Event.EventSubHeading;
                _lstEventDetailsModel.Add(_EventDetailsModel);
            }
            _EventDetailsViewModel.EventDetailsModel = _lstEventDetailsModel;
            return(Request.CreateResponse(HttpStatusCode.OK, _EventDetailsViewModel));
        }
Ejemplo n.º 3
0
        //[ActionName("GetAllEvents")]
        public HttpResponseMessage GetAllEvents()
        {
            var         _Events      = _db.Events;
            EventsModel _EventsModel = new EventsModel();

            _EventsModel.MESSAGE = "All Events";
            _EventsModel.Flag    = "false";
            List <EventDetailsModel> _lstEventDetailsModel = new List <EventDetailsModel>();

            if (null != _Events)
            {
                _EventsModel.Flag = "true";
                // List<EventDetailsModel> _lstEventDetailsModel = new List<EventDetailsModel>();
                foreach (var eve in _Events)
                {
                    EventDetailsModel _EventDetailsModel = new EventDetailsModel();

                    _EventDetailsModel.EventId         = eve.EventId;
                    _EventDetailsModel.EventTitle      = eve.EventTitle;
                    _EventDetailsModel.Image           = eve.Image;
                    _EventDetailsModel.Description     = "" + eve.Description;
                    _EventDetailsModel.EventSubHeading = "" + eve.EventSubHeading;
                    _EventDetailsModel.Status          = eve.Status;
                    _EventDetailsModel.CreatedDate     = eve.CreatedDate;
                    _EventDetailsModel.CreatedBy       = eve.CreatedBy;
                    _lstEventDetailsModel.Add(_EventDetailsModel);
                }
            }
            _EventsModel.EventDetailsModel = _lstEventDetailsModel;
            return(Request.CreateResponse(HttpStatusCode.OK, _EventsModel));
        }
        public ActionResult GetEventDetails(int id, int type = 0)
        {
            EventLocation     l   = null;
            EventDetailsModel evm = null;

            if (type == 0)
            {
                CalendarEntry e = ApplicationContext.DatabaseContext.Database.Single <CalendarEntry>("SELECT * FROM ec_events WHERE id=@0", id);
                if (e.locationId != 0)
                {
                    l = ApplicationContext.DatabaseContext.Database.Single <EventLocation>("SELECT * FROM ec_locations WHERE id = @0", e.locationId);
                }
                evm = new EventDetailsModel()
                {
                    Title       = e.title,
                    Description = e.description,
                    LocationId  = e.locationId,
                    Location    = l
                };
                if (null != e.start)
                {
                    evm.StartDate = ((DateTime)e.start).ToString("F", CultureInfo.CurrentCulture);
                }
                if (null != e.end)
                {
                    evm.EndDate = ((DateTime)e.end).ToString("F", CultureInfo.CurrentCulture);
                }
            }
            else if (type == 1)
            {
                RecurringEvent e = ApplicationContext.DatabaseContext.Database.Single <RecurringEvent>("SELECT * FROM ec_recevents WHERE id=@0", id);
                if (e.locationId != 0)
                {
                    l = ApplicationContext.DatabaseContext.Database.Single <EventLocation>("SELECT * FROM ec_locations WHERE id = @0", e.locationId);
                }
                Schedule schedule = new Schedule(new Event()
                {
                    Title                  = e.title,
                    DaysOfWeekOptions      = (DayOfWeekEnum)e.day,
                    FrequencyTypeOptions   = (FrequencyTypeEnum)e.frequency,
                    MonthlyIntervalOptions = (MonthlyIntervalEnum)e.monthly_interval
                });

                evm = new EventDetailsModel()
                {
                    Title       = e.title,
                    Description = e.description,
                    LocationId  = e.locationId,
                    Location    = l,
                    StartDate   = ((DateTime)schedule.NextOccurrence(DateTime.Now)).ToString("F", CultureInfo.CurrentCulture)
                };
            }

            return(PartialView("EventDetails", evm));
        }
Ejemplo n.º 5
0
 public static string GetJoinEventHtml(string username, EventDetailsModel eventObject)
 {
     return($"<div style=\"font-size:20px\">" +
            $"<div>Hi {username},</div>" +
            $"<br>" +
            $"<div>you joined successfully {eventObject.Sport} \"{eventObject.Name}\" event orginized by " +
            $"{eventObject.Orginizer}.</div>" +
            $"<div>It will be held on {eventObject.Date.ToString(GlobalConstants.DefaultDateFormat)} at " +
            $"{eventObject.Time.ToString(GlobalConstants.DefaultTimeFormat)} in \"{eventObject.Arena}\" Arena.</div>" +
            $"<div>Have fun!</div>" +
            $"<br>" +
            $"<div>Sincerely Yours,</div>" +
            $"<div>LetsSport Team</div>" +
            $"</div>");
 }
Ejemplo n.º 6
0
 public static string GetLeaveEventHtml(string username, EventDetailsModel eventObject)
 {
     return($"<div style=\"font-size:20px\">" +
            $"<div>Hi {username},</div>" +
            $"<br>" +
            $"<div>we are sorry to hear you left {eventObject.Sport} \"{eventObject.Name}\" event orginized by " +
            $"{eventObject.Orginizer}.</div>" +
            $"<div>The event will be held on {eventObject.Date.ToString(GlobalConstants.DefaultDateFormat)} at " +
            $"{eventObject.Time.ToString(GlobalConstants.DefaultTimeFormat)} in \"{eventObject.Arena}\" Arena.</div>" +
            $"<div>You can always come back and join it again!</div>" +
            $"<br>" +
            $"<div>Sincerely Yours,</div>" +
            $"<div>LetsSport Team</div>" +
            $"</div>");
 }
Ejemplo n.º 7
0
        public async Task <JsonResult> RequestEventResponce(EventDetailsModel model, string url)
        {
            JsonResult resp = null;

            try
            {
                resp = await call.Put <EventDetailsModel>(model, url);

                return(resp);
            }
            catch (Exception ex)
            {
                CR.Filename  = "EventRepository";
                CR.Eventname = "RequestEventResponce";
                CR.UserID    = GlobalClass.UserID == null ? "0" : GlobalClass.UserID;
                CR.ErrorMsg  = ex.Message + ex.StackTrace;
                await crashReport.PostCrashReport(CR);

                return(resp);
            }
        }
Ejemplo n.º 8
0
 public async Task <JsonResult> EventResponse(EventDetailsModel model, string url)
 {
     return(await repo.RequestEventResponce(model, url));
 }
Ejemplo n.º 9
0
        public ActionResult GetEventDetails(int id, int calendar, int type = 0)
        {
            EventLocation     l   = null;
            EventDetailsModel evm = null;
            var ms = Services.MemberService;

            if (type == 0)
            {
                //Fetch Event
                var e = EventService.GetEvent(id);

                //If it has a location fetch it
                if (e.locationId != 0)
                {
                    l = LocationService.GetLocation(e.locationId);
                }

                evm = new EventDetailsModel()
                {
                    CalendarId   = calendar,
                    Title        = e.title,
                    LocationId   = e.locationId,
                    Location     = l,
                    Descriptions = e.descriptions
                };
                if (null != e.start)
                {
                    evm.StartDate = ((DateTime)e.start).ToString("F", CultureInfo.CurrentCulture);
                }
                if (null != e.end)
                {
                    evm.EndDate = ((DateTime)e.end).ToString("F", CultureInfo.CurrentCulture);
                }
                if (e.Organisator != null && e.Organisator != 0)
                {
                    var member = ms.GetById(e.Organisator);
                    evm.Organisator = new Organisator()
                    {
                        Name = member.Name, Email = member.Email
                    };
                }
            }
            else if (type == 1)
            {
                var e = RecurringEventService.GetRecurringEvent(id);

                if (e.locationId != 0)
                {
                    l = LocationService.GetLocation(e.locationId);
                }

                Schedule schedule = new Schedule(new ScheduleWidget.ScheduledEvents.Event()
                {
                    Title                  = e.title,
                    DaysOfWeekOptions      = (DayOfWeekEnum)e.day,
                    FrequencyTypeOptions   = (FrequencyTypeEnum)e.frequency,
                    MonthlyIntervalOptions = (MonthlyIntervalEnum)e.monthly_interval
                });

                evm = new EventDetailsModel()
                {
                    CalendarId   = calendar,
                    Title        = e.title,
                    LocationId   = e.locationId,
                    Location     = l,
                    Descriptions = e.descriptions
                };

                if (null != e.start)
                {
                    var start = ((DateTime)schedule.NextOccurrence(DateTime.Now));
                    evm.StartDate = new DateTime(start.Year, start.Month, start.Day, e.start.Hour, e.start.Minute, 0).ToString("F", CultureInfo.CurrentCulture);
                }
                if (null != e.end)
                {
                    var end = ((DateTime)schedule.NextOccurrence(DateTime.Now));
                    evm.EndDate = new DateTime(end.Year, end.Month, end.Day, e.end.Hour, e.end.Minute, 0).ToString("F", CultureInfo.CurrentCulture);
                }
                if (e.Organisator != null && e.Organisator != 0)
                {
                    var member = ms.GetById(e.Organisator);
                    evm.Organisator = new Organisator()
                    {
                        Name = member.Name, Email = member.Email
                    };
                }
            }

            return(PartialView("EventDetails", evm));
        }
        public ActionResult GetEventDetails(int id, int calendar, int type = 0)
        {
            EventLocation     l   = null;
            EventDetailsModel evm = null;

            if (type == 0)
            {
                //Fetch Event
                CalendarEntry e = this._db.Single <CalendarEntry>("SELECT * FROM ec_events WHERE id=@0 AND calendarid = @1", id, calendar);
                //If it has a location fetch it
                if (e.locationId != 0)
                {
                    l = this._db.Single <EventLocation>("SELECT * FROM ec_locations WHERE id = @0", e.locationId);
                }
                //Fetch all Descriptions
                Dictionary <string, EventDesciption> descriptions = this._db.Query <EventDesciption>("SELECT * FROM ec_eventdescriptions WHERE eventid = @0 AND type = 0 AND calendarid = @1", id, calendar).ToDictionary(x => x.CultureCode);

                evm = new EventDetailsModel()
                {
                    Title        = e.title,
                    LocationId   = e.locationId,
                    Location     = l,
                    Descriptions = descriptions
                };
                if (null != e.start)
                {
                    evm.StartDate = ((DateTime)e.start).ToString("F", CultureInfo.CurrentCulture);
                }
                if (null != e.end)
                {
                    evm.EndDate = ((DateTime)e.end).ToString("F", CultureInfo.CurrentCulture);
                }
            }
            else if (type == 1)
            {
                RecurringEvent e = ApplicationContext.DatabaseContext.Database.Single <RecurringEvent>("SELECT * FROM ec_recevents WHERE id=@0 AND calendarid = @1", id, calendar);
                if (e.locationId != 0)
                {
                    l = ApplicationContext.DatabaseContext.Database.Single <EventLocation>("SELECT * FROM ec_locations WHERE id = @0", e.locationId);
                }
                Schedule schedule = new Schedule(new Event()
                {
                    Title                  = e.title,
                    DaysOfWeekOptions      = (DayOfWeekEnum)e.day,
                    FrequencyTypeOptions   = (FrequencyTypeEnum)e.frequency,
                    MonthlyIntervalOptions = (MonthlyIntervalEnum)e.monthly_interval
                });

                //Fetch all Descriptions
                Dictionary <string, EventDesciption> descriptions = this._db.Query <EventDesciption>("SELECT * FROM ec_eventdescriptions WHERE eventid = @0 AND type = 1 AND calendarid = @1", id, calendar).ToDictionary(x => x.CultureCode);

                evm = new EventDetailsModel()
                {
                    Title        = e.title,
                    LocationId   = e.locationId,
                    Location     = l,
                    StartDate    = ((DateTime)schedule.NextOccurrence(DateTime.Now)).ToString("F", CultureInfo.CurrentCulture),
                    Descriptions = descriptions
                };
            }

            return(PartialView("EventDetails", evm));
        }
        public ActionResult GetEventDetails(int id, int calendar, int type = 0)
        {
            EventLocation l = null;
            EventDetailsModel evm = null;

            var lctrl = new LocationApiController();

            if (type == 0)
            {
                //Fetch Event
                var ectrl = new EventApiController();
                var e = ectrl.GetById(id);

                //If it has a location fetch it
                if (e.locationId != 0)
                {
                    l = lctrl.GetById(e.locationId);
                }

                evm = new EventDetailsModel()
                {
                    Title = e.title,
                    LocationId = e.locationId,
                    Location = l,
                    Descriptions = e.descriptions
                };
                if (null != e.start)
                {
                    evm.StartDate = ((DateTime)e.start).ToString("F", CultureInfo.CurrentCulture);
                }
                if (null != e.end)
                {
                    evm.EndDate = ((DateTime)e.end).ToString("F", CultureInfo.CurrentCulture);
                }
            }
            else if (type == 1)
            {
                var ectrl = new REventApiController();
                var e = ectrl.GetById(id);

                if (e.locationId != 0)
                {
                    l = lctrl.GetById(e.locationId);
                }

                Schedule schedule = new Schedule(new ScheduleWidget.ScheduledEvents.Event()
                {
                    Title = e.title,
                    DaysOfWeekOptions = (DayOfWeekEnum)e.day,
                    FrequencyTypeOptions = (FrequencyTypeEnum)e.frequency,
                    MonthlyIntervalOptions = (MonthlyIntervalEnum)e.monthly_interval
                });

                evm = new EventDetailsModel()
                {
                    Title = e.title,
                    LocationId = e.locationId,
                    Location = l,
                    StartDate = ((DateTime)schedule.NextOccurrence(DateTime.Now)).ToString("F", CultureInfo.CurrentCulture),
                    Descriptions = e.descriptions
                };
            }

            return PartialView("EventDetails", evm);
        }