Пример #1
0
        private bool CheckSpecificFilter()
        {
            bool result = false;

            IndividualListFilter iFilter = (IndividualListFilter)fFilter;

            if ((iFilter.Sex == GDMSex.svUnknown || fRec.Sex == iFilter.Sex) &&
                (IsMatchesMask(buf_fullname, iFilter.Name)) &&
                (IsMatchesPlace(iFilter.Residence)) &&
                (IsMatchesEventVal(iFilter.EventVal)) &&
                (!iFilter.PatriarchOnly || fRec.Patriarch))
            {
                bool isLive = (buf_dd == null);

                switch (iFilter.FilterLifeMode)
                {
                case FilterLifeMode.lmOnlyAlive:
                    if (!isLive)
                    {
                        return(false);
                    }
                    break;

                case FilterLifeMode.lmOnlyDead:
                    if (isLive)
                    {
                        return(false);
                    }
                    break;

                case FilterLifeMode.lmAliveBefore:
                    UDN bdt = (buf_bd == null) ? UDN.CreateEmpty() : buf_bd.Date.GetUDN();
                    UDN ddt = (buf_dd == null) ? UDN.CreateEmpty() : buf_dd.Date.GetUDN();
                    if ((bdt.CompareTo(filter_abd) > 0) || (ddt.CompareTo(filter_abd) < 0))
                    {
                        return(false);
                    }
                    break;

                case FilterLifeMode.lmTimeLocked:
                    break;
                }

                switch (iFilter.FilterGroupMode)
                {
                case FilterGroupMode.All:
                    break;

                case FilterGroupMode.None:
                    if (fRec.HasGroups)
                    {
                        return(false);
                    }
                    break;

                case FilterGroupMode.Any:
                    if (!fRec.HasGroups)
                    {
                        return(false);
                    }
                    break;

                case FilterGroupMode.Selected:
                    if (fRec.IndexOfGroup(filter_grp) < 0)
                    {
                        return(false);
                    }
                    break;
                }

                switch (iFilter.SourceMode)
                {
                case FilterGroupMode.All:
                    break;

                case FilterGroupMode.None:
                    if (fRec.HasSourceCitations)
                    {
                        return(false);
                    }
                    break;

                case FilterGroupMode.Any:
                    if (!fRec.HasSourceCitations)
                    {
                        return(false);
                    }
                    break;

                case FilterGroupMode.Selected:
                    if (fRec.IndexOfSource(filter_source) < 0)
                    {
                        return(false);
                    }
                    break;
                }

                result = true;
            }

            return(result);
        }