示例#1
0
        // Returns multiple profile objects based on a username search
        public static List <ProfileBar> GetProfile(int ViewerId, string SearchQuery)
        {
            snaptergramEntities db = new snaptergramEntities();

            List <users> AllUsers = new List <users>();

            using (db)
            {
                var data = from u in db.users select u;
                AllUsers = data.ToList();
            }

            // Selects a user based on username search. user.username.Contains(SearchQuery)
            AllUsers = AllUsers.Where(user => user.username.IndexOf(SearchQuery, StringComparison.CurrentCultureIgnoreCase) != -1).ToList();

            // Convert the users to ProfileBar
            List <ProfileBar> AllResults = new List <ProfileBar>();

            foreach (users U in AllUsers)
            {
                // Need to create a profile bar object.
                ProfileBar Converted = new ProfileBar();
                Converted.ProfileId       = U.userId;
                Converted.ProfilePicture  = U.profilePic;
                Converted.ProfileUserName = U.username;
                Converted.ViewerId        = ViewerId;

                //NOT YET IMPLEMENTED.
                Converted.Following = Followers.IsFollowing(ViewerId, U.userId);
                AllResults.Add(Converted);
            }

            return(AllResults);
        }
示例#2
0
 private void EnterHospital(object sender, RoutedEventArgs e)
 {
     Village.datetime      = Village.datetime.AddHours(1);
     Village.naruto.yen   -= 50;
     Village.naruto.health = (int)Village.naruto.maxhealth;
     ProfileBar.updateStats();
 }
示例#3
0
        // Returns a single profile object based on a database query.
        public static ProfileBar GetProfile(int ViewerId, int ProfileId)
        {
            snaptergramEntities db = new snaptergramEntities();

            List <users> AllUsers = new List <users>();

            using (db)
            {
                var data = from u in db.users select u;
                AllUsers = data.ToList();
            }

            // Selects a user based on ID, if it can't find one then a null is returned.
            users User = AllUsers.Where(user => user.userId == ProfileId).FirstOrDefault();

            // Handles the ocasions when the user cannot be found, or no Id was given.
            if (User == null)
            {
                return(new ProfileBar());
            }

            // Need to create a profile bar object.
            ProfileBar ProfileHeader = new ProfileBar();

            ProfileHeader.ProfileId       = User.userId;
            ProfileHeader.ProfilePicture  = User.profilePic;
            ProfileHeader.ProfileUserName = User.username;
            ProfileHeader.ViewerId        = ViewerId;

            //NOT YET IMPLEMENTED.
            ProfileHeader.Following = Followers.IsFollowing(ViewerId, ProfileId);;


            return(ProfileHeader);
        }
示例#4
0
        private static void ConsumeItem(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;

            foreach (Item i in Village.naruto.inventory)
            {
                if (i.Tag.Equals(b.Tag))
                {
                    i.Number--;
                    if (i.Number <= 0)
                    {
                        Village.naruto.inventory.Remove(i);
                        break;
                    }
                }
            }
            if (b.Tag.Equals("healthpotion"))
            {
                Village.naruto.health += 10;
                Battleground.updateStats();
            }
            else if (b.Tag.Equals("sushi"))
            {
                Village.naruto.happiness += 20;
                ProfileBar.updateStats();
            }
            generateItems();
        }
 private void EnterRamen(object sender, RoutedEventArgs e)
 {
     enterbutton.Visibility    = Visibility.Hidden;
     Village.datetime          = Village.datetime.AddHours(1);
     Village.naruto.yen       -= 100;
     Village.naruto.happiness += 70;
     ProfileBar.updateStats();
     background.ImageSource = new BitmapImage(new Uri(@"../../img/eatramen.gif", UriKind.Relative));
 }
示例#6
0
 public void set_up(Activity inputActivity, ProfileBar inputProfileBar)
 {
     activity             = inputActivity;
     nameText.text        = inputActivity.name;
     descriptionText.text = inputActivity.detail;
     difficulty           = inputActivity.difficulty;
     confirmed            = inputActivity.compeleted;
     profileBar           = inputProfileBar;
     Debug.Log(activity.compeleted);
     set_star();
     if (inputActivity.compeleted)
     {
         disable();
     }
 }
示例#7
0
        public async Task <IActionResult> OnGetAsync(long id, string?slug)
        {
            Story = await _storiesRepo.GetStoryDetails(id);

            if (Story == null)
            {
                return(NotFound());
            }
            if (!Story.IsPublished && !User.IsUserSameAsLoggedIn(Story.AuthorId))
            {
                return(NotFound());
            }

            ProfileBar = await _userRepo.GetProfileBar(Story.AuthorId);

            return(Page());
        }
示例#8
0
        public async Task <IActionResult> OnGetAsync(string name)
        {
            ProfileBar = await _userRepo.GetProfileBar(name.ToUpper());

            if (ProfileBar == null)
            {
                return(NotFound());
            }

            IsCurrentUser = ProfileBar.Id.ToString() == User.FindFirstValue(ClaimTypes.NameIdentifier);

            Icons = await _context.Icons
                    .AsNoTracking()
                    .ToListAsync();


            return(Page());
        }