예제 #1
0
        public async void SetValues(CommunityProfile comm)
        {
            Name        = comm.Name;
            Interests   = new List <string>();
            Location    = comm.Location;
            Description = comm.Description;
            CommunityID = comm.CommunityID;
            Leader      = comm.Leader;
            if (Location == null)
            {
                Location = "No Location Yet...";
            }
            //Interests = await fb.GetCommunityInterests(id);
            if (Interests.Count == 0)
            {
                Interests.Add("No interests listed yet...");
            }
            string ln = await fb.GetUsersName(Leader);

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

            string communityPictureStr = await fb.GetCommunityPicture(CommunityID);

            if (communityPictureStr != null)
            {
                imgChosen.Source = ImageSource.FromUri(new Uri(communityPictureStr));
            }
            else
            {
                imgChosen.Source = ImageSource.FromFile("communityimage.jpg");
            }
            CommunityImage = imgChosen;
        }
예제 #2
0
        public async void SetValues()
        {
            ConversationsWith = new List <CommunityProfile>();
            conversations     = await fb.GetConversationsWithCommunities();

            if (conversations != null && conversations.Count != 0)
            {
                foreach (Conversation convo in conversations)
                {
                    CommunityProfile community = await fb.GetCommunity(convo.ConversationID);

                    community.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(community.Name);
                    ConversationsWith.Add(community);
                }
                double height = 40;
                chatWithCommunities.HeightRequest = ConversationsWith.Count * height;
                chatWithCommunities.ItemsSource   = ConversationsWith;
                activeChats.IsVisible             = true;
                noChats.IsVisible             = false;
                chatWithCommunities.IsVisible = true;
            }
            else
            {
                chatWithCommunities.IsVisible = false;
                activeChats.IsVisible         = false;
                noChats.IsVisible             = true;
            }
        }
예제 #3
0
 public CommunityMemberViewController(CommunityProfile c)
 {
     InitializeComponent();
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
     On <Android>().SetToolbarPlacement(value: ToolbarPlacement.Top);
     UpdateChildrenLayout();
 }
예제 #4
0
        public async void SetValues()
        {
            community = await fb.GetCommunity(conversation.ConversationID);

            string current = fb.GetCurrentUser();

            SetTitle();
            //sendMessage.IsEnabled = false;
            List <ChatMessage> msgs = await fb.GetMessagesFromCommunityConversation(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 AppointNewLeaderController(CommunityProfile c)
 {
     community     = c;
     SearchResults = new List <UserProfile>();
     userToAppoint = new UserProfile();
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
 }
예제 #6
0
 public PrivateCommunityController(CommunityProfile comm)
 {
     community = comm;
     InitializeComponent();
     SetValues(community);
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
     name.BindingContext = this;
 }
 public InviteCommunityMembersController(CommunityProfile c)
 {
     community     = c;
     SearchResults = new List <UserProfile>();
     usersToInvite = new List <string>();
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
 }
 public ViewCommunityMemberController(CommunityProfile c)
 {
     comm = c;
     SetValues(comm);
     InitializeComponent();
     name.BindingContext        = this;
     location.BindingContext    = this;
     description.BindingContext = this;
     leader.BindingContext      = this;
 }
예제 #9
0
 public ViewCommunityLeaderController(CommunityProfile c)
 {
     community = c;
     SetValues(community);
     InitializeComponent();
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
     name.BindingContext        = this;
     location.BindingContext    = this;
     description.BindingContext = this;
     leader.BindingContext      = this;
 }
예제 #10
0
        public void OnDeclineCInvite(object sender, EventArgs e)
        {
            var type = (MenuItem)sender;
            CommunityProfile profile = (CommunityProfile)type.CommandParameter;
            string           current = fb.GetCurrentUser();

            fb.RemoveInvite(null, profile.CommunityID, current);
            int index = CommunityInvites.IndexOf(profile);

            CommunityInvites.RemoveAt(index);
            NoNotifications();
        }
예제 #11
0
        private async void SetValues(CommunityProfile comm)
        {
            Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(comm.Name);
            string commimg = await fb.GetCommunityPicture(comm.CommunityID);

            if (commimg != null)
            {
                commImage.Source = ImageSource.FromUri(new Uri(commimg));
            }
            else
            {
                commImage.Source = ImageSource.FromFile("communityimage.jpg");
            }
            CommunityImage = commImage;
        }
예제 #12
0
        public async void OnAcceptCInvite(object sender, EventArgs e)
        {
            var type = (MenuItem)sender;

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

                fb.AcceptRequest(null, profile, currentUser);
                CommunityInvites.Remove(type.CommandParameter);
            }
            NoNotifications();
        }
        public async void SetValues(CommunityProfile community)
        {
            Events = await fb.GetCommunityEvents(community);

            if (Events.Count == 0)
            {
                Events = new List <EventProfile>();
                Events.Add(new EventProfile("This community has no events.", "No description available", DateTime.Today,
                                            "00:00:00", "00:00:00", "No location", "No owner", "no interests,", true));
                CommEvents           = new ObservableCollection <EventProfile>(Events);
                ListEvents.IsVisible = false;
                noEvents.IsVisible   = true;
            }
            CommEvents             = new ObservableCollection <EventProfile>(Events);
            ListEvents.ItemsSource = CommEvents;
        }
예제 #14
0
        public async void SetValues(CommunityProfile community)
        {
            List <string> interestList = community.Interests;

            Interests   = new List <string>();
            Name        = community.Name;
            Location    = community.Location;
            Description = community.Description;

            CommunityID = community.CommunityID;
            Leader      = community.Leader;
            Members     = community.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(Leader);

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

            interests.ItemsSource = Interests;

            string communityPictureStr = await fb.GetCommunityPicture(CommunityID);

            if (communityPictureStr != null)
            {
                imgChosen.Source = ImageSource.FromUri(new Uri(communityPictureStr));
            }
            else
            {
                imgChosen.Source = ImageSource.FromFile("communityimage.jpg");
            }
        }
예제 #15
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;
        }
        public async void SetValues()
        {
            string current = fb.GetCurrentUser();

            MembersList = new ObservableCollection <UserProfile>();
            var auth = DependencyService.Get <IFirebaseAuthenticator>();
            CommunityProfile   community = auth.GetCurrentCommunity();
            List <UserProfile> profiles  = await fb.GetCommunityMembers(community);

            MembersList = new ObservableCollection <UserProfile>(profiles);

            if (MembersList.Count == 0)
            {
                MembersList.Add(new UserProfile()
                {
                    Name = "This community has no members yet..."
                });
            }
            members.ItemsSource = MembersList;
        }
예제 #17
0
        public async void Community_Tapped(object sender, ItemTappedEventArgs e)
        {
            CommunityProfile selectedCommunity = e.Item as CommunityProfile;
            var auth = DependencyService.Get <IFirebaseAuthenticator>();

            auth.SetCurrentCommunity(selectedCommunity);
            string userEmail = fb.GetCurrentUser();

            // Community Leader taps on community
            if (selectedCommunity.Leader == userEmail)
            {
                await Navigation.PushAsync(new CommunityLeaderViewController(selectedCommunity));
            }
            // Regular member taps on community
            else
            {
                await Navigation.PushAsync(new CommunityMemberViewController(selectedCommunity));

                //await Navigation.PushAsync(new ViewCommunityMemberController(selectedCommunity));
            }
        }
예제 #18
0
 public void SetCurrentCommunity(CommunityProfile comm)
 {
     CurrentCommunity = comm;
 }
예제 #19
0
        public async void OnView(object sender, ItemTappedEventArgs e)
        {
            var type = e.ItemIndex;

            if (SearchResults[type].ToString() == "LetsGo.Model.UserProfile")
            {
                UserProfile profile = (UserProfile)SearchResults[type];
                bool        friend  = await fb.isFriend(profile.Email);

                if (friend)
                {
                    await Navigation.PushAsync(new FriendProfileController(profile));
                }
                else if (profile.PublicAcct)
                {
                    await Navigation.PushAsync(new PublicProfileController(profile));
                }
                else if (!profile.PublicAcct)
                {
                    await Navigation.PushAsync(new PrivateProfileController(profile));
                }
            }
            else if (SearchResults[type].ToString() == "LetsGo.Model.CommunityProfile")
            {
                CommunityProfile selectedCommunity = e.Item as CommunityProfile;
                var auth = DependencyService.Get <IFirebaseAuthenticator>();
                auth.SetCurrentCommunity(selectedCommunity);
                bool member = await fb.isCommunityMember(selectedCommunity);

                string userEmail = fb.GetCurrentUser();
                // Community Leader taps on community
                if (selectedCommunity.Leader == userEmail)
                {
                    await Navigation.PushAsync(new CommunityLeaderViewController(selectedCommunity));
                }
                // Regular member taps on community
                else if (member)
                {
                    await Navigation.PushAsync(new CommunityMemberViewController(selectedCommunity));
                }
                else if (selectedCommunity.PublicCommunity)
                {
                    await Navigation.PushAsync(new PublicCommunityController(selectedCommunity));
                }
                else if (!selectedCommunity.PublicCommunity)
                {
                    await Navigation.PushAsync(new PrivateCommunityController(selectedCommunity));
                }
            }
            else if (SearchResults[type].ToString() == "LetsGo.Model.EventProfile")
            {
                EventProfile selectedEvent = (EventProfile)SearchResults[type];
                var          auth          = DependencyService.Get <IFirebaseAuthenticator>();
                auth.SetCurrentEvent(selectedEvent);
                bool member = await fb.isEventMember(selectedEvent);

                string userEmail  = fb.GetCurrentUser();
                bool   userOrComm = await fb.IsUser(selectedEvent.EventOwner);

                // Event Owner taps on event

                if (userOrComm && selectedEvent.EventOwner == userEmail)
                {
                    await Navigation.PushAsync(new EventOwnerViewController(selectedEvent));
                }
                // Regular member taps on event
                else if (member)
                {
                    await Navigation.PushAsync(new EventMemberViewController(selectedEvent));
                }
                else if (selectedEvent.PublicEvent)
                {
                    await Navigation.PushAsync(new PublicEventController(selectedEvent));
                }
                else if (!selectedEvent.PublicEvent)
                {
                    await Navigation.PushAsync(new PrivateEventController(selectedEvent));
                }
            }
            this.ClearValue(ListView.SelectedItemProperty);
        }
예제 #20
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            GetLoginHTMLState();

            if (HttpContext.Session.GetString(SessionLoggedIn) != null)
            {
                if (HttpContext.Session.GetString(SessionLoggedIn).ToString().Equals(SessionLoggedInTrue))
                {
                    return(RedirectToAction("Profile"));
                }
            }

            if (HttpContext.Session.GetString(SessionLoggedIn) == null)
            {
                HttpContext.Session.SetString(SessionLoggedIn, SessionLoggedInFalse);
            }

            //cookie data
            if (HttpContext.Session.GetString(SessionKeySecretAnswer) == null)
            {
                if (HttpContext.Session.GetString(SessionKeyRegisterName) != null &&
                    HttpContext.Session.GetString(SessionKeyRegisterEmail) != null &&
                    HttpContext.Session.GetString(SessionKeyRegisterPassword) != null)
                {
                    var RegisterUsername = HttpContext.Session.GetString(SessionKeyRegisterName);
                    HttpContext.Session.SetString(SessionKeyRegisterName, "");

                    var RegisterEmail = HttpContext.Session.GetString(SessionKeyRegisterEmail);
                    HttpContext.Session.SetString(SessionKeyRegisterEmail, "");

                    var RegisterPassword = HttpContext.Session.GetString(SessionKeyRegisterPassword);
                    HttpContext.Session.SetString(SessionKeyRegisterPassword, "");

                    var RegisterSalt = HttpContext.Session.GetString(SessionUserSalt);
                    HttpContext.Session.SetString(SessionUserSalt, "");


                    if (!RegisterUsername.ToString().Equals("") &&
                        !RegisterEmail.ToString().Equals("") &&
                        !RegisterPassword.ToString().Equals("") &&
                        !RegisterSalt.ToString().Equals("")
                        )
                    {
                        ApplicationUser applicationUser = new ApplicationUser();
                        applicationUser.ApplicationUserID = Guid.NewGuid().GetHashCode();
                        applicationUser.Username          = RegisterUsername;
                        applicationUser.Email             = RegisterEmail;
                        applicationUser.Salt     = RegisterSalt;
                        applicationUser.Password = RegisterPassword;
                        applicationUser.Type     = "Basic";
                        CommunityProfile profile = new CommunityProfile();
                        profile.CommunityProfileID       = Guid.NewGuid().GetHashCode();
                        profile.CommunityProfileUsername = applicationUser.Username;
                        profile.SaveDetails();
                        applicationUser.SaveDetails();
                    }
                }
            }
            else
            {
                if (HttpContext.Session.GetString(SessionKeyRegisterName) != null &&
                    HttpContext.Session.GetString(SessionKeyRegisterEmail) != null &&
                    HttpContext.Session.GetString(SessionKeyRegisterPassword) != null)
                {
                    var RegisterUsername = HttpContext.Session.GetString(SessionKeyRegisterName);
                    HttpContext.Session.SetString(SessionKeyRegisterName, "");

                    var RegisterEmail = HttpContext.Session.GetString(SessionKeyRegisterEmail);
                    HttpContext.Session.SetString(SessionKeyRegisterEmail, "");

                    var RegisterPassword = HttpContext.Session.GetString(SessionKeyRegisterPassword);
                    HttpContext.Session.SetString(SessionKeyRegisterPassword, "");

                    var RegisterSalt = HttpContext.Session.GetString(SessionUserSalt);
                    HttpContext.Session.SetString(SessionUserSalt, "");


                    var SecretAnswer = HttpContext.Session.GetString(SessionKeySecretAnswer);
                    HttpContext.Session.SetString(SessionKeySecretAnswer, "");



                    if (!RegisterUsername.ToString().Equals("") &&
                        !RegisterEmail.ToString().Equals("") &&
                        !RegisterPassword.ToString().Equals("") &&
                        !RegisterSalt.ToString().Equals("") &&
                        !SecretAnswer.ToString().Equals("")
                        )
                    {
                        ApplicationUser applicationUser = new ApplicationUser();
                        applicationUser.ApplicationUserID = Guid.NewGuid().GetHashCode();
                        applicationUser.Username          = RegisterUsername;
                        applicationUser.Email             = RegisterEmail;
                        applicationUser.Salt     = RegisterSalt;
                        applicationUser.Password = RegisterPassword;
                        applicationUser.Type     = "Admin";
                        CommunityProfile profile = new CommunityProfile();
                        profile.CommunityProfileID       = Guid.NewGuid().GetHashCode();
                        profile.CommunityProfileUsername = applicationUser.Username;
                        profile.SaveDetails();
                        applicationUser.SaveDetails();
                    }
                }
            }

            if (HttpContext.Session.GetString(SessionLoggedIn).ToString().Equals(SessionLoggedInTrue))
            {
                return(RedirectToAction("Profile"));
            }

            if (HttpContext.Session.GetString(SessionKeyErrorOccured) != null)
            {
                ViewData["LoginError"] = HttpContext.Session.GetString(SessionKeyErrorOccured);
            }

            return(View());
        }
예제 #21
0
 public CreateEventController(CommunityProfile c)
 {
     community = c;
     InitializeComponent();
     ((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#51aec2");
 }
        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;
            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);
            }
            //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));
                }
            }

            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");
            }
        }
        public async void OnOwnerName_Clicked(object sender, EventArgs e)
        {
            bool isUser = await fb.IsUser(EventOwner);

            string userEmail = fb.GetCurrentUser();

            if (isUser)
            {
                bool publicOwner = await fb.IsPublicUser(EventOwner);

                bool isFriendOfOwner = await fb.isFriend(EventOwner);

                // leader is the current user
                if (userEmail == EventOwner)
                {
                    await Navigation.PushAsync(new ProfileController());
                }
                // leader is a friend of current user
                else if (isFriendOfOwner)
                {
                    UserProfile friend = await fb.GetUserObject(EventOwner);

                    await Navigation.PushAsync(new FriendProfileController(friend));
                }
                // leader is not a friend of current user and has a public account
                else if (!isFriendOfOwner && publicOwner)
                {
                    UserProfile userToVisit = await fb.GetUserObject(EventOwner);

                    await Navigation.PushAsync(new PublicProfileController(userToVisit));
                }
                // leader is not a friend of current user and has a private account
                else
                {
                    UserProfile userToVisit = await fb.GetUserObject(EventOwner);

                    await Navigation.PushAsync(new PrivateProfileController(userToVisit));
                }
            }
            else
            {
                CommunityProfile selectedCommunity = await fb.GetCommunity(EventOwner);

                bool member = await fb.isCommunityMember(selectedCommunity);

                // Community Leader taps on community
                if (selectedCommunity.Leader == userEmail)
                {
                    await Navigation.PushAsync(new CommunityLeaderViewController(selectedCommunity));
                }
                // Regular member taps on community
                else if (member)
                {
                    await Navigation.PushAsync(new CommunityMemberViewController(selectedCommunity));
                }
                else if (selectedCommunity.PublicCommunity)
                {
                    await Navigation.PushAsync(new PublicCommunityController(selectedCommunity));
                }
                else if (!selectedCommunity.PublicCommunity)
                {
                    await Navigation.PushAsync(new PrivateCommunityController(selectedCommunity));
                }
            }
        }