private List <IDisplayColourBMD> BuildFilter(ColourValues.BMDColour toFind, bool all) { List <IDisplayColourBMD> result = new List <IDisplayColourBMD>(); foreach (IDisplayColourBMD row in this.reportList) { if (all) { if ((row.Birth == toFind || row.Birth == 0) && (row.BaptChri == toFind || row.BaptChri == 0) && (row.Marriage1 == toFind || row.Marriage1 == 0) && (row.Marriage2 == toFind || row.Marriage2 == 0) && (row.Marriage3 == toFind || row.Marriage3 == 0) && (row.Death == toFind || row.Death == 0) && (row.CremBuri == toFind || row.CremBuri == 0)) { result.Add(row); } } else { if (row.Birth == toFind || row.BaptChri == toFind || row.Marriage1 == toFind || row.Marriage2 == toFind || row.Marriage3 == toFind || row.Death == toFind || row.CremBuri == toFind) { result.Add(row); } } } return(result); }
private 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]; ColourValues.BMDColour value = (ColourValues.BMDColour)cell.Value; if (value != ColourValues.BMDColour.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); } else if (e.ColumnIndex >= birthColumnIndex + 2 && e.ColumnIndex <= birthColumnIndex + 4) { FactDate marriageDate = FactDate.UNKNOWN_DATE; if (e.ColumnIndex == birthColumnIndex + 2) { marriageDate = ind.FirstMarriageDate; } if (e.ColumnIndex == birthColumnIndex + 3) { marriageDate = ind.SecondMarriageDate; } if (e.ColumnIndex == birthColumnIndex + 4) { marriageDate = ind.ThirdMarriageDate; } ft.SearchBMD(FamilyTree.SearchType.MARRIAGE, ind, marriageDate, cbBMDSearchProvider.SelectedIndex); } else if (e.ColumnIndex == burialColumnIndex || e.ColumnIndex == burialColumnIndex - 1) { ft.SearchBMD(FamilyTree.SearchType.DEATH, ind, ind.DeathDate, cbBMDSearchProvider.SelectedIndex); } } } 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(); } } }
private 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]; ColourValues.BMDColour value = (ColourValues.BMDColour)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 ColourValues.BMDColour.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 ColourValues.BMDColour.UNKNOWN_DATE: // Red cell.ToolTipText = "Unknown date."; break; case ColourValues.BMDColour.OPEN_ENDED_DATE: // Orange Red cell.ToolTipText = "Date is open ended, BEFore or AFTer a date."; break; case ColourValues.BMDColour.VERY_WIDE_DATE: // Tomato Red cell.ToolTipText = "Date only accurate to more than ten year date range."; break; case ColourValues.BMDColour.WIDE_DATE: // Orange cell.ToolTipText = "Date covers up to a ten year date range."; break; case ColourValues.BMDColour.NARROW_DATE: // Yellow cell.ToolTipText = "Date accurate to within one to two year period."; break; case ColourValues.BMDColour.JUST_YEAR_DATE: // Yellow cell.ToolTipText = "Date accurate to within one year period, but longer than 3 months."; break; case ColourValues.BMDColour.APPROX_DATE: // Pale Green cell.ToolTipText = "Date accurate to within 3 months (note may be date of registration not event date)"; break; case ColourValues.BMDColour.EXACT_DATE: // Green cell.ToolTipText = "Exact date."; break; case ColourValues.BMDColour.NO_SPOUSE: // pale grey cell.ToolTipText = "Of marrying age but no spouse recorded"; break; case ColourValues.BMDColour.NO_PARTNER: // light blue cell.ToolTipText = "No partner but has shared fact or children"; break; case ColourValues.BMDColour.NO_MARRIAGE: // dark blue cell.ToolTipText = "Has partner but no marriage fact"; break; case ColourValues.BMDColour.ISLIVING: // dark grey cell.ToolTipText = "Is flagged as living"; break; case ColourValues.BMDColour.OVER90: cell.ToolTipText = "Individual may be still alive"; break; } } } }