Ejemplo n.º 1
0
 public static EqualityPerson FindBySidPersonAndResidentPack(System.Collections.Generic.List<EqualityPerson> list, SidPerson sidPerson, ResidentPack residentPack)
 {
     foreach (EqualityPerson person in list)
     {
         if ((person.sidPerson == sidPerson) && (person.residentPack == residentPack))
         {
             return person;
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 public static System.Collections.Generic.List<EqualityPerson> FindByResidentPack(System.Collections.Generic.List<EqualityPerson> list, ResidentPack residentPack)
 {
     System.Collections.Generic.List<EqualityPerson> list2 = new System.Collections.Generic.List<EqualityPerson>();
     foreach (EqualityPerson person in list)
     {
         if (person.residentPack == residentPack)
         {
             list2.Add(person);
         }
     }
     return list2;
 }
Ejemplo n.º 3
0
 private void ParseResponse(SidResponse sidResponses)
 {
     SidResponseType responseType = sidResponses.GetResponseType();
     if ((responseType != null) && !responseType.Volidation())
     {
         throw new System.ApplicationException("Некорректное поле 'Код запроса' в ответе.\nДолжно быть равно 50.\nПришло " + responseType.XmlType);
     }
     foreach (SidPerson person in sidResponses.GetPersons())
     {
         person.Volidation();
         SidPersonDocument[] documents = person.Documents;
         for (int i = 0; i < documents.Length; i = (int) (i + 1))
         {
             SidPersonDocument document = documents[i];
             document.Volidation();
             if (this.TypeDocFaset.ContainsKey(document.Type ?? FasetItem.Null.Name))
             {
                 document.TypeDocFasetId = this.TypeDocFaset[document.Type ?? FasetItem.Null.Name].Id;
             }
             else
             {
                 document.TypeDocFasetId = 0;
             }
         }
         SidPersonRegistration[] registrations = person.Registrations;
         for (int j = 0; j < registrations.Length; j = (int) (j + 1))
         {
             SidPersonRegistration registration = registrations[j];
             registration.Validation();
             if (this.StRodFaset.ContainsKey((string) (registration.FamilyRelation ?? "")))
             {
                 registration.Relative = this.StRodFaset[(registration.FamilyRelation ?? "").Replace("Другая степень родства", "Прочие")].Id;
             }
             else
             {
                 registration.Relative = this.StRodFaset["Прочие"].Id;
             }
             if ((registration.Type.Contains("Временно") && !this.TypeResidentsFaset.ContainsKey("Проживает")) && this.TypeResidentsFaset.ContainsKey("Временно зарегистрирован"))
             {
                 registration.TypeResidents = this.TypeResidentsFaset["Временно зарегистрирован"].Id;
             }
             else
             {
                 registration.TypeResidents = this.TypeResidentsFaset[registration.Type.Replace("Регистрация лица по месту жительства", "Прописан").Replace("Регистрация лица по месту пребывания", "Проживает").Replace("Временно", "Проживает").Replace("Постоянно", "Прописан")].Id;
             }
         }
         SidPersonBenefit[] benefits = person.Benefits;
         for (int k = 0; k < benefits.Length; k = (int) (k + 1))
         {
             SidPersonBenefit benefit = benefits[k];
             benefit.Validation();
             if (this.BenefitTypeDocFaset.ContainsKey(benefit.DocType ?? FasetItem.Null.Name))
             {
                 benefit.TypeDocFasetId = this.BenefitTypeDocFaset[benefit.DocType ?? FasetItem.Null.Name].Id;
             }
             else
             {
                 benefit.TypeDocFasetId = 0;
             }
         }
     }
     foreach (Person person2 in Person.FindByApartment(this.apartment))
     {
         ResidentPack pack = new ResidentPack {
             Person = person2,
             apartmentResidents = ApartmentResident.FindByApartmentIdAndPersonId(this.apartment.Id, person2.Id),
             personBenefits = PersonBenefit.FindByPersonId(person2.Id),
             personBenefitDocuments = new ObjectList<PersonBenefitDocument>(),
             personBenefitDocumentLink = new System.Collections.Generic.Dictionary<PersonBenefitDocument, PersonBenefit>()
         };
         foreach (PersonBenefit benefit2 in pack.personBenefits)
         {
             foreach (PersonBenefitDocument document2 in PersonBenefitDocument.FindByPersonBenefitId(benefit2.Id))
             {
                 pack.personBenefitDocuments.Add(document2);
                 pack.personBenefitDocumentLink.Add(document2, benefit2);
             }
         }
         this.residents.Add(pack);
     }
     foreach (SidPerson person3 in sidResponses.GetPersons())
     {
         foreach (ResidentPack pack2 in this.residents)
         {
             if ((EqualityPerson.FindByResidentPack(this.equalityPersons, pack2).get_Count() <= 0) || (EqualityPerson.FindBySidPerson(this.equalityPersons, person3).get_Count() <= 0))
             {
                 Person person4 = pack2.Person;
                 EqualityPerson person5 = null;
                 SidPersonDocument[] documentArray2 = person3.Documents;
                 for (int m = 0; m < documentArray2.Length; m = (int) (m + 1))
                 {
                     SidPersonDocument document3 = documentArray2[m];
                     if ((((((document3.Series != string.Empty) && (document3.Number != "")) && ((document3.Number != "0") && (document3.Org != string.Empty))) && (((person4.SerDoc != string.Empty) && (person4.NumDoc != "")) && ((person4.NumDoc != "0") && (person4.OrgDoc != string.Empty)))) && (document3.Series.Trim().ToUpper().Replace("Ё", "Е") == (person4.SerDoc ?? "").Trim().ToUpper().Replace("Ё", "Е"))) && (document3.Number.Trim().ToUpper().Replace("Ё", "Е") == (person4.NumDoc ?? "").Trim().ToUpper().Replace("Ё", "Е")))
                     {
                         if (person5 == null)
                         {
                             person5 = new EqualityPerson();
                         }
                         person5.matchColor = this.greenMatch;
                         person5.MatchType = "по документу, удостоверяющему личность";
                     }
                 }
                 if (person5 == null)
                 {
                     if ((((person4.LName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.LastName.Trim().ToUpper().Replace("Ё", "Е")) && ((person4.MName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.MiddleName.Trim().ToUpper().Replace("Ё", "Е"))) && ((person4.FName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.FirstName.Trim().ToUpper().Replace("Ё", "Е")))
                     {
                         if (person5 == null)
                         {
                             person5 = new EqualityPerson();
                         }
                         person5.matchColor = this.greenMatch;
                         person5.MatchType = "по ФИО и дате рождения";
                     }
                     else if ((((person4.LName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.LastName.Trim().ToUpper().Replace("Ё", "Е")) && ((person4.MName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.MiddleName.Trim().ToUpper().Replace("Ё", "Е"))) && ((((person4.FName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.FirstName.Trim().ToUpper().Replace("Ё", "Е")) && (person4.BirthDate.Date == person3.BirthDate.Date)) && (person4.BirthDate != System.DateTime.MinValue)))
                     {
                         if (person5 == null)
                         {
                             person5 = new EqualityPerson();
                         }
                         person5.matchColor = this.yellowMatch;
                         person5.MatchType = "по ФИО";
                     }
                     else if (((NameHash.MetaPhone((person4.LName ?? "").Trim().ToUpper().Replace("Ё", "Е")) == NameHash.MetaPhone(person3.LastName.Trim().ToUpper().Replace("Ё", "Е"))) && ((person4.MName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.MiddleName.Trim().ToUpper().Replace("Ё", "Е"))) && ((((person4.FName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.FirstName.Trim().ToUpper().Replace("Ё", "Е")) && (person4.BirthDate.Date == person3.BirthDate.Date)) && (person4.BirthDate != System.DateTime.MinValue)))
                     {
                         if (person5 == null)
                         {
                             person5 = new EqualityPerson();
                         }
                         person5.matchColor = this.yellowMatch;
                         person5.MatchType = "нечетким сравнением по фамилии, четким по ИО и дате рождения";
                     }
                     else if (((person4.MName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.MiddleName.Trim().ToUpper().Replace("Ё", "Е")) && ((((person4.FName ?? "").Trim().ToUpper().Replace("Ё", "Е") == person3.FirstName.Trim().ToUpper().Replace("Ё", "Е")) && (person4.BirthDate.Date == person3.BirthDate.Date)) && (person4.BirthDate != System.DateTime.MinValue)))
                     {
                         if (person5 == null)
                         {
                             person5 = new EqualityPerson();
                         }
                         person5.matchColor = this.redMatch;
                         person5.MatchType = "по имени, отчеству и дате рождения";
                     }
                 }
                 if (person5 != null)
                 {
                     person5.sidPerson = person3;
                     person3.matchColor = person5.matchColor;
                     person3.equalityed = (int) (person3.equalityed + 1);
                     pack2.matchColor = person5.matchColor;
                     pack2.equalityed = (int) (pack2.equalityed + 1);
                     person5.residentPack = pack2;
                     person5.LName = person3.LastName.Trim().ToUpper();
                     person5.MName = person3.MiddleName.Trim().ToUpper();
                     person5.FName = person3.FirstName.Trim().ToUpper();
                     person5.BirthDate = person3.BirthDate;
                     person5.IsAllowedPersonDataUsage = person3.IsAllowedPersonDataUsage;
                     this.equalityPersons.Add(person5);
                 }
             }
         }
     }
     foreach (EqualityPerson person6 in this.equalityPersons)
     {
         bool flag = true;
         while (flag)
         {
             flag = false;
             SidPersonRegistration[] registrationArray2 = person6.sidPerson.Registrations;
             for (int n = 0; n < registrationArray2.Length; n = (int) (n + 1))
             {
                 SidPersonRegistration registration2 = registrationArray2[n];
                 bool flag2 = false;
                 if (registration2.FromDate != registration2.ToDate)
                 {
                     foreach (ApartmentResident resident in person6.residentPack.apartmentResidents)
                     {
                         if ((registration2.ToDate == System.DateTime.MinValue) && (resident.ToDate == System.DateTime.MinValue))
                         {
                             flag2 = true;
                             break;
                         }
                         if (((registration2.ToDate >= resident.FromDate) && (registration2.ToDate != System.DateTime.MinValue)) && (resident.ToDate == System.DateTime.MinValue))
                         {
                             resident.ToDate = registration2.ToDate;
                             AIS.SN.UI.Messages.ShowMessage(string.Concat((string[]) new string[] { "У человека '", person6.residentPack.Person.LName, " ", person6.residentPack.Person.FName, " ", person6.residentPack.Person.MName, "'\nавтоматически закрыта регистрация с ", registration2.FromDate.ToShortDateString(), ((registration2.ToDate == System.DateTime.MinValue) ? "" : ((string) (" по " + registration2.ToDate.ToShortDateString()))) }));
                             flag2 = true;
                             flag = true;
                             break;
                         }
                         if ((!(registration2.ToDate == System.DateTime.MinValue) && !(resident.ToDate == System.DateTime.MinValue)) && ((registration2.ToDate >= resident.FromDate) && (resident.ToDate >= registration2.FromDate)))
                         {
                             System.DateTime time = (registration2.FromDate < resident.FromDate) ? registration2.FromDate : resident.FromDate;
                             System.DateTime time2 = (registration2.FromDate < resident.FromDate) ? resident.FromDate : registration2.FromDate;
                             System.DateTime time3 = (registration2.ToDate < resident.ToDate) ? registration2.ToDate : resident.ToDate;
                             System.DateTime time4 = (registration2.ToDate < resident.ToDate) ? resident.ToDate : registration2.ToDate;
                             long num = System.Math.Abs(((System.TimeSpan) (time3 - time2)).get_Ticks());
                             long num2 = System.Math.Abs(((System.TimeSpan) (time4 - time)).get_Ticks());
                             if (((((double) num) / ((double) num2)) >= 0.5) && ((((double) num) / ((double) num2)) > 0.5))
                             {
                                 flag2 = true;
                                 break;
                             }
                         }
                     }
                     if (!flag2)
                     {
                         ApartmentResident resident2 = new ApartmentResident {
                             PersonId = person6.residentPack.Person.Id,
                             ToDate = registration2.ToDate,
                             FromDate = registration2.FromDate,
                             Relative = registration2.Relative,
                             TypeResidents = registration2.TypeResidents
                         };
                         person6.residentPack.apartmentResidents.Add(resident2);
                         AIS.SN.UI.Messages.ShowMessage(string.Concat((string[]) new string[] { "У человека '", person6.residentPack.Person.LName, " ", person6.residentPack.Person.FName, " ", person6.residentPack.Person.MName, "'\nавтоматически добавлена новая регистрация с ", registration2.FromDate.ToShortDateString(), ((registration2.ToDate == System.DateTime.MinValue) ? "" : ((string) (" по " + registration2.ToDate.ToShortDateString()))) }));
                         flag = true;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public static System.Collections.Generic.List<ResidentPack> FindByApartment(Apartment apartment)
 {
     System.Collections.Generic.List<ResidentPack> list = new System.Collections.Generic.List<ResidentPack>();
     foreach (AIS.SN.Model.DomainObjects.Person person in AIS.SN.Model.DomainObjects.Person.FindByApartment(apartment))
     {
         ResidentPack pack = new ResidentPack {
             Person = person,
             apartmentResidents = ApartmentResident.FindByPersonId(person.Id),
             apartmentResidentsDelete = new ObjectList<ApartmentResident>(),
             personBenefits = PersonBenefit.FindByPersonId(person.Id),
             personBenefitDocuments = PersonBenefitDocument.FindByApartmentIdPersonId(apartment.Id, person.Id),
             personBenefitDocumentLink = new System.Collections.Generic.Dictionary<PersonBenefitDocument, PersonBenefit>()
         };
         foreach (PersonBenefit benefit in pack.personBenefits)
         {
             foreach (PersonBenefitDocument document in pack.personBenefitDocuments)
             {
                 if (document.PersonBenefitId == benefit.Id)
                 {
                     pack.personBenefitDocumentLink.Add(document, benefit);
                 }
             }
         }
     }
     return list;
 }
Ejemplo n.º 5
0
 private void NewEqualityPersonFromSpun(SidPerson sidPerson)
 {
     if (sidPerson.equalityed <= 0)
     {
         ResidentPack pack;
         sidPerson.matchColor = this.greenMatch;
         sidPerson.equalityed = (int) (sidPerson.equalityed + 1);
         pack = new ResidentPack {
             matchColor = this.greenMatch,
             equalityed = (int) (pack.equalityed + 1),
             Person = new Person()
         };
         pack.Person.LName = sidPerson.LastName;
         pack.Person.FName = sidPerson.FirstName;
         pack.Person.MName = sidPerson.MiddleName;
         pack.Person.BirthDate = sidPerson.BirthDate;
         pack.Person.AllowPersonalDataUsage = sidPerson.IsAllowedPersonDataUsage;
         if (sidPerson.Documents.Length > 0)
         {
             pack.Person.NumDoc = sidPerson.Documents[0].Number;
             pack.Person.OrgDoc = sidPerson.Documents[0].Org;
             pack.Person.SerDoc = sidPerson.Documents[0].Series;
             pack.Person.TypeDoc = sidPerson.Documents[0].TypeDocFasetId;
             pack.Person.TypeDocName = sidPerson.Documents[0].Type;
             pack.Person.DateDoc = sidPerson.Documents[0].Date;
         }
         pack.apartmentResidents = new ObjectList<ApartmentResident>();
         SidPersonRegistration[] registrations = sidPerson.Registrations;
         for (int i = 0; i < registrations.Length; i = (int) (i + 1))
         {
             SidPersonRegistration registration = registrations[i];
             ApartmentResident resident = new ApartmentResident {
                 ApartmentId = this.apartment.Id,
                 FromDate = registration.FromDate,
                 ToDate = registration.ToDate,
                 Relative = registration.Relative,
                 TypeResidents = registration.TypeResidents
             };
             pack.apartmentResidents.Add(resident);
         }
         pack.personBenefits = new ObjectList<PersonBenefit>();
         pack.personBenefitDocuments = new ObjectList<PersonBenefitDocument>();
         pack.personBenefitDocumentLink = new System.Collections.Generic.Dictionary<PersonBenefitDocument, PersonBenefit>();
         if (this.BenefitsAll == null)
         {
             this.BenefitsAll = Benefit.GetBenefits();
         }
         if (this.BenefitsAll.get_Count() > 0)
         {
             SidPersonBenefit[] benefits = sidPerson.Benefits;
             for (int j = 0; j < benefits.Length; j = (int) (j + 1))
             {
                 SidPersonBenefit benefit = benefits[j];
                 Benefit benefit2 = null;
                 foreach (Benefit benefit3 in this.BenefitsAll)
                 {
                     if (benefit3.Code.ToString() == benefit.BenefitCode)
                     {
                         benefit2 = benefit3;
                         break;
                     }
                 }
                 if (benefit2 != null)
                 {
                     PersonBenefit benefit4 = null;
                     foreach (PersonBenefit benefit5 in pack.personBenefits)
                     {
                         if (benefit5.BenefitId == benefit2.Id)
                         {
                             benefit4 = benefit5;
                             break;
                         }
                     }
                     if (benefit4 == null)
                     {
                         benefit4 = new PersonBenefit {
                             BenefitId = benefit2.Id
                         };
                         pack.personBenefits.Add(benefit4);
                     }
                     if (!string.IsNullOrEmpty(benefit.DocNumber))
                     {
                         PersonBenefitDocument document = new PersonBenefitDocument {
                             BenefitId = benefit4.BenefitId,
                             DateDoc = benefit.DocDate,
                             NumDoc = benefit.DocNumber,
                             SerDoc = benefit.DocSeries,
                             WhereDoc = benefit.DocOrg,
                             TypeDocFasetId = benefit.TypeDocFasetId,
                             TypeDocName = benefit.DocType,
                             NumNotif = benefit.NoticeNumber,
                             DateNotif = benefit.NoticeDate,
                             FromDate = benefit.FromDate,
                             ToDate = benefit.ToDate
                         };
                         pack.personBenefitDocuments.Add(document);
                         pack.personBenefitDocumentLink.Add(document, benefit4);
                     }
                 }
             }
         }
         this.residents.Add(pack);
         EqualityPerson person = new EqualityPerson {
             matchColor = this.greenMatch,
             MatchType = "вручную",
             sidPerson = sidPerson
         };
         sidPerson.matchColor = person.matchColor;
         sidPerson.equalityed = (int) (sidPerson.equalityed + 1);
         pack.matchColor = person.matchColor;
         pack.equalityed = (int) (pack.equalityed + 1);
         person.residentPack = pack;
         person.LName = sidPerson.LastName.Trim().ToUpper();
         person.MName = sidPerson.MiddleName.Trim().ToUpper();
         person.FName = sidPerson.FirstName.Trim().ToUpper();
         person.BirthDate = sidPerson.BirthDate;
         person.IsAllowedPersonDataUsage = sidPerson.IsAllowedPersonDataUsage;
         this.equalityPersons.Add(person);
     }
 }