public static IEnumerable <PersonModel> GetTargetProfiles()
        {
            MasterTargetListViewModel masterTargetListViewModel = AlohomoraServices.GetService("MasterTargetListViewModel") as MasterTargetListViewModel;

            if (masterTargetListViewModel != null)
            {
                return(masterTargetListViewModel.TargetProfiles);
            }
            else
            {
                return(null);
            }
        }
        public static void SaveTargetProfiles()
        {
            MasterTargetListViewModel masterTargetListViewModel = AlohomoraServices.GetService("MasterTargetListViewModel") as MasterTargetListViewModel;

            string json = Serializer.PersonModelsToJson(masterTargetListViewModel.TargetProfiles);

            if (File.Exists("./cachedTargets.alohomora"))
            {
                File.Delete("./cachedTargets.alohomora");
            }
            File.AppendAllText("./cachedTargets.alohomora", json);
            File.Encrypt("./cachedTargets.alohomora");
        }
        public static void AddTarget(PersonModel model)
        {
            MasterTargetListViewModel masterTargetListViewModel = AlohomoraServices.GetService("MasterTargetListViewModel") as MasterTargetListViewModel;

            if (masterTargetListViewModel != null)
            {
                bool targetExists = masterTargetListViewModel.TargetProfiles.Where(profile => profile.PersonId == model.PersonId).Count() > 0;
                if (!targetExists)
                {
                    masterTargetListViewModel.TargetProfiles.Add(model);
                    masterTargetListViewModel.OnPropertyChanged("TargetProfiles");
                }
            }
        }
        public void DeleteItemExecuted(Object args)
        {
            PersonModel personModel = args as PersonModel;

            if (personModel != null)
            {
                MessageBoxResult result = MessageBox.Show("Delete Target Profile?", "Are you sure you'd like to delete this target profile?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

                if (result == MessageBoxResult.Yes)
                {
                    MasterTargetListViewModel.RemoveTarget(personModel);
                }
            }
        }
예제 #5
0
        public void ConvertToPersonModelExecuted(object args)
        {
            PersonModel personModel = new PersonModel();

            FacebookLinkModel facebookLinkModel = SelectedFacebookLinkModel;

            personModel.ImageUrls.Add(facebookLinkModel.ProfileImage);
            foreach (string job in facebookLinkModel.Jobs)
            {
                personModel.Jobs.Add(job);
            }
            personModel.Names.Add(facebookLinkModel.DisplayName);
            personModel.Names.Add(facebookLinkModel.FirstName + " " + facebookLinkModel.LastName);
            if (facebookLinkModel.PossibleLinks != null && facebookLinkModel.PossibleLinks.Count > 0)
            {
                DBLinkModel dblink = facebookLinkModel.PossibleLinks.FirstOrDefault();
                personModel.Names.Add(dblink.FormatedName);
                personModel.Dobs.Add(dblink.dob);
                personModel.Addresses.Add(dblink.address);
            }
            foreach (Person pipLink in facebookLinkModel.PiplLinks)
            {
                if (!pipLink.Selected)
                {
                    continue;
                }

                if (pipLink.dob != null)
                {
                    personModel.Dobs.Add(pipLink.dob.date_range.start);
                }

                foreach (Name name in pipLink.names)
                {
                    personModel.Names.Add(name.display);
                }

                foreach (Address address in pipLink.addresses)
                {
                    personModel.Addresses.Add(address.display);
                }
                foreach (Job job in pipLink.jobs)
                {
                    personModel.Jobs.Add(job.display);
                }
                foreach (Phone phone in pipLink.phones)
                {
                    personModel.PhoneNumbers.Add(phone.display);
                }
                foreach (Image image in pipLink.images)
                {
                    personModel.ImageUrls.Add(image.url);
                }
                foreach (Education education in pipLink.educations)
                {
                    personModel.Schools.Add(education.school + " - " + education.degree);
                }

                foreach (string detail in facebookLinkModel.ParsedDetails)
                {
                    personModel.Details.Add(detail);
                }
            }

            MasterTargetListViewModel.AddTarget(personModel);
        }