public IHttpActionResult AddPerson(ServicePersonData servicePersonData)
        {
            string retVal = "";

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

            var servicePerson = servicePersonData.servicePersonAdd.AsServicePerson();

            try
            {
                personSearch.Save(servicePerson, servicePersonData.sources.ParseToGuidList(), new PersonValidator(servicePerson));
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

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

            return Ok(servicePerson.PersonId);
        }
Ejemplo n.º 2
0
        public string DeletePerson(string personId)
        {
            string retVal = "";

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

            try
            {
                iModel.DeleteRecords(personId.ParseToGuidList());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(personId, retVal);
        }
Ejemplo n.º 3
0
        public void AssignLocations()
        {
            var iModel = new PersonSearch(new Security(new WebUser()));

            iModel.UpdateLocationsFromParishList();
        }
Ejemplo n.º 4
0
        public void UpdateDateEstimates()
        {
            var iModel = new PersonSearch(new Security(new WebUser()));

            iModel.UpdateDateEstimates();
        }
Ejemplo n.º 5
0
        public string SetPersonRelation(string persons, string relationType)
        {
            string retVal = "";
            var iModel = new PersonSearch(new Security(new WebUser()));

            try
            {
                iModel.SetDuplicateRelation(persons.ParseToGuidList());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(persons, retVal);
        }
Ejemplo n.º 6
0
        public string RemoveLink(string person)
        {
            string retVal = "";

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

            try
            {
                retVal = iModel.DelinkPersons(person.ParseToGuidList());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(person, retVal);
        }
Ejemplo n.º 7
0
        public string AddPerson(string personId, string birthparishId, string deathparishId, string referenceparishId, string sources, string christianName, string surname, string fatherchristianname,
            string fathersurname, string motherchristianname, string mothersurname,
            string source, string ismale, string occupation, string datebirthstr,
            string datebapstr, string birthloc, string birthcounty, string datedeath,
            string deathloc, string deathcounty, string notes, string refdate,
            string refloc, string fatheroccupation, string spousesurname, string spousechristianname, string years, string months, string weeks, string days)
        {
            string retVal = "";

            WebHelper.WriteParams(birthparishId, deathparishId, referenceparishId, sources, christianName, surname, fatherchristianname,
             fathersurname, motherchristianname, mothersurname,
             source, ismale, occupation, datebirthstr,
             datebapstr, birthloc, birthcounty, datedeath,
             deathloc, deathcounty, notes, refdate,
             refloc, fatheroccupation, spousesurname, spousechristianname, years, months, weeks, days);

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

            datebirthstr = DateTools.MakeDateString(datebapstr, datebirthstr, datedeath, years, months, weeks, days);

            var sp = new ServicePerson
                {
                    PersonId = personId.ToGuid(),
                    ChristianName = christianName,
                    Surname = surname,
                    FatherChristianName = fatherchristianname,
                    FatherSurname = fathersurname,
                    MotherChristianName = motherchristianname,
                    MotherSurname = mothersurname,
                    IsMale = ismale,
                    Occupation = occupation,
                    Birth = datebirthstr,
                    Baptism = datebapstr,
                    Death = datedeath,
                    BirthLocation = birthloc,
                    DeathLocation = deathloc,
                    BirthCounty = birthcounty,
                    DeathCounty = deathcounty,
                    Notes = notes,
                    ReferenceDate = refdate,
                    FatherOccupation = fatheroccupation,
                    SpouseChristianName = spousechristianname,
                    SpouseSurname = spousesurname,
                    ReferenceLocation = refloc,
                    BirthLocationId = birthparishId,
                    ReferenceLocationId = referenceparishId,
                    DeathLocationId = deathparishId,
                    SourceDescription = source,
                    BirthYear = datebirthstr.ParseToValidYear(),//DateTools.GetDateYear(datebirthstr),
                    BaptismYear =datebapstr.ParseToValidYear(),// DateTools.GetDateYear(),
                    DeathYear =datedeath.ParseToValidYear()// DateTools.GetDateYear(datedeath)
                };

            try
            {
                iModel.Save(sp,sources.ParseToGuidList(),new PersonValidator(sp));
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(sp.PersonId.ToString(), retVal);
        }
Ejemplo n.º 8
0
        public string MergeSources(string person)
        {
            string retVal = "";

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

            try
            {
                retVal = iModel.MergeDuplicates(person.ToGuid());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(person, retVal);
        }
Ejemplo n.º 9
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;
        }
Ejemplo n.º 10
0
        public ServicePerson GetPerson(string id)
        {
            var sp = new ServicePerson();
            var iModel = new PersonSearch(new Security(new WebUser()));

            try
            {
                 sp = iModel.Get(id.ToGuid());
            }
            catch (Exception ex1)
            {
                sp.ErrorStatus = "Exception: " + ex1.Message;
            }

            return sp;
        }
Ejemplo n.º 11
0
 public PersonsController(IPersonDal iPersonDal,            
     ISourceMappingsDal iSourceMappingsDal,
     ISecurity iSecurity)
 {
     _personSearch = new PersonSearch(iSecurity, iPersonDal, iSourceMappingsDal);
 }
Ejemplo n.º 12
0
        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.º 13
0
        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);
        }