Пример #1
0
        protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            base.OnShareTargetActivated(args);

            var view = new ShareView();
            var viewModel = new ShareViewModel();
            viewModel.SetShareTarget(args);
            view.DataContext = viewModel;
            Window.Current.Content = view;
            Window.Current.Activate();
        }
Пример #2
0
        // GET: Suggestion
        public ActionResult Index()
        {
            var model = new PhotosViewModel();
            var repo = new Repository<UserModel>(DbCollection.User);
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var userId = User.Identity.GetUserId();
            var user = repo.GetById(userId);
            model.User = user;
            var shareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId));
            var share = new ShareViewModel
            {
                ShareSetting = shareSetting
            };
            model.Share = share;

            // Read or Edit
            model.Modify = userId == User.Identity.GetUserId();

            model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
            // Test Log
            Log.Error(new Exception("Test"));
            return View(model);
        }
Пример #3
0
 public SelectableContactElement(ShareViewModel.SelectableContact contact)
     : base(contact.DisplayName)
 {
     this.Contact = contact;
 }
        // GET: Suggestion
        public ActionResult Index()
        {
            var model = new SuggestionViewModel();
            var repo = new Repository<UserModel>(DbCollection.User);
            var repoEducation = new Repository<EducationModel>(DbCollection.Education);
            var repoSuggestion = new Repository<SuggestionModel>(DbCollection.SuggestionFriend);
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var userId = User.Identity.GetUserId();
            var user = repo.GetById(userId);
            model.User = user;
            var shareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId));
            var share = new ShareViewModel
            {
                ShareSetting = shareSetting
            };
            model.Share = share;

            #region Get Suggestion List

            var userExistList =
                repoSuggestion.Gets().Where(m => m.UserId == userId).Select(m => m.UserSuggestionId).ToList();
            userExistList.Add(userId);

            // LOCATION - City
            var userLocation = new List<UserModel>();
            if (!string.IsNullOrEmpty(user.City))
            {
                var usersCity = repo.Gets().Where(m => !userExistList.Contains(m.Id.ToString()) && m.City == user.City).ToList();
                userExistList.Add(usersCity.ToString());
                // LOCATION - Country
                if (usersCity.Count < 5)
                {
                    if (!string.IsNullOrEmpty(user.Country))
                    {
                        var usersCountry =
                            repo.Gets()
                                .Where(m => m.Country == user.Country && !userExistList.Contains(user.Id.ToString()))
                                .ToList();
                        userExistList.Add(usersCountry.ToString());
                        userLocation = usersCity.Union(usersCountry).ToList();
                    }
                }
                else
                {
                    userLocation = usersCity;
                }
            }

            // EDUCTION
            var userEducation = new List<UserModel>();
            var listEducationOwner =
                repoEducation.Gets().Where(m => m.UserId.Equals(user.Id.ToString())).Select(m => m.SchoolName);
            var listUserEducationRelation = (from e in repoEducation.Gets().ToList()
                                             where listEducationOwner.Contains(e.SchoolName)
                                             select e).ToList();

            var listUserEducationString = listUserEducationRelation.Select(m => m.UserId).ToList();
            userEducation = repo.Gets().Where(m => listUserEducationString.Contains(user.Id.ToString()) && !userExistList.Contains(user.Id.ToString())).ToList();

            model.ListSuggestion = userLocation.Union(userEducation).ToList();

            #endregion

            // Read or Edit
            model.Modify = userId == User.Identity.GetUserId();

            model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
            // Test Log
            Log.Error(new Exception("Test"));
            return View(model);
        }
Пример #5
0
 public ActionResult Index(string account)
 {
     var model = new AboutViewModel();
     var repo = new Repository<UserModel>(DbCollection.User);
     var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
     var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
     var repoEducation = new Repository<EducationModel>(DbCollection.Education);
     var repoExperience = new Repository<ExperienceModel>(DbCollection.Experience);
     var repoExperienceEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment);
     var repoContact = new Repository<ContactModel>(DbCollection.Contact);
     var repoContactType = new Repository<ContactTypeModel>(DbCollection.ContactType);
     var userId = !string.IsNullOrEmpty(account) ? account.Split('-').Last() : User.Identity.GetUserId();
     var user = repo.GetById(userId);
     model.User = user;
     var share = new ShareViewModel
     {
         ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId)),
         ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList()
     };
     model.Share = share;
     model.ListEducation = repoEducation.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.Experience = repoExperience.Gets().FirstOrDefault(m => m.UserId.Equals(userId)) ??
                        new ExperienceModel();
     model.ListExperienceEmployment = repoExperienceEmployment.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.ListContact = repoContact.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.ListContactType = repoContactType.Gets().ToList();
     // Read or Edit
     model.Modify = userId == User.Identity.GetUserId();
     model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
     // Test Log
     Log.Error(new Exception("Test"));
     return View(model);
 }
Пример #6
0
        public ActionResult SettingExperience()
        {
            var model = new SettingExperienceViewModel();
            var repo = new Repository<ExperienceModel>(DbCollection.Experience);
            var repoEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment);
            var experience = repo.Gets().FirstOrDefault(m => m.UserId.Equals(User.Identity.GetUserId()));
            if (experience != null)
            {
                model.Occupation = experience.Occupation;
                model.Skill = experience.Skill;
            }
            model.ListExperienceEmployment = repoEmployment.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_ExperiencePartial", model);
        }
Пример #7
0
        public ActionResult SettingEducation()
        {
            var model = new SettingEducationViewModel();
            var repoEducation = new Repository<EducationModel>(DbCollection.Education);
            model.ListEducation = repoEducation.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_EducationPartial", model);
        }
Пример #8
0
        public ActionResult SettingDetails()
        {
            var model = new AboutViewModel
            {
                User = GetOwnerUser()
            };

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_DetailsPartial", model);
        }
Пример #9
0
        public ActionResult SettingContact()
        {
            var model = new SettingContactViewModel();
            var repo = new Repository<ContactModel>(DbCollection.Contact);
            model.ListContact = repo.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();
            var repoContactType = new Repository<ContactTypeModel>(DbCollection.ContactType);
            model.ListContactType = repoContactType.Gets();
            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_ContactPartial", model);
        }