Esempio n. 1
0
 void DgReportSheet_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         FamilyTree ft = FamilyTree.Instance;
         if (e.ColumnIndex >= birthColumnIndex && e.ColumnIndex <= burialColumnIndex)
         {
             DataGridViewCell cell  = dgBMDReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex];
             BMDColours       value = (BMDColours)cell.Value;
             if (value != BMDColours.EXACT_DATE)
             {
                 IDisplayColourBMD person = (IDisplayColourBMD)dgBMDReportSheet.Rows[e.RowIndex].DataBoundItem;
                 Individual        ind    = ft.GetIndividual(person.IndividualID);
                 if (e.ColumnIndex == birthColumnIndex || e.ColumnIndex == birthColumnIndex + 1)
                 {
                     ft.SearchBMD(FamilyTree.SearchType.BIRTH, ind, ind.BirthDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null);
                 }
                 else if (e.ColumnIndex >= birthColumnIndex + 2 && e.ColumnIndex <= birthColumnIndex + 4)
                 {
                     FactDate   marriageDate = FactDate.UNKNOWN_DATE;
                     Individual spouse       = null;
                     if (e.ColumnIndex == birthColumnIndex + 2)
                     {
                         marriageDate = ind.FirstMarriageDate;
                         spouse       = ind.FirstSpouse;
                     }
                     if (e.ColumnIndex == birthColumnIndex + 3)
                     {
                         marriageDate = ind.SecondMarriageDate;
                         spouse       = ind.SecondSpouse;
                     }
                     if (e.ColumnIndex == birthColumnIndex + 4)
                     {
                         marriageDate = ind.ThirdMarriageDate;
                         spouse       = ind.ThirdSpouse;
                     }
                     ft.SearchBMD(FamilyTree.SearchType.MARRIAGE, ind, marriageDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, spouse);
                 }
                 else if (e.ColumnIndex == burialColumnIndex || e.ColumnIndex == burialColumnIndex - 1)
                 {
                     ft.SearchBMD(FamilyTree.SearchType.DEATH, ind, ind.DeathDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null);
                 }
             }
         }
         else if (e.ColumnIndex >= 0)
         {
             string     indID    = (string)dgBMDReportSheet.CurrentRow.Cells["IndividualID"].Value;
             Individual ind      = ft.GetIndividual(indID);
             Facts      factForm = new Facts(ind);
             factForm.Show();
         }
     }
 }
Esempio n. 2
0
        List <IDisplayColourBMD> BuildFilter(List <FamilyTree.SearchType> types, BMDColours toFind)
        {
            var result = new List <IDisplayColourBMD>();

            foreach (IDisplayColourBMD row in reportList)
            {
                if (types.Contains(FamilyTree.SearchType.BIRTH) && (row.Birth == toFind || row.BaptChri == toFind))
                {
                    result.Add(row);
                }
                else if (types.Contains(FamilyTree.SearchType.MARRIAGE) && (row.Marriage1 == toFind || row.Marriage2 == toFind || row.Marriage3 == toFind))
                {
                    result.Add(row);
                }
                else if (types.Contains(FamilyTree.SearchType.DEATH) && (row.Death == toFind || row.CremBuri == toFind))
                {
                    result.Add(row);
                }
            }
            return(result);
        }
Esempio n. 3
0
        void UpdateBMDFilter()
        {
            Cursor = Cursors.WaitCursor;
            var        types  = new List <FamilyTree.SearchType>();
            BMDColours colour = BMDColours.ALL_RECORDS;

            switch (cbApplyTo.SelectedIndex)
            {
            case -1:     // nothing selected
                break;

            case 0:     // All BMD Records
                types.Add(FamilyTree.SearchType.BIRTH);
                types.Add(FamilyTree.SearchType.MARRIAGE);
                types.Add(FamilyTree.SearchType.DEATH);
                break;

            case 1:     // Births Only
                types.Add(FamilyTree.SearchType.BIRTH);
                break;

            case 2:     // Marriages Only
                types.Add(FamilyTree.SearchType.MARRIAGE);
                break;

            case 3:     // Deaths Only
                types.Add(FamilyTree.SearchType.DEATH);
                break;

            case 4:     // Births & Deaths
                types.Add(FamilyTree.SearchType.BIRTH);
                types.Add(FamilyTree.SearchType.DEATH);
                break;

            case 5:     // Births & Marriages
                types.Add(FamilyTree.SearchType.BIRTH);
                types.Add(FamilyTree.SearchType.MARRIAGE);
                break;

            case 6:     // Marriages & Deaths
                types.Add(FamilyTree.SearchType.MARRIAGE);
                types.Add(FamilyTree.SearchType.DEATH);
                break;
            }
            switch (cbFilter.SelectedIndex)
            {
            case -1:    // nothing selected
            case 0:     // All Individuals
                dgBMDReportSheet.DataSource = reportList;
                break;

            case 1:     // Date Missing (Red)
                colour = BMDColours.UNKNOWN_DATE;
                break;

            case 2:     // Date Found (Green)
                colour = BMDColours.EXACT_DATE;
                break;

            case 3:     // Open Ended Date Range (Orange Red)
                colour = BMDColours.OPEN_ENDED_DATE;
                break;

            case 4:     // Very Wide Date Range(Light Red)
                colour = BMDColours.VERY_WIDE_DATE;
                break;

            case 5:     // Wide Date Range (Orange)
                colour = BMDColours.WIDE_DATE;
                break;

            case 6:     // Narrow date ranges (Yellow)
                colour = BMDColours.NARROW_DATE;
                break;

            case 7:     // Just year date ranges (Yellow)
                colour = BMDColours.JUST_YEAR_DATE;
                break;

            case 8:     // Approx date ranges (Light Green)
                colour = BMDColours.APPROX_DATE;
                break;

            case 9:     // Of Marrying age (Peach)
                colour = BMDColours.NO_SPOUSE;
                break;

            case 10:     // No Partner shared fact/children (Light Blue)
                colour = BMDColours.NO_PARTNER;
                break;

            case 11:     // Partner but no marriage (Dark Blue)
                colour = BMDColours.NO_MARRIAGE;
                break;
            }
            if (cbFilter.SelectedIndex > 0)
            {
                dgBMDReportSheet.DataSource = new SortableBindingList <IDisplayColourBMD>(BuildFilter(types, colour));
            }
            dgBMDReportSheet.Focus();
            tsRecords.Text = $"{Properties.Messages.Count}{dgBMDReportSheet.RowCount} records listed.";
            Cursor         = Cursors.Default;
        }
Esempio n. 4
0
        void DgReportSheet_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }
            if (e.ColumnIndex < birthColumnIndex || e.ColumnIndex > burialColumnIndex)
            {
                DataGridViewCell cell = dgBMDReportSheet.Rows[e.RowIndex].Cells["Relation"];

                // DataGridViewPrint is driven by the <cell>.Style, setting that property allows
                // colors/formatting to work in print/preview.
                DataGridViewCell thisCell = dgBMDReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex];

                string relation = (string)cell.Value;
                if (relation == "Direct Ancestor")
                {
                    e.CellStyle.Font    = boldFont;
                    thisCell.Style.Font = boldFont;
                }
                if (relation == "Root Person")
                {
                    e.CellStyle.Font         = boldFont;
                    e.CellStyle.ForeColor    = Color.Red;
                    thisCell.Style.Font      = boldFont;
                    thisCell.Style.ForeColor = Color.Red;
                }
            }
            else
            {
                DataGridViewCellStyle style = dgBMDReportSheet.DefaultCellStyle;
                DataGridViewCell      cell  = dgBMDReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex];
                BMDColours            value = (BMDColours)cell.Value;
                styles.TryGetValue(value, out style);
                if (style != null)
                {
                    e.CellStyle.BackColor          = style.BackColor;
                    e.CellStyle.ForeColor          = style.ForeColor;
                    e.CellStyle.SelectionForeColor = e.CellStyle.SelectionBackColor;

                    cell.InheritedStyle.BackColor          = style.BackColor;
                    cell.InheritedStyle.ForeColor          = style.ForeColor;
                    cell.InheritedStyle.SelectionForeColor = cell.InheritedStyle.SelectionBackColor;

                    cell.Style = style; // For print/preview

                    switch (value)
                    {
                    case BMDColours.EMPTY:                                           // Grey
                        if (e.ColumnIndex == burialColumnIndex - 1)                  // death column
                        {
                            cell.ToolTipText = "Individual is probably still alive"; // if OVER90 still grey cell but use different tooltip
                        }
                        else
                        {
                            cell.ToolTipText = string.Empty;
                        }
                        break;

                    case BMDColours.UNKNOWN_DATE:     // Red
                        cell.ToolTipText = "Unknown date.";
                        break;

                    case BMDColours.OPEN_ENDED_DATE:     // Orange Red
                        cell.ToolTipText = "Date is open ended, BEFore or AFTer a date.";
                        break;

                    case BMDColours.VERY_WIDE_DATE:     // Tomato Red
                        cell.ToolTipText = "Date only accurate to more than ten year date range.";
                        break;

                    case BMDColours.WIDE_DATE:     // Orange
                        cell.ToolTipText = "Date covers up to a ten year date range.";
                        break;

                    case BMDColours.NARROW_DATE:     // Yellow
                        cell.ToolTipText = "Date accurate to within one to two year period.";
                        break;

                    case BMDColours.JUST_YEAR_DATE:     // Yellow
                        cell.ToolTipText = "Date accurate to within one year period, but longer than 3 months.";
                        break;

                    case BMDColours.APPROX_DATE:     // Pale Green
                        cell.ToolTipText = "Date accurate to within 3 months (note may be date of registration not event date)";
                        break;

                    case BMDColours.EXACT_DATE:     // Green
                        cell.ToolTipText = "Exact date.";
                        break;

                    case BMDColours.NO_SPOUSE:     // pale grey
                        cell.ToolTipText = "Of marrying age but no spouse recorded";
                        break;

                    case BMDColours.NO_PARTNER:     // light blue
                        cell.ToolTipText = "No partner but has a shared fact or children";
                        break;

                    case BMDColours.NO_MARRIAGE:     // dark blue
                        cell.ToolTipText = "Has partner but no marriage fact";
                        break;

                    case BMDColours.ISLIVING:     // dark grey
                        cell.ToolTipText = "Is flagged as living";
                        break;

                    case BMDColours.OVER90:
                        cell.ToolTipText = "Individual may be still alive";
                        break;
                    }
                }
            }
        }