public ProfilePage()
 {
     InitializeComponent();
     contactBL        = new ContactsBL();
     vm               = new ProfilePageVM();
     this.DataContext = vm;
 }
Beispiel #2
0
        public IActionResult ProfilePage(ProfilePageVM profilePage)
        {
            var details = userService.GetProfilePageById(profilePage);

            var detailsVM = userService.GetProfilePageVM(details);

            return(View(detailsVM));
        }
        public ProfilePage()
        {
            Console.WriteLine(App.userToDisplay);
            this.logic        = new ProfilePageVM(new SQLiteDataService(), App.userToDisplay);
            App.userToDisplay = App.currentUser;
            InitializeComponent();
            searchBar.textSearch.KeyDown  += SearchBar_TextSearch_Search_On_KeyDown;
            navbar.button_Profile.Click   += ProfileTransition;
            navbar.button_FAQ.Click       += FAQTransition;
            navbar.button_Notes.Click     += NotesTransition;
            navbar.button_TimeTable.Click += TimetableTransition;
            navbar.button_Profile.Style    = Application.Current.Resources["MenuButtonActive"] as Style;
            if (logic.GetPerson() != null)
            {
                content.nameSurnameTextblock.Text = logic.GetPerson().Name + " " + logic.GetPerson().Surname;

                BitmapImage temp = new BitmapImage();
                temp.BeginInit();
                temp.CacheOption = BitmapCacheOption.OnLoad;
                temp.UriSource   = new Uri("../../" + logic.GetPerson().Photo, UriKind.Relative);
                temp.EndInit();
                content.profilePhoto.Source = temp;
                if (logic.GetLecturer() != null)
                {
                    content.groupDepartmentLabel.Text           = "Department:";
                    content.groupDepartmentTextblock.Text       = logic.GetLecturer().Department;
                    content.numberZalikovkaLabel.Visibility     = Visibility.Hidden;
                    content.numberZalikovkaTextblock.Visibility = Visibility.Hidden;
                    content.courseLabel.Visibility     = Visibility.Hidden;
                    content.courseTextblock.Visibility = Visibility.Hidden;
                    content.marks.Visibility           = Visibility.Hidden;
                    content.buttonNext.Visibility      = Visibility.Hidden;
                    content.buttonPrev.Visibility      = Visibility.Hidden;
                }
                else if (logic.GetStudent() != null)
                {
                    logic.GetRatings();
                    content.groupDepartmentTextblock.Text       = logic.GetStudent().GroupID;
                    content.courseTextblock.Text                = logic.GetGroup().Course.ToString();
                    content.numberZalikovkaTextblock.Text       = logic.GetStudent().TicketNumber.ToString();
                    content.marks.HeadRow1.subjectColumn.Click += SortRatingsBySubjectClick;
                    content.marks.HeadRow1.markColumn.Click    += SortRatingsByMarkClick;
                    content.marks.HeadRow2.subjectColumn.Click += SortRatingsBySubjectClick;
                    content.marks.HeadRow2.markColumn.Click    += SortRatingsByMarkClick;
                    content.buttonNext.MouseDown               += PreviousRatingsPageMouseDown;
                    content.buttonPrev.MouseDown               += NextRatingsPageMouseDown;
                    double pages = logic.GetPageCount(pageLimit);
                    if (pages < 1)
                    {
                        pages = 1;
                    }
                    content.pageIndexTextblock.Text = $"{currentPageNumber + 1} of {pages}";

                    FillMarksTable();
                }
            }
        }
        //---Get details for profilepage----//
        public MyIdentityUser GetProfilePageById(ProfilePageVM profile)
        {
            string userId = userManager.GetUserId(
                accessor.HttpContext.User);

            var details = context.Users
                          .Where(x => x.Id == userId)
                          .FirstOrDefault();

            return(details);
        }
Beispiel #5
0
        public ProfilePage()
        {
            InitializeComponent();
            ProfileVM           = new ProfilePageVM(this.Navigation);
            this.BindingContext = ProfileVM;

            // iOS Platform
            On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);

            //To Show Profile Pic
            MessagingCenter.Subscribe <string>("", "LoadImage", (sender) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(ProfileVM.UserProfileBase64))
                        {
                            imgUserProfile.Aspect = Aspect.AspectFill;
                            imgUserProfile.Source = Helpers.Constants.ImgFilePath;
                            ProfileVM.IsCamera    = false;
                        }
                    }
                    catch (Exception)
                    { }
                });
            });

            //To Show Profile Pic
            MessagingCenter.Subscribe <string>("", "LoadApiImage", (sender) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(ProfileVM.UserProfileBase64))
                        {
                            imgUserProfile.Aspect = Aspect.AspectFill;
                            imgUserProfile.Source = Utilities.Utility.GetImageFromBase64(ProfileVM.UserProfileBase64);
                        }
                    }
                    catch (Exception)
                    { }
                });
            });
        }
        public IActionResult Profile()
        {
            //get current users total balance
            string          userId       = User.getUserId();
            TransactionRepo TransRepo    = new TransactionRepo(_context);
            decimal         totalBalance = TransRepo.GetTotalBalance(userId);
            //get all other roommates
            RoomieRepo             roomieRepo = new RoomieRepo(_context);
            IEnumerable <Roommate> roommates  = roomieRepo
                                                .GetAllOtherRoommates(userId);
            //create and fill VMs
            //get current user name
            Roommate         currentSignedInUser = roomieRepo.GetRoommate(userId);
            RoomieAndBalance currentUser         = new RoomieAndBalance()
            {
                Balance  = totalBalance,
                Roommate = currentSignedInUser
            };
            ProfilePageVM ppvm = new ProfilePageVM()
            {
                CurrentUser          = currentUser,
                RoomiesRelationships = new List <RoomieAndBalance>(),
            };

            //get all other balances with roomies, put them into a VM,
            //which then goes into another bigger VM
            if (roommates != null)
            {
                foreach (var roomie in roommates)
                {
                    decimal relationshipBalance =
                        TransRepo.GetIndividualRelationshipBalance(userId, roomie.RoommateId);
                    RoomieAndBalance roomieAndBalance = new RoomieAndBalance()
                    {
                        Roommate = roomie,
                        Balance  = relationshipBalance
                    };
                    ppvm.RoomiesRelationships.Add(roomieAndBalance);
                }
            }
            return(View(ppvm));
        }
Beispiel #7
0
 public ProfilePage()
 {
     InitializeComponent();
     viewModel      = new ProfilePageVM();
     BindingContext = viewModel;
 }
        public ProfilePage()
        {
            InitializeComponent();

            BindingContext = new ProfilePageVM();
        }
 public ProfilePage(ProfilePageVM profilePageVM)
 {
     InitializeComponent();
 }
 public NavigationCommand(ProfilePageVM profilePageVM)
 {
     ProfilePageViewModel = profilePageVM;
 }
 public async void ShowProfilePage(UserDTO user)
 {
     var profilePageVM = new ProfilePageVM(user);
     var profilePage   = new ProfilePage(profilePageVM);
     await Navigation.PushAsync(profilePage);
 }