public void Fill(ProfileInformationDTO profileInfo)
 {
     updateOfflineGuid();
     if (profileInfo != null)
     {
         DataContext = new MyProfileViewModel(profileInfo);
         //retrieve latest messages
         ((MyProfileViewModel)DataContext).LoadMessages();
         //lblPoints.Text = profileInfo.Licence.BAPoints.ToString();
         ctrlAwards.User = profileInfo.User;
         fillImage();
     }
     else
     {
         DataContext = null;
     }
 }
Example #2
0
 public void Fill(ProfileInformationDTO profileInfo, bool isActive)
 {
     this.profileInfo = profileInfo;
     listView1.Items.Clear();
     if (profileInfo != null && isActive)
     {
         foreach (var message in profileInfo.Messages)
         {
             ListViewItem item =
                 new ListViewItem(new string[] { message.Sender.UserName, SystemMessages.GetMessageTopic(message), message.CreatedDate.ToLocalTime().ToRelativeDate() });
             item.Tag             = message;
             item.ImageKey        = "Message";
             item.StateImageIndex = getPriorityImageKey(message);
             listView1.Items.Add(item);
         }
         colTopic.Width          = -2;
         usrMessageView1.Visible = SelectedMessage != null;
     }
 }
        public void TestGetProfileInformations_WithRejectedInvitation()
        {
            ProfileDTO  inviter = (ProfileDTO)profiles[0].Tag;
            ProfileDTO  invited = (ProfileDTO)profiles[1].Tag;
            SessionData data    = SecurityManager.CreateNewSession(inviter, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                var arg       = new InviteFriendOperationData();
                arg.User      = invited;
                arg.Operation = InviteFriendOperation.Invite;
                Service.InviteFriendOperation(data.Token, arg);
            });
            data = SecurityManager.CreateNewSession(invited, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                var arg       = new InviteFriendOperationData();
                arg.User      = inviter;
                arg.Operation = InviteFriendOperation.Reject;
                Service.InviteFriendOperation(data.Token, arg);
            });
            int count = Session.QueryOver <FriendInvitation>().RowCount();

            Assert.AreEqual(0, count);

            GetProfileInformationCriteria criteria = new GetProfileInformationCriteria();

            ProfileInformationDTO info = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                info = Service.GetProfileInformation(data.Token, criteria);
            });
            Assert.AreEqual(0, info.Messages.Count);

            data = SecurityManager.CreateNewSession(inviter, ClientInformation);
            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                info = Service.GetProfileInformation(data.Token, criteria);
            });
            Assert.AreEqual(1, info.Messages.Count);
        }
Example #4
0
        public void Fill(ProfileInformationDTO user, bool isActive)
        {
            if (user != null)
            {
                if (isActive && (!filled || currentUser == null || currentUser.User.Id != user.User.Id))
                {
                    filled = true;
                    ExerciseSearchCriteria criteria = ExerciseSearchCriteria.CreateAllCriteria();
                    criteria.UserId = user.User.Id;
                    usrExercisesView1.Fill(criteria);
                }
            }
            else
            {
                usrExercisesView1.ClearContent();
            }

            currentUser = user;
        }
        public void SaveProfileInformationById(string id, ProfileInformationDTO informationDTO)
        {
            var user = Database.UserManager.FindById(id);

            //Mapper userProfileMapper = new Mapper(mapperConfigs.ProfileInformationDtoToUserProfile);
            //user.UserProfile = userProfileMapper.Map<UserProfile>(informationDTO);

            user.UserProfile.AboutMe    = informationDTO.AboutMe;
            user.UserProfile.Avatar     = informationDTO.Avatar;
            user.UserProfile.Age        = informationDTO.Age;
            user.UserProfile.Address    = informationDTO.Address;
            user.UserProfile.FirstName  = informationDTO.FirstName;
            user.UserProfile.SecondName = informationDTO.SecondName;
            user.UserProfile.Gender     = informationDTO.Gender;
            user.UserProfile.Education  = informationDTO.Education;


            Database.UserManager.Update(user);
            Database.UserProfileManager.SaveChanges();
        }
 public void Fill(ProfileInformationDTO user, bool isActive)
 {
     currentUser = user;
     if (user != null)
     {
         if (isActive && (!filled || currentUser == null || currentUser.User.GlobalId != user.User.GlobalId))
         {
             filled = true;
             usrWorkoutPlansPagerListView1.ClearContent();
             usrWorkoutCommentsList1.ClearContent();
             DoSearch();
         }
     }
     else
     {
         filled = false;
         usrWorkoutPlansPagerListView1.ClearContent();
         usrWorkoutCommentsList1.Fill(null);
     }
 }
Example #7
0
        public static SessionData Login(string user, string password, bool saveCredentials, bool passwordHashed = false)
        {
            if (LoginStatus == LoginStatus.Logged)
            {
                try
                {
                    ServiceManager.Logout(Token);
                }
                catch (Exception)
                {
                }

                profileInfo = null;
                LoginStatus = LoginStatus.InProgress;
            }
            if (!passwordHashed)
            {
                password = password.ToSHA1Hash();
            }
            return(loginImplementation(user, password, saveCredentials));
        }
        public void Fill(ProfileInformationDTO profileInfo, bool isActive)
        {
            this.profileInfo = profileInfo;
            messages.Clear();
            if (isActive && profileInfo != null && profileInfo.User.IsMe())
            {
                MessagesReposidory.Instance.EnsureLoaded();
                foreach (var message in MessagesReposidory.Instance.Items.Values)
                {
                    messages.Add(message);
                }
                msgViewSplit.SetVisible(SelectedMessage != null);
                msgViewSplit.UpdateVisbility();
            }
            lstInvitations.ItemsSource = messages;

            CollectionView myView = (CollectionView)CollectionViewSource.GetDefaultView(lstInvitations.ItemsSource);

            myView.SortDescriptions.Add(new SortDescription("CreatedDate", ListSortDirection.Descending));

            NotifyOfPropertyChange(() => Caption);
        }
Example #9
0
 internal void refreshUserDataImplementation(bool raiseEvent)
 {
     profileInfo = ServiceManager.GetProfileInformation(new GetProfileInformationCriteria());
     SessionData.Profile.Picture   = profileInfo.User.Picture;
     sessionData.Profile.Privacy   = profileInfo.User.Privacy;
     sessionData.Profile.CountryId = profileInfo.User.CountryId;
     sessionData.Profile.Gender    = profileInfo.User.Gender;
     sessionData.Profile.Settings  = profileInfo.Settings;
     //TODO:here we must refresh the Version but UserDTO doesn't have it
     sessionData.Profile.Version = profileInfo.User.Version;
     if (raiseEvent)
     {
         if (ProfileInformationChanged != null)
         {
             ProfileInformationChanged(null, EventArgs.Empty);
         }
         if (PropertyChanged != null)
         {
             PropertyChanged(this, new PropertyChangedEventArgs("ProfileInformation"));
         }
     }
 }
Example #10
0
        public ActionResult SaveInformationForm(EditProfileViewModel profileInformation, HttpPostedFileBase uploadImage)
        {
            if (profileInformation.Age < 0 || profileInformation.Age > 120)
            {
                ModelState.AddModelError("Age", "Недопустимый возраст");
            }

            if (ModelState.IsValid)
            {
                MapperConfiguration   config;
                ProfileInformationDTO profileInformationDTO = new ProfileInformationDTO();

                if (uploadImage != null)
                {
                    config = new MapperConfiguration(cfg => cfg.CreateMap <EditProfileViewModel, ProfileInformationDTO>());
                    byte[] imageData = null;
                    // считываем переданный файл в массив байтов
                    using (var binaryReader = new BinaryReader(uploadImage.InputStream))
                    {
                        imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
                    }
                    profileInformation.Avatar = imageData;
                    var mapper = new Mapper(config);
                    profileInformationDTO = mapper.Map <ProfileInformationDTO>(profileInformation);
                }
                else
                {
                    config = new MapperConfiguration(cfg => cfg.CreateMap <EditProfileViewModel, ProfileInformationDTO>().ForMember(x => x.Avatar, (options) => options.Ignore()));
                    var mapper = new Mapper(config);
                    profileInformationDTO        = mapper.Map <ProfileInformationDTO>(profileInformation);
                    profileInformationDTO.Avatar = _userService.GetAvatar(User.Identity.GetUserId());
                }

                _userService.SaveProfileInformationById(User.Identity.GetUserId(), profileInformationDTO);
            }

            return(RedirectToAction("Index", "Home"));
        }
Example #11
0
 public void Fill(ProfileInformationDTO user, bool isActive)
 {
     this.user = user;
     if (user != null)
     {
         usrProfileListEntry1.Fill(user.User);
         txtAbout.Text = user.AboutInformation;
         if (user.User.IsMe())
         {
             lblInvitationsCountStatus.Text = string.Format(ApplicationStrings.usrUserInfo_InvitationsCount, user.Invitations.Count);
             lblMessagesCountStatus.Text    = string.Format(ApplicationStrings.usrUserInfo_MessagesCount, user.Messages.Count);
             if (UserContext.SessionData.LastLoginDate.HasValue)
             {
                 lblLastLoggedTime.Text = string.Format(ApplicationStrings.usrUserInfo_LastLogin, UserContext.SessionData.LastLoginDate.Value.ToRelativeDate());
             }
             lblMessagesCountStatus.Visible    = user.Messages.Count > 0;
             lblInvitationsCountStatus.Visible = user.Invitations.Count > 0;
             lblLastLoggedTime.Visible         = user.LastLogin.HasValue;
             lblProfileNotActivated.Visible    = !user.IsActivated;
             bool profileConfWizard = UserContext.Settings.GetProfileConfigurationWizardShowed(UserContext.CurrentProfile.Id);
             lblNoStatus.Visible = user.Messages.Count == 0 && user.Invitations.Count == 0 && profileConfWizard;
             lblProfileConfigurationWizard.Visible = !profileConfWizard;
         }
         grInfo.Visible = User.IsMe();
         tableLayoutPanel2.RowStyles[1] = User.IsMe() ? new RowStyle(SizeType.Absolute, 0F) : new RowStyle(SizeType.Percent, 100F);
         tableLayoutPanel2.RowStyles[3] = !User.IsMe() ? new RowStyle(SizeType.Absolute, 0F) : new RowStyle(SizeType.Percent, 100F);
         tableLayoutPanel2.Visible      = User.IsMe();
         flowLayoutPanel1.Visible       = User.IsMe();
         fillStatistics(User);
         fillAwards(User);
         grAbout.Visible           = !User.IsMe();
         tableLayoutPanel2.Visible = true;
     }
     else
     {
         ClearContent();
     }
 }
Example #12
0
        public void ClearContent()
        {
            user = null;
            if (currentTask != null)
            {
                currentTask.Cancel();
                currentTask = null;
            }
            showProgress(false);
            foreach (NaviBand band in naviBar1.Bands)
            {
                if (band.ClientArea.Controls.Count > 0)
                {
                    IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl;
                    if (ctrl != null)
                    {
                        ctrl.Fill(null, naviBar1.ActiveBand == band);
                    }
                }
            }

            updateButtons(false);
        }
Example #13
0
        public void Fill(ProfileInformationDTO user, bool isActive)
        {
            if (user != null)
            {
                if (isActive && (!filled || currentUser == null || currentUser.User.Id != user.User.Id))
                {
                    filled = true;
                    usrWorkoutPlansPagerListView1.Clear();
                    usrWorkoutCommentsList1.Fill(null);
                    WorkoutPlanSearchCriteria criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();
                    criteria.UserName = user.User.UserName;
                    usrWorkoutPlansPagerListView1.Fill(criteria);
                }
            }
            else
            {
                filled = false;
                usrWorkoutPlansPagerListView1.Clear();
                usrWorkoutCommentsList1.Fill(null);
            }

            currentUser = user;
        }
Example #14
0
        public void Records_PrivacyPublic()
        {
            setCalendarPrivacy(Privacy.Public);
            var exercise = CreateExercise(Session, null, "ex1", "ex1");

            exercise.UseInRecords = true;
            insertToDatabase(exercise);
            var exercise1 = CreateExercise(Session, null, "ex2", "ex2");

            CreateExerciseRecord(exercise, profiles[0], new Tuple <int, decimal>(2, 50), DateTime.UtcNow.Date.AddDays(-3));
            CreateExerciseRecord(exercise1, profiles[0], new Tuple <int, decimal>(12, 150), DateTime.UtcNow.Date.AddDays(-13));

            ProfileInformationDTO profileInfo = null;
            var profile0 = (ProfileDTO)profiles[0].Tag;
            var profile1 = (ProfileDTO)profiles[1].Tag;
            var profile2 = (ProfileDTO)profiles[2].Tag;

            SessionData data = CreateNewSession(profile1, ClientInformation);
            GetProfileInformationCriteria criteria = new GetProfileInformationCriteria();

            criteria.UserId = profile0.GlobalId;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                profileInfo = Service.GetProfileInformation(data.Token, criteria);
            });
            Assert.AreEqual(1, profileInfo.Records.Count);

            data = CreateNewSession(profile2, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                profileInfo = Service.GetProfileInformation(data.Token, criteria);
            });
            Assert.AreEqual(1, profileInfo.Records.Count);
        }
Example #15
0
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(InvitationList.UpdateGui(user));
 }
Example #16
0
 public void Fill(ProfileInformationDTO user, bool isActive)
 {
     InvitationList.Fill(user, isActive);
 }
Example #17
0
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(user != null && (user.User.IsMe() || user.User.HaveAccess(user.User.Privacy.Sizes)));
 }
Example #18
0
 public void Fill(ProfileInformationDTO user, bool isActive)
 {
     viewModel.Fill(user, isActive);
 }
 public MyProfileViewModel(ProfileInformationDTO info)
 {
     this.info = info;
 }
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(user != null && user.Records.Count > 0);
 }
Example #21
0
        public ProfileInformationDTO GetProfileInformation(Token token, GetProfileInformationCriteria criteria)
        {
            BodyArchitect.Service.V2.InternalBodyArchitectService service = new V2.InternalBodyArchitectService(NHibernateContext.Current().Session);
            V2.Model.Token v2token = new V2.Model.Token(token.SessionId, token.Language);
            V2.Model.GetProfileInformationCriteria v2Crit = new V2.Model.GetProfileInformationCriteria();
            //v2Crit.UserId
            int? tempId;
            Guid?tempGuid;

            if ((tempGuid = h.GetGuidFromInt(criteria)) == null)
            {
                tempGuid = null;
            }
            v2Crit.UserId = tempGuid;
            var res = service.GetProfileInformation(v2token, v2Crit);

            ProfileInformationDTO profile = new ProfileInformationDTO();

            profile.AboutInformation = res.AboutInformation;
            profile.Birthday         = res.Birthday;

            foreach (V2.Model.UserSearchDTO u in res.FavoriteUsers)
            {
                UserSearchDTO a = new UserSearchDTO();
                a.CountryId = u.CountryId;
                //a.CreationDate = u.CreationDate;
                SetProperty(a, "CreationDate", u.CreationDate);
                a.Gender = (BodyArchitect.Service.Model.Gender)u.Gender;
                //a.Id = u.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(u.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.GlobalId.ToString());
                }

                //a.IsDeleted = u.IsDeleted;
                SetProperty(a, "IsDeleted", u.IsDeleted);
                //a.Picture = u.Picture;
                a.Picture = new PictureInfoDTO();
                if (u.Picture != null)
                {
                    a.Picture.Hash      = u.Picture.Hash;
                    a.Picture.PictureId = u.Picture.PictureId;
                    a.Picture.SessionId = u.Picture.SessionId;
                }
                else
                {
                    a.Picture = null;
                }
                a.Privacy.BirthdayDate          = (BodyArchitect.Service.Model.Privacy)u.Privacy.BirthdayDate;
                a.Privacy.CalendarView          = (BodyArchitect.Service.Model.Privacy)u.Privacy.CalendarView;
                a.Privacy.Friends               = (BodyArchitect.Service.Model.Privacy)u.Privacy.Friends;
                a.Privacy.Searchable            = u.Privacy.Searchable;
                a.Privacy.Sizes                 = (BodyArchitect.Service.Model.Privacy)u.Privacy.Sizes;
                a.Statistics.A6WEntriesCount    = u.Statistics.A6WEntriesCount;
                a.Statistics.A6WFullCyclesCount = u.Statistics.A6WFullCyclesCount;
                a.Statistics.BlogCommentsCount  = u.Statistics.TrainingDayCommentsCount;
                a.Statistics.BlogEntriesCount   = u.Statistics.BlogEntriesCount;
                a.Statistics.FollowersCount     = u.Statistics.FollowersCount;
                a.Statistics.FriendsCount       = u.Statistics.FriendsCount;
                //a.Statistics.Id
                if ((tempId = h.GetIntFromGuid(u.Statistics.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u.Statistics);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.Statistics.GlobalId.ToString());
                }
                //a.Statistics.IsNew
                a.Statistics.LastEntryDate                = u.Statistics.LastEntryDate;
                a.Statistics.LastLoginDate                = u.Statistics.LastLoginDate;
                a.Statistics.LoginsCount                  = u.Statistics.LoginsCount;
                a.Statistics.MyBlogCommentsCount          = u.Statistics.MyTrainingDayCommentsCount;
                a.Statistics.SizeEntriesCount             = u.Statistics.SizeEntriesCount;
                a.Statistics.StrengthTrainingEntriesCount = u.Statistics.StrengthTrainingEntriesCount;
                a.Statistics.SupplementEntriesCount       = u.Statistics.SupplementEntriesCount;
                a.Statistics.Tag = u.Statistics.Tag;
                a.Statistics.TrainingDaysCount = u.Statistics.TrainingDaysCount;
                a.Statistics.VotingsCount      = u.Statistics.VotingsCount;
                a.Statistics.WorkoutPlansCount = u.Statistics.WorkoutPlansCount;
                a.UserName = u.UserName;
                profile.FavoriteUsers.Add(a);
            }


            //profile.Friends = res.Friends;
            foreach (V2.Model.UserSearchDTO u in res.Friends)
            {
                UserSearchDTO a = new UserSearchDTO();
                a.CountryId = u.CountryId;
                //a.CreationDate = u.CreationDate;
                SetProperty(a, "CreationDate", u.CreationDate);
                a.Gender = (BodyArchitect.Service.Model.Gender)u.Gender;
                //a.Id = u.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(u.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.GlobalId.ToString());
                }

                //a.IsDeleted = u.IsDeleted;
                SetProperty(a, "IsDeleted", u.IsDeleted);
                //a.Picture = u.Picture;
                a.Picture = new PictureInfoDTO();
                if (u.Picture != null)
                {
                    a.Picture.Hash      = u.Picture.Hash;
                    a.Picture.PictureId = u.Picture.PictureId;
                    a.Picture.SessionId = u.Picture.SessionId;
                }
                else
                {
                    a.Picture = null;
                }
                a.Privacy.BirthdayDate          = (BodyArchitect.Service.Model.Privacy)u.Privacy.BirthdayDate;
                a.Privacy.CalendarView          = (BodyArchitect.Service.Model.Privacy)u.Privacy.CalendarView;
                a.Privacy.Friends               = (BodyArchitect.Service.Model.Privacy)u.Privacy.Friends;
                a.Privacy.Searchable            = u.Privacy.Searchable;
                a.Privacy.Sizes                 = (BodyArchitect.Service.Model.Privacy)u.Privacy.Sizes;
                a.Statistics.A6WEntriesCount    = u.Statistics.A6WEntriesCount;
                a.Statistics.A6WFullCyclesCount = u.Statistics.A6WFullCyclesCount;
                a.Statistics.BlogCommentsCount  = u.Statistics.TrainingDayCommentsCount;
                a.Statistics.BlogEntriesCount   = u.Statistics.BlogEntriesCount;
                a.Statistics.FollowersCount     = u.Statistics.FollowersCount;
                a.Statistics.FriendsCount       = u.Statistics.FriendsCount;
                //a.Statistics.Id
                if ((tempId = h.GetIntFromGuid(u.Statistics.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u.Statistics);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.Statistics.GlobalId.ToString());
                }
                //a.Statistics.IsNew
                a.Statistics.LastEntryDate                = u.Statistics.LastEntryDate;
                a.Statistics.LastLoginDate                = u.Statistics.LastLoginDate;
                a.Statistics.LoginsCount                  = u.Statistics.LoginsCount;
                a.Statistics.MyBlogCommentsCount          = u.Statistics.MyTrainingDayCommentsCount;
                a.Statistics.SizeEntriesCount             = u.Statistics.SizeEntriesCount;
                a.Statistics.StrengthTrainingEntriesCount = u.Statistics.StrengthTrainingEntriesCount;
                a.Statistics.SupplementEntriesCount       = u.Statistics.SupplementEntriesCount;
                a.Statistics.Tag = u.Statistics.Tag;
                a.Statistics.TrainingDaysCount = u.Statistics.TrainingDaysCount;
                a.Statistics.VotingsCount      = u.Statistics.VotingsCount;
                a.Statistics.WorkoutPlansCount = u.Statistics.WorkoutPlansCount;
                a.UserName = u.UserName;
                profile.FavoriteUsers.Add(a);
            }

            //profile.Invitations =  res.Invitations;
            foreach (V2.Model.FriendInvitationDTO c in res.Invitations)
            {
                Model.FriendInvitationDTO a = new FriendInvitationDTO();
                a.CreatedDateTime   = c.CreatedDateTime;
                a.InvitationType    = (BodyArchitect.Service.Model.InvitationType)c.InvitationType;
                a.Invited.CountryId = c.Invited.CountryId;
                //a.Invited.Id
                SetProperty(a.Invited, "CreationDate", c.Invited.CreationDate);
                a.Invited.Gender = (BodyArchitect.Service.Model.Gender)c.Invited.Gender;
                //a.Id = c.Invited.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(c.Invited.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(c.Invited);
                }
                if (tempId != null)
                {
                    a.Invited.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", c.Invited.GlobalId.ToString());
                }

                //a.IsDeleted = c.Invited.IsDeleted;
                SetProperty(a.Invited, "IsDeleted", c.Invited.IsDeleted);
                //a.Picture = c.Invited.Picture;
                a.Invited.Picture = new PictureInfoDTO();
                if (c.Invited.Picture != null)
                {
                    a.Invited.Picture.Hash      = c.Invited.Picture.Hash;
                    a.Invited.Picture.PictureId = c.Invited.Picture.PictureId;
                    a.Invited.Picture.SessionId = c.Invited.Picture.SessionId;
                }
                else
                {
                    a.Invited.Picture = null;
                }
                a.Invited.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.BirthdayDate;
                a.Invited.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.CalendarView;
                a.Invited.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.Friends;
                a.Invited.Privacy.Searchable   = c.Invited.Privacy.Searchable;
                a.Invited.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.Sizes;
                a.Invited.UserName             = c.Invited.UserName;



                a.Inviter.CountryId = c.Inviter.CountryId;
                //a.Inviter.Id
                SetProperty(a.Inviter, "CreationDate", c.Inviter.CreationDate);
                a.Inviter.Gender = (BodyArchitect.Service.Model.Gender)c.Inviter.Gender;
                //a.Id = c.Inviter.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(c.Inviter.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(c.Inviter);
                }
                if (tempId != null)
                {
                    a.Inviter.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", c.Inviter.GlobalId.ToString());
                }

                //a.IsDeleted = c.Inviter.IsDeleted;
                SetProperty(a.Inviter, "IsDeleted", c.Inviter.IsDeleted);
                //a.Picture = c.Inviter.Picture;
                a.Inviter.Picture = new PictureInfoDTO();
                if (c.Inviter.Picture != null)
                {
                    a.Inviter.Picture.Hash      = c.Inviter.Picture.Hash;
                    a.Inviter.Picture.PictureId = c.Inviter.Picture.PictureId;
                    a.Inviter.Picture.SessionId = c.Inviter.Picture.SessionId;
                }
                else
                {
                    a.Inviter.Picture = null;
                }
                a.Inviter.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.BirthdayDate;
                a.Inviter.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.CalendarView;
                a.Inviter.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.Friends;
                a.Inviter.Privacy.Searchable   = c.Inviter.Privacy.Searchable;
                a.Inviter.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.Sizes;
                a.Inviter.UserName             = c.Inviter.UserName;

                a.Message = c.Message;
                profile.Invitations.Add(a);
            }


            profile.IsActivated       = res.IsActivated;
            profile.LastLogin         = res.LastLogin;
            profile.Messages          = null; //?
            profile.RetrievedDateTime = res.RetrievedDateTime;
            //profile.Settings = res.Settings;

            profile.Settings = new ProfileSettingsDTO();
            tempId           = null;
            if ((tempId = h.GetIntFromGuid(res.Settings.GlobalId)) == null)
            {
                tempId = h.SetIntFromGuid(res.Settings);
            }
            if (tempId != null)
            {
                profile.Settings.Id = (int)tempId;
            }
            else
            {
                throw new ArgumentException("Id not assigned to guid", res.Settings.GlobalId.ToString());
            }
            //profile.Role = res.Profile.
            profile.Settings.AutomaticUpdateMeasurements = res.Settings.AutomaticUpdateMeasurements;
            //profile.Settings.Id = res.Profile.Settings.GlobalId;

            //SetProperty(profile.Settings, "IsNew", res.Profile.Settings.IsNew);
            //profile.Settings.IsNew = res.Profile.Settings.IsNew;
            //TODO:check notifications
            profile.Settings.NotificationBlogCommentAdded      = res.Settings.NotificationBlogCommentAdded != BodyArchitect.Service.V2.Model.ProfileNotification.None;
            profile.Settings.NotificationExerciseVoted         = res.Settings.NotificationVoted != BodyArchitect.Service.V2.Model.ProfileNotification.None; //??
            profile.Settings.NotificationFriendChangedCalendar = res.Settings.NotificationFriendChangedCalendar != BodyArchitect.Service.V2.Model.ProfileNotification.None;
            profile.Settings.NotificationWorkoutPlanVoted      = res.Settings.NotificationVoted != BodyArchitect.Service.V2.Model.ProfileNotification.None; //??

            profile.User           = new UserSearchDTO();
            profile.User.CountryId = res.User.CountryId;
            SetProperty(profile.User, "CreationDate", res.User.CreationDate);
            profile.User.Gender = (BodyArchitect.Service.Model.Gender)res.User.Gender;
            //a.Id = res.User.GlobalId;
            tempId = null;
            if ((tempId = h.GetIntFromGuid(res.User.GlobalId)) == null)
            {
                tempId = h.SetIntFromGuid(res.User);
            }
            if (tempId != null)
            {
                profile.User.Id = (int)tempId;
            }
            else
            {
                throw new ArgumentException("Id not assigned to guid", res.User.GlobalId.ToString());
            }

            //a.IsDeleted = res.User.IsDeleted;
            SetProperty(profile.User, "IsDeleted", res.User.IsDeleted);
            //a.Picture = res.User.Picture;
            profile.User.Picture = new PictureInfoDTO();
            if (res.User.Picture != null)
            {
                profile.User.Picture.Hash      = res.User.Picture.Hash;
                profile.User.Picture.PictureId = res.User.Picture.PictureId;
                profile.User.Picture.SessionId = res.User.Picture.SessionId;
            }
            else
            {
                profile.User.Picture = null;
            }
            profile.User.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.BirthdayDate;
            profile.User.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.CalendarView;
            profile.User.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.Friends;
            profile.User.Privacy.Searchable   = res.User.Privacy.Searchable;
            profile.User.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.Sizes;
            profile.User.UserName             = res.User.UserName;


            profile.Wymiary = new WymiaryDTO();
            if (res.Wymiary != null)
            {
                profile.Wymiary.DateTime = res.Wymiary.Time.DateTime;

                profile.Wymiary.Height = (int)res.Wymiary.Height;   //possible loss of data
                tempId = null;
                if ((tempId = h.GetIntFromGuid(res.Wymiary.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(res.Wymiary);
                }
                if (tempId != null)
                {
                    profile.Wymiary.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", res.Wymiary.GlobalId.ToString());
                }
                //profile.Wymiary.IsEmpty = res.Wymiary.IsEmpty; //READ ONLY
                profile.Wymiary.IsNaCzczo = false;  //res.Wymiary.????
                //profile.Wymiary.IsNew = res.Wymiary.IsNew;    //READ ONLY
                profile.Wymiary.Klatka       = (float)res.Wymiary.Klatka;
                profile.Wymiary.LeftBiceps   = (float)res.Wymiary.LeftBiceps;
                profile.Wymiary.LeftForearm  = (float)res.Wymiary.LeftForearm;
                profile.Wymiary.LeftUdo      = (float)res.Wymiary.LeftUdo;
                profile.Wymiary.Pas          = (float)res.Wymiary.Pas;
                profile.Wymiary.RightBiceps  = (float)res.Wymiary.RightBiceps;
                profile.Wymiary.RightForearm = (float)res.Wymiary.RightForearm;
                profile.Wymiary.RightUdo     = (float)res.Wymiary.RightUdo;
                profile.Wymiary.Tag          = res.Wymiary.Tag;
                profile.Wymiary.Weight       = (float)res.Wymiary.Weight;
            }
            return(profile);
        }
Example #22
0
 public ProfileViewModel(ProfileInformationDTO profile)
 {
     this.profile = profile;
 }
Example #23
0
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(user != null && user.User.IsMe());
 }
Example #24
0
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(true);
 }
 public bool UpdateGui(ProfileInformationDTO user)
 {
     return(user != null && user.User.IsMe() && profileInfo != null && profileInfo.Invitations.Count > 0);
 }