public IHttpActionResult GetPersons(string ids)
        {
            string retVal = "";

            var spo = new ServicePersonObject();

            var personSearch = new PersonSearch(new Security(new WebUser()));

            try
            {

                var searchParams = new PersonSearchFilter
                {
                    Ids = ids.ParseToGuidList()

                };

                spo = personSearch.Search(PersonSearchTypes.IdList, searchParams,
                                new DataShaping
                                {
                                    RecordStart = 0,
                                    RecordPageSize = 25
                                }, new PersonSearchValidator(searchParams));

            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

                spo.ErrorStatus = retVal;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(spo);
        }
Ejemplo n.º 2
0
        public ServicePersonObject GetPersons(string _parentId,
            string christianName,
            string surname,
            string fatherChristianName,
            string fatherSurname,
            string motherChristianName,
            string motherSurname,
            string location,
            string county,
            string lowerDate,
            string upperDate,
            string filterTreeResults,
            string filterIncludeBirths,
            string filterIncludeDeaths,
            string filterIncludeSources,
            string filterSource,
            string spouse,
            string parishFilter,

            string page_number,
            string page_size,
            string sort_col)
        {
            string retVal = "";

            Guid parentId = _parentId.ToGuid();

            var spo = new ServicePersonObject();

            var iModel = new PersonSearch(new Security(new WebUser()));

            try
            {

                if (parentId == Guid.Empty)
                {

                    var searchParams = new PersonSearchFilter
                        {
                            CName = christianName,
                            Surname = surname,
                            FatherChristianName = fatherChristianName,
                            FatherSurname = fatherSurname,
                            MotherChristianName = motherChristianName,
                            MotherSurname = motherSurname,
                            Location = location,
                            LowerDate = lowerDate.ToInt32(),
                            UpperDate = upperDate.ToInt32(),
                            IsIncludeBirths = filterIncludeBirths.ToBool(),
                            IsIncludeDeaths = filterIncludeDeaths.ToBool(),
                            IsIncludeSources = filterIncludeSources.ToBool(),
                            SpouseChristianName = spouse,
                            SourceString = filterSource,
                            ParishString = parishFilter
                        };

                    spo = iModel.Search(PersonSearchTypes.Simple, searchParams,
                                  new DataShaping
                                      {
                                          RecordStart = page_number.ToInt32(),
                                          RecordPageSize = page_size.ToInt32()
                                      }, new PersonSearchValidator(searchParams));
                }
                else
                {

                    spo = iModel.Search(PersonSearchTypes.Duplicates, new PersonSearchFilter {ParentId = parentId},
                                        new DataShaping
                                        {
                                            RecordStart = 0,
                                            RecordPageSize=25
                                        });

                }

            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

                spo.ErrorStatus = retVal;
            }

            return spo;
        }
        public IHttpActionResult GetFilteredPersons(string parentId,
            string christianName,
            string surname,
            string fatherChristianName,
            string fatherSurname,
            string motherChristianName,
            string motherSurname,
            string location,
            string county,
            string lowerDate,
            string upperDate,
            string filterTreeResults,
            string filterIncludeBirths,
            string filterIncludeDeaths,
            string filterIncludeSources,
            string sourceFilter,
            string spouse,
            string parishFilter,

            string pno,
            string psize,
            string sortcol)
        {
            string retVal = "";

            var spo = new ServicePersonObject();

            var personSearch = new PersonSearch(new Security(new WebUser()));

            try
            {

                if (parentId.ToGuid() == Guid.Empty)
                {

                    var searchParams = new PersonSearchFilter
                    {
                        CName = christianName ?? "",
                        Surname = surname ?? "",
                        FatherChristianName = fatherChristianName ?? "",
                        FatherSurname = fatherSurname ?? "",
                        MotherChristianName = motherChristianName ?? "",
                        MotherSurname = motherSurname ?? "",
                        Location = location ?? "",
                        LowerDate = lowerDate.ToInt32(),
                        UpperDate = upperDate.ToInt32(),
                        IsIncludeBirths = filterIncludeBirths.ToBool(),
                        IsIncludeDeaths = filterIncludeDeaths.ToBool(),
                        IsIncludeSources = filterIncludeSources.ToBool(),
                        SpouseChristianName = spouse ?? "",
                        SourceString = sourceFilter ?? "",
                        ParishString = parishFilter ?? ""
                    };

                    spo = personSearch.Search(PersonSearchTypes.Simple, searchParams,
                                  new DataShaping
                                  {
                                      RecordStart = pno.ToInt32(),
                                      RecordPageSize = psize.ToInt32()
                                  }, new PersonSearchValidator(searchParams));
                }
                else
                {

                    spo = personSearch.Search(PersonSearchTypes.Duplicates, new PersonSearchFilter { ParentId = parentId.ToGuid() },
                                        new DataShaping
                                        {
                                            RecordStart = 0,
                                            RecordPageSize = 25
                                        });

                }

            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

                spo.ErrorStatus = retVal;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(spo);
        }