예제 #1
0
        public Census(CensusDate censusDate, bool censusDone)
        {
            InitializeComponent();
            dgCensus.AutoGenerateColumns = false;
            ExtensionMethods.DoubleBuffered(dgCensus, true);
            ft = FamilyTree.Instance;
            reportFormHelper = new ReportFormHelper(this, "Census Report", dgCensus, ResetTable, "Census");

            LostCousins   = false;
            CensusDate    = censusDate;
            censusCountry = CensusDate.Country;
            RecordCount   = 0;
            CensusDone    = censusDone;
            string defaultProvider = (string)Application.UserAppDataRegistry.GetValue("Default Search Provider");

            if (defaultProvider == null)
            {
                defaultProvider = "FamilySearch";
            }
            string defaultRegion = (string)Application.UserAppDataRegistry.GetValue("Default Region");

            if (defaultRegion == null)
            {
                defaultRegion = ".co.uk";
            }
            cbCensusSearchProvider.Text = defaultProvider;
            cbRegion.Text = defaultRegion;
            CensusSettingsUI.CompactCensusRefChanged += new EventHandler(RefreshCensusReferences);
            Top += NativeMethods.TopTaskbarOffset;
        }
예제 #2
0
 protected void OnCensusChanged(EventArgs e)
 {
     if (CensusChanged != null)
     {
         CensusChanged(this, e);
         this.previousDate = (CensusDate)cbCensusDate.SelectedItem;
     }
 }
예제 #3
0
 public void AddLCCensusItems()
 {
     cbCensusDate.Items.Clear();
     cbCensusDate.Items.Add(CensusDate.UKCENSUS1841);
     cbCensusDate.Items.Add(CensusDate.UKCENSUS1881);
     cbCensusDate.Items.Add(CensusDate.UKCENSUS1911);
     cbCensusDate.Items.Add(CensusDate.USCENSUS1880);
     cbCensusDate.Items.Add(CensusDate.CANADACENSUS1881);
     cbCensusDate.Items.Add(CensusDate.IRELANDCENSUS1911);
     previousDate = defaultDate;
     RevertToDefaultDate();
     SetControlWidth();
 }
예제 #4
0
 public void AddAllCensusItems()
 {
     cbCensusDate.Items.Clear();
     AddCensusItems(Countries.UNITED_KINGDOM);
     AddCensusItems(Countries.IRELAND);
     AddCensusItems(Countries.UNITED_STATES);
     AddCensusItems(Countries.CANADA);
     AddValuationItems();
     defaultDate  = CensusDate.UKCENSUS1881;
     previousDate = defaultDate;
     RevertToDefaultDate();
     SetControlWidth();
 }
        void LostCousinsCensus(CensusDate censusDate, string reportTitle)
        {
            Census census = new Census(censusDate, true);
            Predicate <CensusIndividual> relationFilter           = RelationshipTypesOutlet.BuildFilter <CensusIndividual>(x => x.RelationType);
            Predicate <Individual>       individualRelationFilter = RelationshipTypesOutlet.BuildFilter <Individual>(x => x.RelationType);

            census.SetupLCCensus(relationFilter, ShowAlreadyEnteredOutlet.State == NSCellStateValue.On, individualRelationFilter);
            if (ShowAlreadyEnteredOutlet.State == NSCellStateValue.On)
            {
                census.ShowWindow($"{reportTitle} already entered into Lost Cousins website (includes entries with no country)");
            }
            else
            {
                census.ShowWindow($"{reportTitle} to enter into Lost Cousins website");
            }
            Task.Run(() => Analytics.TrackActionAsync(Analytics.LostCousinsAction, Analytics.LCReportYearEvent, censusDate.BestYear.ToString()));
        }
예제 #6
0
        public Census(CensusDate censusDate, bool censusDone)
        {
            LostCousins    = false;
            CensusDate     = censusDate;
            RecordCount    = 0;
            _censusCountry = CensusDate.Country;
            _censusDone    = censusDone;
            var storyboard = NSStoryboard.FromName("ColourCensus", null);

            censusWindow = storyboard.InstantiateControllerWithIdentifier("ColourCensusWindow") as NSWindowController;
            censusWindow.Window.SetFrame(new CoreGraphics.CGRect(300, 300, 800, 500), true);
            //string defaultProvider = (string)Application.UserAppDataRegistry.GetValue("Default Search Provider");
            //if (defaultProvider == null)
            //    defaultProvider = "FamilySearch";
            //cbCensusSearchProvider.Text = defaultProvider;
            //CensusSettingsUI.CompactCensusRefChanged += new EventHandler(RefreshCensusReferences);
        }
예제 #7
0
 /// <summary>
 /// This method returns true if all required Parameters exits and has default values
 /// </summary>
 /// <returns></returns>
 public bool HasRecords()
 {
     if (!(string.IsNullOrEmpty(CensusDate.GetValue())) &&
         !(string.IsNullOrEmpty(ReturnDesc.GetValue())) &&
         !(string.IsNullOrEmpty(AttendanceCollectedFrom.GetValue())) &&
         !(string.IsNullOrEmpty(AttendanceCollectedTo.GetValue())) &&
         !(string.IsNullOrEmpty(ExclusionsCollectedFrom.GetValue())) &&
         !(string.IsNullOrEmpty(ExclusionsCollectedTo.GetValue())) &&
         !(string.IsNullOrEmpty(FSMCollectedFrom.GetValue())) &&
         !(string.IsNullOrEmpty(FSMCollectedTo.GetValue())) &&
         !(string.IsNullOrEmpty(LearnerSupportCollectedFrom.GetValue())) &&
         !(string.IsNullOrEmpty(LearnerSupportCollectedTo.GetValue())))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #8
0
        public static int AddLostCousinsFacts()
        {
            int count = 0;

            if (InstanceConnection.State != ConnectionState.Open)
            {
                InstanceConnection.Open();
            }
            using (SqliteCommand cmd = new SqliteCommand("select CensusYear, CensusCountry, CensusRef, IndID, FullName from LostCousins", InstanceConnection))
            {
                using (SqliteDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string     indID    = reader["IndID"].ToString();
                        string     fullName = reader["FullName"].ToString();
                        Individual ind      = FamilyTree.Instance.GetIndividual(indID);
                        if (ind?.Name == fullName) // only load if individual exists in this tree.
                        {
                            string CensusYear    = reader["CensusYear"].ToString();
                            string CensusCountry = reader["CensusCountry"].ToString();
                            string CensusRef     = reader["CensusRef"].ToString();
                            if (!ind.IsLostCousinsEntered(CensusDate.GetLostCousinsCensusYear(new FactDate(CensusYear), true)))
                            {
                                FactLocation location = FactLocation.GetLocation(CensusCountry);
                                Fact         f        = new Fact(CensusRef, Fact.LOSTCOUSINS, new FactDate(CensusYear), location, string.Empty, true, true);
                                ind?.AddFact(f);
                            }
                            count++;
                        }
                        else
                        {
                            Console.Write("name wrong");
                            // UpdateFullName(reader, ind.Name); needed during testing
                        }
                    }
                }
            }
            return(count);
        }
예제 #9
0
 public CensusDateSelector()
 {
     InitializeComponent();
     cbCensusDate.Items.Clear();
     previousDate = defaultDate;
 }
예제 #10
0
        public Facts(CensusReference.ReferenceStatus status, Predicate <Individual> filter, CensusDate censusDate)
            : this()
        {
            allFacts = true;
            IEnumerable <Individual> listToCheck = ft.AllIndividuals.Filter(filter);

            foreach (Individual ind in listToCheck)
            {
                foreach (Fact f in ind.AllFacts)
                {
                    if (f.IsCensusFact && f.FactDate.Overlaps(censusDate) && f.CensusReference != null && f.CensusReference.Status == status)
                    {
                        facts.Add(new DisplayFact(ind, f));
                    }
                }
            }
            if (status == FTAnalyzer.CensusReference.ReferenceStatus.GOOD)
            {
                Text = $"Census Reference Report. Facts count: {facts.Count}";
            }
            else if (status == FTAnalyzer.CensusReference.ReferenceStatus.INCOMPLETE)
            {
                Text = $"Incomplete Census Reference Report. Facts count: {facts.Count}";
            }
            else if (status == FTAnalyzer.CensusReference.ReferenceStatus.UNRECOGNISED)
            {
                Text = $"Unrecognised Census Reference Report. Facts count: {facts.Count}";
            }
            else if (status == FTAnalyzer.CensusReference.ReferenceStatus.BLANK)
            {
                Text = $"Blank Census Reference Report. Facts count: {facts.Count}";
            }
            SetupFacts();
            //dgFacts.Columns["CensusReference"].Visible = true;
            Analytics.TrackAction(Analytics.FactsFormAction, Analytics.FactsCensusRefEvent);
        }