Example #1
0
        private void NavigatedTo(NavigationEventArgs arg)
        {
            if (Program.PreviewerDetached)
            {
                switch (arg.NavigationMode)
                {
                case NavigationMode.New:
                    var args = ((NavigationDialogHost parent, UserProfile profile, bool isNewUser))arg.Parameter;
                    _isNewUser = args.isNewUser;
                    if (!_isNewUser)
                    {
                        _profile    = args.profile;
                        TempProfile = new TempProfile(_profile);
                    }
                    else
                    {
                        TempProfile = new TempProfile();
                    }

                    _parent = args.parent;
                    break;
                }

                DataContext = TempProfile;

                AddPictureButton.IsVisible    = _isNewUser;
                IdLabel.IsVisible             = !_isNewUser;
                ChangePictureButton.IsVisible = !_isNewUser;
            }
        }
        public async Task OnGetAsync()
        {
            CurrentProfile = await profileDbContext.Profiles.SingleOrDefaultAsync(m => m.ID == 1);

            MyProfile = new TempProfile();
            if (User.Identity.IsAuthenticated)
            {
                string emaiID  = User.FindFirst(ClaimTypes.Email).Value;
                var    Profile = await profileDbContext.Profiles.SingleOrDefaultAsync(m => m.LoginEmailID == emaiID);

                MyProfile.ProfilePic             = Profile.ProfilePic;
                MyProfile.College                = Profile.College;
                MyProfile.Department             = Profile.Department;
                MyProfile.Designation            = Profile.Designation;
                MyProfile.EmailID                = Profile.EmailID;
                MyProfile.Achievements           = Profile.Achievements;
                MyProfile.AreasOfInterest        = Profile.AreasOfInterest;
                MyProfile.FullName               = Profile.FullName;
                MyProfile.GoogleScholarLink      = Profile.GoogleScholarLink;
                MyProfile.MobileNumber           = Profile.MobileNumber;
                MyProfile.PGCollege              = String.Empty;
                MyProfile.PGCompletionYear       = String.Empty;
                MyProfile.PGDegree               = String.Empty;
                MyProfile.PhDCollege             = String.Empty;
                MyProfile.PhDCompletionYear      = String.Empty;
                MyProfile.ProfessionalExperience = Profile.ProfessionalExperience;
                MyProfile.ProfilePic             = Profile.ProfilePic;
                MyProfile.ShortBio               = Profile.ShortBio;
                MyProfile.UGCollege              = String.Empty;;
                MyProfile.UGCompletionYear       = String.Empty;
                MyProfile.UGDegree               = String.Empty;
                if (String.IsNullOrEmpty(Profile.ProfilePic))
                {
                    MyProfile.ProfilePic = "images/profile-pic.png";
                }
                if (!String.IsNullOrEmpty(Profile.UnderGraduateDegreeDetails))
                {
                    var tempString1 = Profile.UnderGraduateDegreeDetails.Split(';');
                    var tempString2 = Profile.PostGraduateDegreeDetails.Split(';');
                    var tempString3 = Profile.DoctoratesDegreeDetails.Split(';');
                    MyProfile.UGDegree          = tempString1[0];
                    MyProfile.UGCollege         = tempString1[1];
                    MyProfile.UGCompletionYear  = tempString1[2];
                    MyProfile.PGDegree          = tempString2[0];
                    MyProfile.PGCollege         = tempString2[1];
                    MyProfile.PGCompletionYear  = tempString2[2];
                    MyProfile.PhDCollege        = tempString3[0];
                    MyProfile.PhDCompletionYear = tempString3[1];
                }
                if (!String.IsNullOrEmpty(Profile.AreasOfInterest))
                {
                    var tempList = JsonConvert.DeserializeObject <List <string> >(Profile.AreasOfInterest);
                    MyProfile.AreasOfInterest = String.Empty;
                    for (int i = 0; i <= tempList.Count - 2; i++)
                    {
                        MyProfile.AreasOfInterest = MyProfile.AreasOfInterest + tempList[i] + ";";
                    }
                    MyProfile.AreasOfInterest = MyProfile.AreasOfInterest + tempList[tempList.Count - 1];
                }
                if (!String.IsNullOrEmpty(Profile.Achievements))
                {
                    var tempList = JsonConvert.DeserializeObject <List <string> >(Profile.Achievements);
                    MyProfile.Achievements = String.Empty;
                    for (int i = 0; i <= tempList.Count - 2; i++)
                    {
                        MyProfile.Achievements = MyProfile.Achievements + tempList[i] + ";";
                    }
                    MyProfile.Achievements = MyProfile.Achievements + tempList[tempList.Count - 1];
                }
            }
        }