public async void SetValues()
        {
            eventProfile = await fb.GetEvent(conversation.ConversationID);

            string current = fb.GetCurrentUser();

            SetTitle();
            //sendMessage.IsEnabled = false;
            List <ChatMessage> msgs = await fb.GetMessagesFromEventConversation(conversation.ConversationID);

            chats = new ObservableCollection <object>(msgs);

            if (chats != null)
            {
                messageViews = new ObservableCollection <object>();
                foreach (ChatMessage chat in chats)
                {
                    bool        yes    = (chat.Sender == current) ? true : false;
                    UserProfile sender = await fb.GetUserObject(chat.Sender);

                    sender.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(sender.Name);
                    messageViews.Add(new MessageView(sender.Name, yes, chat.Message, chat.TimeSent));
                }
                Messages.ItemsSource = messageViews;
                //Messages.HeightRequest = chats.Count * (double)45;
                Messages.IsVisible = true;
            }
            else
            {
                Messages.IsVisible = false;
            }
        }
 public void Dispose()
 {
     mockEventService = null;
     mapper           = null;
     configuration    = null;
     realProfile      = null;
 }
Esempio n. 3
0
        public async void OnView(object sender, ItemTappedEventArgs e)
        {
            var type = e.ItemIndex;

            EventProfile selectedEvent = (EventProfile)FeedEvents[type];
            var          auth          = DependencyService.Get <IFirebaseAuthenticator>();

            auth.SetCurrentEvent(selectedEvent);
            bool member = await fb.isEventMember(selectedEvent);

            string userEmail = fb.GetCurrentUser();

            // EventOwner  taps on event
            if (selectedEvent.EventOwner == userEmail)
            {
                await Navigation.PushAsync(new EventOwnerViewController(selectedEvent));
            }
            // Regular member taps on event
            else if (member)
            {
                await Navigation.PushAsync(new EventMemberViewController(selectedEvent));
            }
            else
            {
                await Navigation.PushAsync(new PublicEventController(selectedEvent));
            }

            this.ClearValue(Xamarin.Forms.ListView.SelectedItemProperty);
        }
 public EventOwnerViewController(EventProfile evt)
 {
     InitializeComponent();
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
     On <Android>().SetToolbarPlacement(value: ToolbarPlacement.Top);
     UpdateChildrenLayout();
 }
Esempio n. 5
0
        public async void SetValues()
        {
            ConversationsWith = new List <EventProfile>();
            conversations     = await fb.GetConversationsWithEvents();

            if (conversations != null && conversations.Count != 0)
            {
                foreach (Conversation convo in conversations)
                {
                    EventProfile eventProfile = await fb.GetEvent(convo.ConversationID);

                    eventProfile.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(eventProfile.Name);
                    ConversationsWith.Add(eventProfile);
                }
                double height = 40;
                chatWithEvents.HeightRequest = ConversationsWith.Count * height;
                chatWithEvents.ItemsSource   = ConversationsWith;
                activeChats.IsVisible        = true;
                noChats.IsVisible            = false;
                chatWithEvents.IsVisible     = true;
            }
            else
            {
                chatWithEvents.IsVisible = false;
                activeChats.IsVisible    = false;
                noChats.IsVisible        = true;
            }
        }
 public EventControllerTests()
 {
     mockEventService = new Mock <IEventService>();
     realProfile      = new EventProfile();
     configuration    = new MapperConfiguration(cfg => cfg.AddProfile(realProfile));
     mapper           = new Mapper(configuration);
 }
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath, EventProfile item)
        {
            var cell = tableView.DequeueReusableCell("EventProfileCell", indexPath) as EventProfileCell;

            cell.SetData(item, Post.Events);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            return(cell);
        }
        public async void Event_Tapped(object sender, ItemTappedEventArgs e)
        {
            EventProfile selectedEvent = e.Item as EventProfile;
            var          auth          = DependencyService.Get <IFirebaseAuthenticator>();

            auth.SetCurrentEvent(selectedEvent);
            await Navigation.PushAsync(new EventMemberViewController(selectedEvent));
        }
Esempio n. 9
0
 public InviteEventMembersController(EventProfile c)
 {
     Event         = c;
     SearchResults = new List <UserProfile>();
     usersToInvite = new List <string>();
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
 }
Esempio n. 10
0
 public PrivateEventController(EventProfile evt)
 {
     privateEvent = evt;
     SetValues(privateEvent);
     InitializeComponent();
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
     name.BindingContext = this;
 }
Esempio n. 11
0
        public void OnDeclineEInvite(object sender, EventArgs e)
        {
            var          type    = (MenuItem)sender;
            EventProfile profile = (EventProfile)type.CommandParameter;
            string       current = fb.GetCurrentUser();

            fb.RemoveInvite(profile.EventID, null, current);
            int index = EventInvites.IndexOf(profile);

            EventInvites.RemoveAt(index);
            NoNotifications();
        }
Esempio n. 12
0
        public static ProfileMember CreateProfileMember(EventProfile eventProfile, Person person)
        {
            ProfileMember member = new ProfileMember
            {
                ProfileID = eventProfile.ProfileID,
                PersonID  = person.PersonID,
                Source    = new Lookup(SystemLookup.TopicEntityType_EventTag),
                Status    = new Lookup(SystemLookup.ServingActivityType_StatusChange)
            };

            return(member);
        }
 public ViewEventAsOwnerController(EventProfile evt)
 {
     thisEvent = evt;
     SetValues(thisEvent);
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     name.BindingContext        = this;
     location.BindingContext    = this;
     description.BindingContext = this;
     owner.BindingContext       = this;
     eventTime.BindingContext   = this;
 }
Esempio n. 14
0
        private async void SetValues(EventProfile evt)
        {
            Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(evt.Name);
            string evtimg = await fb.GetEventPicture(evt.EventID);

            if (evtimg != null)
            {
                eventImage.Source = ImageSource.FromUri(new Uri(evtimg));
            }
            else
            {
                eventImage.Source = ImageSource.FromFile("eventimage.png");
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Executes logic for each row in the Repeater as it is bound.
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        protected void RegistrationRepeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
        {
            // Execute the following logic for Items and Alternating Items.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // Hide all rows initially--they will be made visible if they meet certain criteria.
                e.Item.Visible = false;
                // Get the promotionId for the current row.
                int intPromoId;
                // If the promotionId is a valid number, then continue.
                bool result = Int32.TryParse(((DataRowView)e.Item.DataItem)["promotion_request_id"].ToString(), out intPromoId);
                if (result)
                {
                    SqlDataReader PromoSqlDataReader = new PromotionRequestData().GetPromotionRequestByID(intPromoId, ArenaContext.Current.Organization.OrganizationID);
                    // Get the ordinal number of the "event_id" column.
                    int intEventIdColumn = PromoSqlDataReader.GetOrdinal("event_id");
                    // Confirm that the SqlDataReader has returned rows of data before continuing.
                    if (PromoSqlDataReader.HasRows)
                    {
                        // Begin reading rows of data and perform actions upon each one.
                        while (PromoSqlDataReader.Read())
                        {
                            if (!PromoSqlDataReader.IsDBNull(intEventIdColumn))
                            {
                                // Create an EventProfile object based on the event id in the current row.
                                // An EventProfile object contains methods which return properties for an event.
                                EventProfile eventProfile1 = new EventProfile(PromoSqlDataReader.GetInt32(intEventIdColumn));
                                // Determine if the event's type is to be displayed.
                                if (ItemIsEventType(eventProfile1.Type.LookupID))
                                {
                                    if (itemCounter < maxItems)
                                    {
                                        // The item meets all criteria--make the row visible.
                                        e.Item.Visible = true;
                                        itemCounter    = itemCounter + 1;
                                        // Use the EventProfile object to display data about the event in the current row.
                                        ((Label)e.Item.FindControl("StartDateLabel")).Text = ShowStartDateLabel(eventProfile1.Type.LookupID) ? HiddenDateSetting : DateTimeExtensions.ToShortDateString(eventProfile1.Start, true);
                                        ((Label)e.Item.FindControl("TopicAreaLabel")).Text = eventProfile1.TopicArea.Value;

                                        // Uncomment the following line for debugging in development only.
                                        //((Label)e.Item.FindControl("TopicAreaLabel")).Text += " | " + eventProfile1.Type.Value + " | " + ItemIsEventType(eventProfile1.Type.LookupID).ToString() + " | " + ShowStartDateLabel(eventProfile1.Type.LookupID).ToString() + " | " + DatelessEventTypeIDSetting.ToString();
                                    }
                                }
                            }
                        }
                    }
                    PromoSqlDataReader.Close();
                }
            }
        }
        public void SetData(EventProfile item, List <string> events)
        {
            string lang          = CultureInfo.CurrentCulture.Name;
            var    abbreviations = TZNames.GetAbbreviationsForTimeZone(item.TimezoneId, lang);
            string lblTimeZone   = abbreviations.Standard;

            DateTime eventDate = ConvertToUTC(item.DateOfEventUtc, item.TimezoneId);

            lblSportName.Text = item.SportName;
            lblDate.Text      = eventDate.ToString("h:mm tt") + " " + lblTimeZone;
            lblTeam1.Text     = item.Team1Name;
            lblTeam2.Text     = item.Team2Name;

            lblEventName.Text = item.Name;

            team1Task?.Cancel(item.Team1Url);
            if (!string.IsNullOrEmpty(item.Team1Url))
            {
                team1Task = new ImageLoaderHelper(item.Team1Url, imgTeam1, "DefaultProfile");
            }

            team2Task?.Cancel(item.Team2Url);
            if (!string.IsNullOrEmpty(item.Team2Url))
            {
                team2Task = new ImageLoaderHelper(item.Team2Url, imgTeam2, "DefaultProfile");
            }

            if (events.Contains(item.Id))
            {
                imgTagged.Image = UIImage.FromBundle("IconChecked");
            }
            else
            {
                imgTagged.Image = UIImage.FromBundle("IconUnchecked");
            }

            if (item.TeamCount == 2)
            {
                vwTeam1.Hidden     = false;
                vwTeam2.Hidden     = false;
                vwEventName.Hidden = true;
            }
            else
            {
                vwTeam1.Hidden     = true;
                vwTeam2.Hidden     = true;
                vwEventName.Hidden = false;
            }
        }
        public async void SetValues(EventProfile evt)
        {
            List <string> interestList = evt.Interests;

            Interests   = new List <string>();
            Name        = evt.Name;
            Location    = evt.Location;
            Description = evt.Description;
            StartTime   = evt.StartOfEvent;
            EndTime     = evt.EndOfEvent;
            EventTime   = StartTime + " to " + EndTime;

            EventID    = evt.EventID;
            EventOwner = evt.EventOwner;
            //Members = evt.Members;
            if (Location == null)
            {
                Location = "No Location Yet...";
            }
            //Interests = await fb.GetCommunityInterests(community);
            if (interestList.Count == 0)
            {
                Interests.Add("No interests listed yet...");
            }
            else
            {
                foreach (string interest in interestList)
                {
                    CultureInfo.CurrentCulture.TextInfo.ToTitleCase(interest);
                    Interests.Add(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(interest));
                }
            }
            string ln = await fb.GetUsersName(EventOwner);

            OwnerName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ln);

            interests.ItemsSource = Interests;

            string eventPictureStr = await fb.GetEventPicture(EventID);

            if (eventPictureStr != null)
            {
                imgChosen.Source = ImageSource.FromUri(new Uri(eventPictureStr));
            }
            else
            {
                imgChosen.Source = ImageSource.FromFile("eventimage.png");
            }
        }
Esempio n. 18
0
        private IEnumerable <EventProfile> GetCurrentDayEvents(DateTime currentDate)
        {
            string key = GetCacheKey(calDates.VisibleDate);

            if (Cache[key] != null)
            {
                events      = (List <EventProfile>)Cache[key];
                cccevEvents = (List <EventProfileViewModel>)Cache[key + "cccevEvents"];
                eventHash   = (Dictionary <int, EventProfile>)Cache[key + "eventHash"];
            }
            else
            {
                if (events == null)
                {
                    LoadEvents();
                }
            }

            var currentDayEvents = (from ce in cccevEvents
                                    where ce.OccurrenceStart.Date == currentDate.Date
                                    select ce).OrderBy(ce => ce.OccurrenceStart);

            foreach (EventProfileViewModel e in currentDayEvents)
            {
                EventProfile p          = eventHash[e.ProfileID];
                EventProfile newProfile = new EventProfile
                {
                    ProfileID  = p.ProfileID,
                    Name       = p.Name,
                    Start      = e.OccurrenceStart,
                    ForiegnKey = e.OccurrenceID.ToString()
                };

                if (p.LocationId != -1)
                {
                    newProfile.Location = p.Location;
                }
                else
                {
                    Arena.Organization.Location location = new Arena.Organization.Location
                    {
                        BuildingName = new Occurrence(e.OccurrenceID).Location
                    };
                    newProfile.Location = location;
                }

                yield return(newProfile);
            }
        }
Esempio n. 19
0
        private void SendEmail(EventProfile profile, int occurrenceID)
        {
            string subject = EventEmailSubjectSetting;
            string body    = EventEmailBodySetting.Trim() != string.Empty ? EventEmailBodySetting : CurrentModule.Details;

            foreach (KeyValuePair <string, string> field in BuildMergeFields(profile, occurrenceID))
            {
                subject = subject.Replace(field.Key, field.Value);
                body    = body.Replace(field.Key, field.Value);
            }

            string fromEmail = CurrentPerson != null ? CurrentPerson.Emails.FirstActive : DefaultFromEmailAddressSetting;

            new PersonCommunicationType().Send(fromEmail, tbFrom.Text, tbEmailAddress.Text, subject, body);
        }
Esempio n. 20
0
        public static ProfileOccurrence CreateProfileOccurrence(EventProfile eventProfile, Occurrence occurrence)
        {
            ProfileOccurrence profileOccurrence = new ProfileOccurrence
            {
                LocationID       = occurrence.LocationID,
                Name             = eventProfile.Name,
                OccurrenceClosed = occurrence.OccurrenceClosed,
                OccurrenceID     = occurrence.OccurrenceID,
                OccurrenceType   = occurrence.OccurrenceType,
                ProfileID        = eventProfile.ProfileID,
                StartTime        = occurrence.StartTime
            };

            return(profileOccurrence);
        }
Esempio n. 21
0
        public async void OnAcceptEInvite(object sender, EventArgs e)
        {
            var type = (MenuItem)sender;

            if (type.CommandParameter.ToString() == "LetsGo.Model.EventProfile")
            {
                EventProfile profile     = (EventProfile)type.CommandParameter;
                string       current     = fb.GetCurrentUser();
                UserProfile  currentUser = await fb.GetUserObject(current);

                fb.AcceptRequest(profile, null, currentUser);
                EventInvites.Remove(type.CommandParameter);
            }
            NoNotifications();
        }
Esempio n. 22
0
        public static EventProfile CreateEventProfile(Occurrence occurrence)
        {
            EventProfile eventProfile = new EventProfile
            {
                CategoryLevel  = false,
                Details        = "Test event profile",
                End            = occurrence.EndTime,
                Location       = new Location(occurrence.LocationID),
                Name           = "Test Event",
                OrganizationID = 1,
                Start          = occurrence.StartTime,
                ETicketEnabled = false
            };

            return(eventProfile);
        }
Esempio n. 23
0
        public async void SetValues(EventProfile evt)
        {
            Name        = evt.Name;
            Interests   = new List <string>();
            Location    = evt.Location;
            Description = evt.Description;
            EventID     = evt.EventID;
            bool isUser = await fb.IsUser(evt.EventOwner);

            EventOwner = evt.EventOwner;
            if (isUser)
            {
                string ln = await fb.GetUsersName(EventOwner);

                OwnerName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ln);
            }
            else
            {
                CommunityProfile ln = await fb.GetCommunity(evt.EventOwner);

                OwnerName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ln.Name);
            }
            if (Location == null)
            {
                Location = "No Location Yet...";
            }
            //Interests = await fb.GetCommunityInterests(id);
            if (Interests.Count == 0)
            {
                Interests.Add("No interests listed yet...");
            }


            string eventPictureStr = await fb.GetEventPicture(EventID);

            if (eventPictureStr != null)
            {
                imgChosen.Source = ImageSource.FromUri(new Uri(eventPictureStr));
            }
            else
            {
                imgChosen.Source = ImageSource.FromFile("eventimage.png");
            }
            EventImage = imgChosen;
        }
Esempio n. 24
0
        private Dictionary <string, string> BuildMergeFields(EventProfile profile, int occurrenceID)
        {
            Dictionary <string, string> fields =
                new Dictionary <string, string>
            {
                { "##To##", tbTo.Text.Trim() != string.Empty ? tbTo.Text : tbEmailAddress.Text },
                { "##ToEmail##", tbEmailAddress.Text },
                { "##From##", tbFrom.Text.Trim() != string.Empty ? tbFrom.Text : DefaultFromEmailAddressSetting },
                { "##EventTitle##", profile.Title },
                { "##EventSummary##", profile.Summary },
                { "##EventImage##", string.Format("<img src=\"{0}/CachedBlob.aspx?guid={1}&width={2}&height={3}\" height=\"{3}\" width=\"{2}\">",
                                                  Utilities.GetApplicationPath(), profile.Image.GUID, EventEmailImageWidthSetting, EventEmailImageHeightSetting) },
                { "##URL##", string.Format("{0}/Default.aspx?page={1}&profileId={2}&occurrenceId={3}",
                                           Utilities.GetApplicationPath(), EventDetailsPageSetting, profile.ProfileID, occurrenceID) }
            };

            return(fields);
        }
Esempio n. 25
0
        public async void Event_Tapped(object sender, ItemTappedEventArgs e)
        {
            EventProfile selectedEvent = e.Item as EventProfile;
            var          auth          = DependencyService.Get <IFirebaseAuthenticator>();

            auth.SetCurrentEvent(selectedEvent);
            string userEmail = fb.GetCurrentUser();

            // Event Owner taps on event
            if (selectedEvent.EventOwner == userEmail)
            {
                await Navigation.PushAsync(new EventOwnerViewController(selectedEvent));
            }
            // Regular member taps on event
            else
            {
                await Navigation.PushAsync(new EventMemberViewController(selectedEvent));
            }
        }
        public async void SetValues()
        {
            string current = fb.GetCurrentUser();

            MembersList = new ObservableCollection <UserProfile>();
            var                auth      = DependencyService.Get <IFirebaseAuthenticator>();
            EventProfile       thisEvent = auth.GetCurrentEvent();
            List <UserProfile> profiles  = await fb.GetEventMembers(thisEvent);

            MembersList = new ObservableCollection <UserProfile>(profiles);

            if (MembersList.Count == 0)
            {
                MembersList.Add(new UserProfile()
                {
                    Name = "This Event has no members yet..."
                });
            }
            members.ItemsSource = MembersList;
        }
        void GetData()
        {
            DateTime eventDate = DateTime.Now;
            var      apiTask   = new ServiceApi().GetEventProfile(EventId);

            apiTask.HandleError();
            apiTask.OnSucess(response =>
            {
                this.profile     = response.Result;
                lblTitle.Text    = response.Result.Name;
                lblSport.Text    = response.Result.SportName;
                lblLocation.Text = response.Result.Location;
                eventDate        = ConvertToUTC(response.Result.DateOfEventUtc, response.Result.TimezoneId);
                lblDate.Text     = eventDate.ToString("D");
                if (response.Result.IsTbd)
                {
                    lblTime.Text = "TBD";
                }
                else
                {
                    string lang       = CultureInfo.CurrentCulture.Name;
                    var abbreviations = TZNames.GetAbbreviationsForTimeZone(response.Result.TimezoneId, lang);

                    lblTime.Text = eventDate.ToString("h:mm tt") + " " + abbreviations.Standard;
                }

                lblName.Text      = response.Result.Name;
                lblEventName.Text = profile.Name;

                if (!string.IsNullOrEmpty(profile.Team1Url))
                {
                    ImageService.Instance.LoadUrl(profile.Team1Url).Retry(3, 300).Into(imgTeam1);
                }

                if (!string.IsNullOrEmpty(profile.Team2Url))
                {
                    ImageService.Instance.LoadUrl(profile.Team2Url).Retry(3, 300).Into(imgTeam2);
                }

                lblTeam1Name.Text = profile.Team1Name;
                lblTeam2Name.Text = profile.Team2Name;

                imgRight.UserInteractionEnabled = true;

                if (string.IsNullOrEmpty(profile.TicketUrl))
                {
                    imgRight.Hidden = true;
                }

                if (profile.DateOfEventUtc <= DateTime.UtcNow)
                {
                    if (profile.TeamCount == 2)
                    {
                        lcRightWidth.Constant = 0;
                    }
                    else
                    {
                        imgRight.Hidden = false;
                    }

                    imgRight.Image = null;
                    if (!string.IsNullOrEmpty(profile.WinningTeamUrl))
                    {
                        ImageService.Instance.LoadUrl(profile.WinningTeamUrl).Retry(3, 300).Into(imgRight);
                    }

                    imgRight.UserInteractionEnabled = false;
                }

                var boldAttributes             = new UIStringAttributes();
                boldAttributes.Font            = UIFont.BoldSystemFontOfSize(btnShowTeams.Font.PointSize);
                boldAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);

                var regularAttributes             = new UIStringAttributes();
                regularAttributes.Font            = UIFont.SystemFontOfSize(btnShowTeams.Font.PointSize);
                regularAttributes.ForegroundColor = UIColor.FromRGB(144, 144, 144);

                NSMutableAttributedString attributedString = new NSMutableAttributedString("Show me all ", regularAttributes);
                attributedString.Append(new NSMutableAttributedString(profile.TeamCount.ToString() + " teams", boldAttributes));
                btnShowTeams.SetAttributedTitle(attributedString, UIControlState.Normal);

                if (profile.TeamCount == 2)
                {
                    vwTwoTeams.Hidden  = false;
                    vwManyTeams.Hidden = true;
                }
                else
                {
                    vwTwoTeams.Hidden  = true;
                    vwManyTeams.Hidden = false;
                }

                lblPosts.Text = LargeValueHelper.GetString(response.Result.Posts);

                lblTeam1Score.Text = response.Result.Team1Score;
                lblTeam2Score.Text = response.Result.Team2Score;
            });
        }
Esempio n. 28
0
 public void SetCurrentEvent(EventProfile evt)
 {
     CurrentEvent = evt;
 }
        private void BuildMonth(int month, int year, ref TableRow row, ref TableCell cell, DataTable dtCalendar, String[] dayNames)
        {
            int daysPrinted = 0;

            // Add month name row
            row  = new TableRow();
            cell = new TableCell();
            cell.HorizontalAlign = HorizontalAlign.Center;
            cell.ColumnSpan      = 7;
            cell.Text            = monthNames[month - 1] + ", " + year.ToString();
            cell.CssClass        = "calendarDateTitle";
            row.Cells.Add(cell);
            tblCalendar.Rows.Add(row);

            // determine day of the week of the first of the month
            DateTime firstOfMonth       = new DateTime(year, month, 1);
            int      positionOfFirstDay = Convert.ToInt32(firstOfMonth.DayOfWeek);

            // write day headings
            row = new TableRow();
            for (int i = 0; i <= 6; i++)
            {
                cell = new TableCell();
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.Width           = Unit.Percentage(14);
                cell.Text            = dayNames[i];
                cell.CssClass        = "calendarDayHeadingCell";
                row.Cells.Add(cell);
            }
            tblCalendar.Rows.Add(row);

            // load up blank days
            row = new TableRow();
            for (int i = 1; i <= positionOfFirstDay; i++)
            {
                cell          = new TableCell();
                cell.CssClass = "calendarBlankCell";
                cell.Text     = "&nbsp;";
                row.Cells.Add(cell);
                daysPrinted++;
            }

            int daysInMonth = DateTime.DaysInMonth(year, month);

            for (int i = 1; i <= daysInMonth; i++)
            {
                if (daysPrinted == 7)
                {
                    tblCalendar.Rows.Add(row);
                    row         = new TableRow();
                    daysPrinted = 0;
                }

                DateTime curDate = DateTime.Parse(month.ToString() + "/" + i.ToString() + "/" + year.ToString());

                // get events for current day
                string filter = "occurrence_end_time >= #" + curDate.ToShortDateString() + "# " +
                                "and occurrence_start_time < #" + curDate.AddDays(1).ToShortDateString() + "# ";

                //filter = "OccId > 0";
                DataRow[] events = dtCalendar.Select(filter);

                cell               = new TableCell();
                cell.CssClass      = "calendarCell";
                cell.VerticalAlign = VerticalAlign.Top;
                cell.Text          = "<span class=\"calendarNumber\">" + i.ToString() + "</span><ul class=\"calendarItemList\">";

                foreach (DataRow eventRow in events)
                {
                    EventProfile eProfile  = new EventProfile((int)eventRow["profile_id"]);
                    DateTime     StartTime = ((DateTime)eventRow["occurrence_start_time"]);
                    DateTime     EndTime   = ((DateTime)eventRow["occurrence_end_time"]);
                    string       eventDesc = eProfile.Summary;
                    eventDesc = eventDesc.Replace("'", "\\'");
                    eventDesc = eventDesc.Replace("\"", "\\'");
                    eventDesc = Utilities.replaceCRLF(eventDesc);

                    cell.Text += "<li>";
                    if (ShowTimesSetting.ToLower() == "true")
                    {
                        StringBuilder eTime = new StringBuilder();
                        if (StartTime < curDate)
                        {
                            eTime.Append("12:00 AM - ");
                        }
                        else
                        {
                            eTime.AppendFormat("{0} - ", StartTime.ToShortTimeString());
                        }

                        if (EndTime > curDate.AddDays(1).AddSeconds(-1))
                        {
                            eTime.Append("11:59 PM<br/>");
                        }
                        else
                        {
                            eTime.AppendFormat("{0}<br/>", EndTime.ToShortTimeString());
                        }

                        cell.Text += eTime.ToString();
                    }

                    string href = string.Empty;
                    if (eProfile.ExternalLink.Trim() != string.Empty)
                    {
                        href = eProfile.ExternalLink.Trim();
                    }
                    else
                    {
                        href = string.Format("default.aspx?page={0}&occurrenceId={1}&profileId={2}",
                                             DetailPageIdSetting, eventRow["occurrence_id"].ToString(), eProfile.ProfileID.ToString());
                    }

                    cell.Text += string.Format("<a href=\"{0}\" class=\"calendarItemLink\" onmousemove=\"javascript:get_mouse(event);\" onmouseover=\"javascript:popup('{1}')\" onmouseout=\"kill();\">{2}</a><br/><br/>\n",
                                               href, eventDesc, eProfile.Name);
                }
                cell.Text += "</ul>";
                row.Cells.Add(cell);

                daysPrinted++;
            }

            for (int i = daysPrinted; i < 7; i++)
            {
                cell          = new TableCell();
                cell.CssClass = "calendarBlankCell";
                cell.Text     = "&nbsp;";
                row.Cells.Add(cell);
            }

            // add final row
            tblCalendar.Rows.Add(row);
        }
        /// <summary>
        /// Executes logic for each row in the Repeater as it is bound.
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        protected void RegistrationRepeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
        {
            // Execute the following logic for Items and Alternating Items.
              if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
              {
            // Hide all rows initially--they will be made visible if they meet certain criteria.
            e.Item.Visible = false;
            // Get the promotionId for the current row.
            int intPromoId;
            // If the promotionId is a valid number, then continue.
            bool result = Int32.TryParse(((DataRowView)e.Item.DataItem)["promotion_request_id"].ToString(), out intPromoId);
            if (result)
            {
              SqlDataReader PromoSqlDataReader = new PromotionRequestData().GetPromotionRequestByID(intPromoId, ArenaContext.Current.Organization.OrganizationID);
              // Get the ordinal number of the "event_id" column.
              int intEventIdColumn = PromoSqlDataReader.GetOrdinal("event_id");
              // Confirm that the SqlDataReader has returned rows of data before continuing.
              if (PromoSqlDataReader.HasRows)
              {
            // Begin reading rows of data and perform actions upon each one.
            while (PromoSqlDataReader.Read())
            {
              if (!PromoSqlDataReader.IsDBNull(intEventIdColumn))
              {
                // Create an EventProfile object based on the event id in the current row.
                // An EventProfile object contains methods which return properties for an event.
                EventProfile eventProfile1 = new EventProfile(PromoSqlDataReader.GetInt32(intEventIdColumn));
                // Determine if the event's type is to be displayed.
                if (ItemIsEventType(eventProfile1.Type.LookupID))
                {
                  if (itemCounter < maxItems)
                  {
                    // The item meets all criteria--make the row visible.
                    e.Item.Visible = true;
                    itemCounter = itemCounter + 1;
                    // Use the EventProfile object to display data about the event in the current row.
                    ((Label)e.Item.FindControl("StartDateLabel")).Text = ShowStartDateLabel(eventProfile1.Type.LookupID) ? HiddenDateSetting : DateTimeExtensions.ToShortDateString(eventProfile1.Start, true);
                    ((Label)e.Item.FindControl("TopicAreaLabel")).Text = eventProfile1.TopicArea.Value;

                    // Uncomment the following line for debugging in development only.
                    //((Label)e.Item.FindControl("TopicAreaLabel")).Text += " | " + eventProfile1.Type.Value + " | " + ItemIsEventType(eventProfile1.Type.LookupID).ToString() + " | " + ShowStartDateLabel(eventProfile1.Type.LookupID).ToString() + " | " + DatelessEventTypeIDSetting.ToString();
                  }
                }
              }
            }
              }
              PromoSqlDataReader.Close();
            }
              }
        }
        View GetView(EventProfile item, int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                view = LayoutInflater.Inflate(Resource.Layout.EventProfileItem, null);
            }

            string lang          = CultureInfo.CurrentCulture.Name;
            var    abbreviations = TZNames.GetAbbreviationsForTimeZone(item.TimezoneId, lang);
            string lblTimeZone   = abbreviations.Standard;

            view.FindViewById <TextView>(Resource.Id.lblTeam1).Text     = item.Team1Name;
            view.FindViewById <TextView>(Resource.Id.lblTeam2).Text     = item.Team2Name;
            view.FindViewById <TextView>(Resource.Id.lblEventName).Text = item.Name;
            view.FindViewById <TextView>(Resource.Id.lblSport).Text     = item.SportName;
            //view.FindViewById<TextView>(Resource.Id.lblTime).Text = item.DateOfEventUtc.ToLocalTime().ToString("hh:mm tt") + " " + lblTimeZone;
            if (item.IsTbd)
            {
                view.FindViewById <TextView>(Resource.Id.lblTime).Text = "TBD" + " " + lblTimeZone;
            }
            else
            {
                DateTime eventDate = ConvertToUTC(item.DateOfEventUtc, item.TimezoneId);
                //view.FindViewById<TextView>(Resource.Id.lblTime).Text = item.DateOfEventUtc.ToString("hh:mm tt") + " " + lblTimeZone;
                view.FindViewById <TextView>(Resource.Id.lblTime).Text = eventDate.ToString("hh:mm tt") + " " + lblTimeZone;
            }

            var team2ImageView = view.FindViewById <ImageViewAsync>(Resource.Id.imgTeam2);

            team2ImageView.Tag?.CancelPendingTask(item.Team2Url);
            var task2 = ImageService.Instance.LoadUrl(item.Team2Url)
                        .Retry(3, 300)
                        .LoadingPlaceholder(Resource.Drawable.DefProfPic.ToString(), ImageSource.CompiledResource)
                        .Into(team2ImageView);

            team2ImageView.Tag = new ImageLoaderHelper(task2);

            var team1ImageView = view.FindViewById <ImageViewAsync>(Resource.Id.imgTeam1);

            team1ImageView.Tag?.CancelPendingTask(item.Team1Url);
            var task = ImageService.Instance.LoadUrl(item.Team1Url)
                       .Retry(3, 300)
                       .LoadingPlaceholder(Resource.Drawable.DefProfPic.ToString(), ImageSource.CompiledResource)
                       .Into(team1ImageView);

            team1ImageView.Tag = new ImageLoaderHelper(task);

            if (item.TeamCount == 2)
            {
                view.FindViewById <LinearLayout>(Resource.Id.llTeam1).Visibility  = ViewStates.Visible;
                view.FindViewById <LinearLayout>(Resource.Id.llTeam2).Visibility  = ViewStates.Visible;
                view.FindViewById <TextView>(Resource.Id.lblEventName).Visibility = ViewStates.Gone;
            }
            else
            {
                view.FindViewById <LinearLayout>(Resource.Id.llTeam1).Visibility  = ViewStates.Gone;
                view.FindViewById <LinearLayout>(Resource.Id.llTeam2).Visibility  = ViewStates.Gone;
                view.FindViewById <TextView>(Resource.Id.lblEventName).Visibility = ViewStates.Visible;
            }

            if (Post.Events.Contains(item.Id))
            {
                view.FindViewById <ImageView>(Resource.Id.imgTagged).SetImageResource(Resource.Drawable.CheckYES);
            }
            else
            {
                view.FindViewById <ImageView>(Resource.Id.imgTagged).SetImageResource(Resource.Drawable.CheckNO);
            }

            return(view);
        }