Пример #1
0
        public static List<MarriageWitness> DeSerializeWitnesses(string witnessDtos, ServiceMarriage marriage)
        {
            var witnesses = new List<MarriageWitness>();

            var serializer = new JavaScriptSerializer();
            var marriages = serializer.DeserializeToMarriageWitnesses(witnessDtos, marriage.MarriageDate.ParseToValidYear(), marriage.MarriageDate,
                                                                      marriage.MarriageLocation, marriage.LocationId.ToGuid());

            foreach (WitnessDto witnessDto in marriages)
            {
                var person = new ServicePerson();
                var nMarriageWitness = new MarriageWitness();

                person.ReferenceYear = witnessDto.Year;
                person.ReferenceDate = witnessDto.Date;
                person.ReferenceLocation = witnessDto.Location;
                person.ReferenceLocationId = witnessDto.LocationId.ToString();
                person.ChristianName = witnessDto.Name;
                person.Surname = witnessDto.Surname;
                person.OthersideChristianName = "";
                person.OthersideSurname = "";
                person.OthersideRelationship = "";
                person.Notes = "Witness to marriage of " + marriage.MaleSName + " and " + marriage.FemaleSName + " " + marriage.MarriageDate + " at " + marriage.MarriageLocation;

                nMarriageWitness.Description = witnessDto.Description;
                nMarriageWitness.Person = person;
                witnesses.Add(nMarriageWitness);
            }

            return witnesses;
        }
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");
            Console.Title = "AFF.DomainValidation";

            _ServicePerson = new ServicePerson();

            Menu();
        }
Пример #3
0
        public ServicePerson Get(Guid personId)
        {
            var servicePerson = new ServicePerson();

            if (!_security.IsvalidSelect()) throw new SecurityException("Missing select permission");

            if (personId == Guid.Empty) return servicePerson;

            servicePerson = _personDal.Get(personId);

            if (servicePerson != null)
                servicePerson.Sources = _sourceMappingsDal.GetSourceGuidList(personId);

            return servicePerson;
        }
Пример #4
0
        static void Main(string[] args)
        {
            //BinaryFormatter bf = new BinaryFormatter();

            //using (FileStream fs = new FileStream(@"\\dc\Студенты\ПКО\SMP-172.1\listSerial.txt", FileMode.OpenOrCreate))
            //{
            //    var t = (List<PC>)bf.Deserialize(fs);
            //    Console.WriteLine("Объекты успешно десериализированы");
            //    foreach (PC item in t)
            //    {
            //        Console.WriteLine(item.Mark + "\t" + item.Model + "\t" + item.Price + "\t" + item.SerialNumber);
            //    }
            //}

            ServicePerson.GenerateW();
            ServicePerson.Deserialize();
        }
Пример #5
0
        public static List<MarriageWitness> AddWitnesses(List<WitnessDto> witnessDtos)
        {
            var witnesses = new List<MarriageWitness>();

            foreach (WitnessDto witnessDto in witnessDtos)
            {
                var witPers3 = new ServicePerson();
                var nMarriageWitness = new MarriageWitness();

                witPers3.ReferenceYear = witnessDto.Year;
                witPers3.ReferenceDate = witnessDto.Date;
                witPers3.ReferenceLocation = witnessDto.Location;
                witPers3.ReferenceLocationId = witnessDto.LocationId.ToString();
                witPers3.ChristianName = witnessDto.Name;
                witPers3.Surname = witnessDto.Surname;
                nMarriageWitness.Description = witnessDto.Description;
                nMarriageWitness.Person = witPers3;
                witnesses.Add(nMarriageWitness);
            }

            return witnesses;
        }
        public static ServicePerson ToServicePerson(this Person person)
        {
            var sp = new ServicePerson()
            {
                Baptism = person.BaptismDateStr,
                BaptismYear = person.BapInt,
                Birth = person.BirthDateStr,
                BirthCounty = person.BirthCounty,
                BirthLocation = person.BirthLocation,
                BirthLocationId = person.BirthLocationId.ToString(),
                BirthYear = person.BirthInt == 0 ? person.BapInt : person.BirthInt,
                ChristianName = person.ChristianName,
                DeathYear = person.DeathInt,
                Death = person.DeathDateStr,
                DeathCounty = person.DeathCounty,
                DeathLocation = person.DeathLocation,
                DeathLocationId = person.DeathLocationId.ToString(),
                FatherChristianName = person.FatherChristianName,
                FatherOccupation = person.FatherOccupation,
                FatherSurname = person.FatherSurname,
                LinkedTrees = "SP_only",

                MotherChristianName = person.MotherChristianName,
                MotherSurname = person.MotherSurname,
                Notes = person.Notes,
                Occupation = person.Occupation,
                PersonId = person.Person_id,
                ReferenceYear = person.ReferenceDateInt,
                ReferenceDate = person.ReferenceDateStr,
                ReferenceLocation = person.ReferenceLocation,
                ReferenceLocationId = person.ReferenceLocationId.ToString(),
                SourceDescription = person.Source,
                Spouse = (person.SpouseName + " " + person.SpouseSurname).ToString().Trim(),
                SpouseChristianName = person.SpouseName,
                SpouseSurname = person.SpouseSurname,
                Surname = person.Surname,
                UniqueReference = person.UniqueRef.ToString(),
                Events = person.TotalEvents.ToString(),
                SourceParishName = "",
                SourceDateInt = 0,
                SourceDateStr = "",
                SourceRef = "",
                OthersideChristianName = person.OthersideChristianName,
                OthersideSurname = person.OthersideSurname,
                OthersideRelationship = person.OthersideRelationship,
                IsMale = person.IsMale.ToString()
            };

            return sp;
        }
Пример #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);
        }
Пример #8
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;
        }
Пример #9
0
 public FormInicio()
 {
     InitializeComponent();
     servicePerson = new ServicePerson();
 }
Пример #10
0
        public void Save(ServicePerson servicePerson,List<Guid> sourceIds,  IValidator validator = null)
        {
            if (validator != null && !validator.ValidEntry()) throw new InvalidDataException(validator.GetErrors());

            if (servicePerson.PersonId == Guid.Empty)
            {
                InsertNewRecord(servicePerson, sourceIds);
            }
            else
            {
                EditSelectedRecord(servicePerson, sourceIds);
            }
        }
Пример #11
0
        private void InsertNewRecord(ServicePerson servicePerson, List<Guid> sourceIds)
        {
            if (!_security.IsValidInsert()) throw new SecurityException("Missing insert permission");

            _personDal.Insert(servicePerson);

            _sourceMappingsDal.WritePersonSources2(servicePerson.PersonId, sourceIds, _security.UserId());
        }
Пример #12
0
        private void EditSelectedRecord(ServicePerson servicePerson,List<Guid> sourceIds)
        {
            if (!_security.IsValidEdit()) throw new SecurityException("Missing edit permission");

            _personDal.Update(servicePerson);

            _sourceMappingsDal.WritePersonSources2(servicePerson.PersonId, sourceIds, _security.UserId());
        }
Пример #13
0
 public PersonValidator(ServicePerson servicePerson)
 {
     ServicePerson = servicePerson;
 }
Пример #14
0
        public void Update(ServicePerson person)
        {
            using (var context = new GeneralModelContainer())
            {

                var personEntity = context.Persons.FirstOrDefault(o => o.Person_id == person.PersonId);

                if (personEntity != null)
                {

                    personEntity.BapInt = person.BaptismYear;
                    personEntity.BirthInt = person.BirthYear;
                    personEntity.DeathInt = person.DeathYear;
                    personEntity.ReferenceDateInt = person.ReferenceDate.ParseToValidYear(); // DateTools.GetDateYear();

                    //  _person.UserId = userId;
                    //_person.EventPriority = eventPriority;
                    //      _person.EstBirthYearInt = estBirthInt;
                    //_person.EstDeathYearInt = estDeathInt;
                    //_person.IsEstBirth = isEstBirth;
                    //_person.IsEstDeath = isEstDeath;
                    //_person.OrigSurname = origName;
                    //_person.OrigFatherSurname = origFatherName;
                    //_person.OrigMotherSurname = origMotherName;

                    personEntity.IsMale = person.IsMale.ToBool();
                    personEntity.ChristianName = person.ChristianName;
                    personEntity.Surname = person.Surname;
                    personEntity.BirthLocation = person.BirthLocation;
                    personEntity.BirthDateStr = person.Birth;
                    personEntity.BaptismDateStr = person.Baptism;
                    personEntity.DeathDateStr = person.Death;
                    personEntity.ReferenceDateStr = person.ReferenceDate;
                    personEntity.DeathLocation = person.DeathLocation;
                    personEntity.FatherChristianName = person.FatherChristianName;
                    personEntity.FatherSurname = person.FatherSurname;
                    personEntity.MotherChristianName = person.MotherChristianName;
                    personEntity.MotherSurname = person.MotherSurname;
                    personEntity.Notes = person.Notes;
                    personEntity.Source = person.SourceDescription;

                    personEntity.ReferenceLocation = person.ReferenceLocation;
                    personEntity.BirthCounty = person.BirthCounty;
                    personEntity.DeathCounty = person.DeathCounty;
                    personEntity.Occupation = person.Occupation;
                    personEntity.FatherOccupation = person.FatherOccupation;
                    personEntity.SpouseName = person.SpouseChristianName;
                    personEntity.SpouseSurname = person.SpouseSurname;

                    personEntity.BirthLocationId = person.BirthLocationId.ToGuid();
                    personEntity.DeathLocationId = person.DeathLocationId.ToGuid();
                    personEntity.ReferenceLocationId = person.ReferenceLocationId.ToGuid();

                    if (person.Events != null)
                        personEntity.TotalEvents = person.Events.ToInt32();

                    personEntity.UniqueRef = person.UniqueReference.ToGuid();

                }

                context.SaveChanges();

            }
        }
Пример #15
0
        public Guid Insert(ServicePerson person)
        {
            //todo fix the service person so it cant contain nulls!!

            using (var context = new GeneralModelContainer())
            {

                var personEntity = new Person
                {
                    IsMale = person.IsMale.ToBool(),
                    ChristianName = person.ChristianName ?? "",
                    Surname = person.Surname ?? "",
                    BirthLocation = person.BirthLocation ?? "",
                    BirthDateStr = person.Birth ?? "",
                    BaptismDateStr = person.Baptism ?? "",
                    DeathDateStr = person.Death ?? "",
                    ReferenceDateStr = person.ReferenceDate ?? "",
                    DeathLocation = person.DeathLocation ?? "",
                    FatherChristianName = person.FatherChristianName ?? "",
                    FatherSurname = person.FatherSurname ?? "",
                    MotherChristianName = person.MotherChristianName ?? "",
                    MotherSurname = person.MotherSurname ?? "",
                    Notes = person.Notes ?? "",
                    Source = person.SourceDescription ?? "",
                    BapInt = person.BaptismYear,
                    BirthInt = person.BirthYear,
                    DeathInt = person.DeathYear,
                    ReferenceDateInt = person.ReferenceDate.ParseToValidYear(), // DateTools.GetDateYear(),
                    ReferenceLocation = person.ReferenceLocation ?? "",
                    BirthCounty = person.BirthCounty ?? "",
                    DeathCounty = person.DeathCounty ?? "",
                    Occupation = person.Occupation ?? "",
                    FatherOccupation = person.FatherOccupation ?? "",
                    SpouseName = person.SpouseChristianName ?? "",
                    SpouseSurname = person.SpouseSurname ?? "",
                    UserId = 1,
                    BirthLocationId = person.BirthLocationId.ToGuid(),
                    DeathLocationId = person.DeathLocationId.ToGuid(),
                    ReferenceLocationId = person.ReferenceLocationId.ToGuid(),
                    TotalEvents = 1,
                    EventPriority = 1,
                    UniqueRef = Guid.NewGuid(),
                    EstBirthYearInt = 0,
                    EstDeathYearInt = 0,
                    IsEstBirth = false,
                    IsEstDeath = false,
                    OthersideChristianName = person.OthersideChristianName,
                    OthersideSurname = person.OthersideSurname,
                    OthersideRelationship = person.OthersideRelationship,
                    Person_id = Guid.NewGuid(),
                    DateAdded = DateTime.Today,
                    DateLastEdit = DateTime.Today
                };

                context.Persons.Add(personEntity);

                context.SaveChanges();

                person.PersonId = personEntity.Person_id;
                return personEntity.Person_id;
            }
        }
        public IHttpActionResult GetPerson(string id)
        {
            string retVal = "";

            var sp = new ServicePerson();

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

            sp.ErrorStatus = retVal;

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

            if (sp.PersonId == Guid.Empty)
            {
                return Content(HttpStatusCode.NotFound, id);
            }

            return Ok(sp);
        }