public static CalendarSendParams CheckSelfIntoEvent(Guid memId, Guid uid, Guid calendarId, Guid eventId, string notes, bool isTardy, CalendarEventPointTypeEnum pointType)
 {
     Random r = new Random();
     var response = Network.SendPackage(Network.ConvertObjectToStream(new CalendarSendParams() { CurrentMemberId = memId, UserId = uid, EventId = eventId, Note = notes, IsTardy = isTardy, PointType = pointType, CalendarId = calendarId }), MobileConfig.LEAGUE_CALENDAR_CHECK_SELF_IN_URL + "?r=" + r.Next());
     var stream = response.GetResponseStream();
     StreamReader read = new StreamReader(stream);
     string json = read.ReadToEnd();
     return Json.DeserializeObject<CalendarSendParams>(json);
 }
        /// <summary>
        /// checks the person into event.  Allows the person to check them selves into the event.
        /// </summary>
        /// <param name="calendarId"></param>
        /// <param name="eventId"></param>
        /// <param name="memberId"></param>
        /// <param name="note"></param>
        /// <param name="pointType"></param>
        /// <returns></returns>
        public static bool CheckSelfIn(Guid calendarId, Guid eventId, Guid memberId, string note, CalendarEventPointTypeEnum pointType, bool isTardy, int additionalPoints)
        {
            try
            {
                var dc = new ManagementContext();
                var self = (from xx in dc.CalendarEvents
                            where xx.Calendar.CalendarId == calendarId
                            where xx.CalendarItemId == eventId
                            select xx).FirstOrDefault();
                if (self == null)
                    return false;

                if (self.Attendees.Where(x => x.Attendant.MemberId == memberId).FirstOrDefault() == null)
                {
                    DataModels.Calendar.CalendarAttendance att = new DataModels.Calendar.CalendarAttendance();

                    att.Attendant = dc.Members.Where(x => x.MemberId == memberId).FirstOrDefault();
                    att.CalendarItem = self;
                    att.Note = note;
                    att.PointTypeEnum = Convert.ToInt32(pointType);
                    att.AdditionalPoints = additionalPoints;
                    if (isTardy)
                        att.SecondaryPointTypeEnum = Convert.ToInt32(CalendarEventPointTypeEnum.Tardy);
                    dc.CalendarAttendance.Add(att);
                    dc.SaveChanges();
                }
                else
                {
                    var mem = self.Attendees.Where(x => x.Attendant.MemberId == memberId).FirstOrDefault();
                    mem.PointTypeEnum = Convert.ToInt32(pointType);
                    mem.Note = note;
                    mem.AdditionalPoints = additionalPoints;
                    if (isTardy)
                        mem.SecondaryPointTypeEnum = Convert.ToInt32(CalendarEventPointTypeEnum.Tardy);
                    dc.SaveChanges();
                }
                return true;
            }
            catch (Exception exception)
            {
                Error.ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return false;
        }