コード例 #1
0
 public ApartmentPersonBenefitForm(ApartmentResident apartmentResident, PersonBenefitDocument personBenefitDocument)
     : this()
 {
     this.apr = apartmentResident;
     this.pbd = personBenefitDocument;
     this.btnSave.set_Text("Изменить");
 }
コード例 #2
0
 public ApartmentPersonBenefitForm(ApartmentResident apartmentResident)
     : this()
 {
     this.apr = apartmentResident;
     this.pbd = new PersonBenefitDocument();
     this.pbd.Id = -1L;
     this.pbd.PersonId = apartmentResident.PersonId;
     this.pbd.PersonName = apartmentResident.PersonName;
     this.personBenefitDocumentIsNew = true;
     this.btnSave.set_Text("Добавить");
 }
コード例 #3
0
ファイル: PersonBenefitPack.cs プロジェクト: u4097/SQLScript
 public PersonBenefitPack(PersonBenefitDocument personBenefitDocument, PersonBenefit personBenefit)
 {
     this.m_personBenefit = personBenefit;
     this.m_personBenefitDocument = personBenefitDocument;
 }
コード例 #4
0
 private void btnSaveAll_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.List<EqualityPerson> originalPersons = EqualityPerson.GetOriginalPersons(this.equalityPersons);
     foreach (EqualityPerson person in originalPersons)
     {
         if (string.IsNullOrEmpty(person.residentPack.Person.LName))
         {
             AIS.SN.UI.Messages.ShowWarning("Проставьте фамилии у каждого человека.");
             base.set_DialogResult(System.Windows.Forms.DialogResult.None);
             return;
         }
         if (person.residentPack.apartmentResidents.get_Count() == 0)
         {
             AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nотсутствуют периоды регистрации." }));
             base.set_DialogResult(System.Windows.Forms.DialogResult.None);
             return;
         }
         foreach (ApartmentResident resident in person.residentPack.apartmentResidents)
         {
             if ((resident.FromDate == System.DateTime.MinValue) || resident.FromDate.Equals(new System.DateTime(0x76c, 1, 1)))
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nнекорректная дата начала регистрации." }));
                 base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                 return;
             }
             if (resident.ToDate.Equals(new System.DateTime(0x76c, 1, 1)))
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nнекорректная дата окончания регистрации." }));
                 base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                 return;
             }
             if ((resident.ToDate != System.DateTime.MinValue) && (resident.FromDate >= resident.ToDate))
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nдата начала регистрации позже ее окончания." }));
                 base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                 return;
             }
             if (resident.Relative == 0)
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nне указана степень родства в регистрации." }));
                 base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                 return;
             }
             if (resident.TypeResidents == 0)
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nне указан тип проживания." }));
                 base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                 return;
             }
         }
         foreach (ApartmentResident resident2 in person.residentPack.apartmentResidents)
         {
             foreach (ApartmentResident resident3 in person.residentPack.apartmentResidents)
             {
                 if (resident3 != resident2)
                 {
                     if ((resident2.ToDate == System.DateTime.MinValue) && (resident3.ToDate == System.DateTime.MinValue))
                     {
                         AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nнесколько не закрытых периодов регистрации." }));
                         base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                         return;
                     }
                     if (((resident2.ToDate == System.DateTime.MinValue) || (resident2.ToDate > resident3.FromDate)) && ((resident3.ToDate == System.DateTime.MinValue) || (resident3.ToDate > resident2.FromDate)))
                     {
                         AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person.residentPack.Person.LName, " ", person.residentPack.Person.FName, " ", person.residentPack.Person.MName, "'\nсуществуют пересекающиеся периоды регистрации." }));
                         base.set_DialogResult(System.Windows.Forms.DialogResult.None);
                         return;
                     }
                 }
             }
         }
     }
     if (this.BenefitsAll == null)
     {
         this.BenefitsAll = Benefit.GetBenefits();
     }
     bool flag = false;
     foreach (EqualityPerson person2 in originalPersons)
     {
         if (person2.sidPerson.Documents.Length > 0)
         {
             if (person2.sidPerson.Documents[0].TypeDocFasetId == 0)
             {
                 AIS.SN.UI.Messages.ShowError(string.Concat((string[]) new string[] { "У человека '", person2.residentPack.Person.LName, " ", person2.residentPack.Person.FName, " ", person2.residentPack.Person.MName, "'\nВ системе начислений в справочнике документов, удостоверяющих личность\nне найдено значение '", (person2.sidPerson.Documents[0].Type ?? FasetItem.Null.Name), "'" }));
             }
             else if (person2.sidPerson.Documents.Length > 0)
             {
                 person2.residentPack.Person.NumDoc = person2.sidPerson.Documents[0].Number;
                 person2.residentPack.Person.DateDoc = person2.sidPerson.Documents[0].Date;
                 person2.residentPack.Person.OrgDoc = person2.sidPerson.Documents[0].Org;
                 person2.residentPack.Person.SerDoc = person2.sidPerson.Documents[0].Series;
                 person2.residentPack.Person.TypeDoc = person2.sidPerson.Documents[0].TypeDocFasetId;
             }
         }
         person2.residentPack.Person.LName = person2.LName;
         person2.residentPack.Person.MName = person2.MName;
         person2.residentPack.Person.FName = person2.FName;
         person2.residentPack.Person.BirthDate = person2.BirthDate;
         if (this.IsGetDataPassporter)
         {
             person2.residentPack.Person.AllowPersonalDataUsage = person2.IsAllowedPersonDataUsage;
         }
         person2.residentPack.Person.SaveChanges();
         foreach (ApartmentResident resident4 in person2.residentPack.apartmentResidents)
         {
             resident4.PersonId = person2.residentPack.Person.Id;
             resident4.ApartmentId = this.apartment.Id;
             resident4.SaveChanges();
         }
         if (person2.residentPack.apartmentResidentsDelete != null)
         {
             foreach (ApartmentResident resident5 in person2.residentPack.apartmentResidentsDelete)
             {
                 resident5.PersonId = person2.residentPack.Person.Id;
                 resident5.SaveChanges();
             }
         }
         if (this.BenefitsAll.get_Count() > 0)
         {
             SidPersonBenefit[] benefits = person2.sidPerson.Benefits;
             for (int i = 0; i < benefits.Length; i = (int) (i + 1))
             {
                 SidPersonBenefit benefit = benefits[i];
                 if (benefit.TypeDocFasetId == 0)
                 {
                     AIS.SN.UI.Messages.ShowError(string.Concat((string[]) new string[] { "У человека '", person2.residentPack.Person.LName, " ", person2.residentPack.Person.FName, " ", person2.residentPack.Person.MName, "'\nВ системе начислений в справочнике удостоверений на льготу\nне найдено значение '", (benefit.DocType ?? FasetItem.Null.Name), "'" }));
                 }
                 bool flag2 = false;
                 foreach (System.Collections.Generic.KeyValuePair<PersonBenefitDocument, PersonBenefit> pair in person2.residentPack.personBenefitDocumentLink)
                 {
                     if ((benefit.DocSeries.Trim().ToUpper() == (pair.Key.SerDoc ?? "").Trim().ToUpper()) && (((benefit.DocNumber.Trim().ToUpper() == (pair.Key.NumDoc ?? "").Trim().ToUpper()) && (benefit.TypeDocFasetId == pair.Key.TypeDocFasetId)) && (benefit.BenefitCode == pair.Value.Benefit.Code.ToString())))
                     {
                         pair.Key.DateDoc = benefit.DocDate;
                         pair.Key.NumDoc = (string) (benefit.DocNumber ?? "");
                         pair.Key.SerDoc = (string) (benefit.DocSeries ?? "");
                         pair.Key.WhereDoc = benefit.DocOrg;
                         pair.Key.TypeDocFasetId = benefit.TypeDocFasetId;
                         pair.Key.TypeDocName = benefit.DocType;
                         pair.Key.NumNotif = benefit.NoticeNumber;
                         pair.Key.DateNotif = benefit.NoticeDate;
                         pair.Key.FromDate = (benefit.FromDate != System.DateTime.MinValue) ? benefit.FromDate : System.DateTime.Parse("01.01.1990");
                         pair.Key.ToDate = benefit.ToDate;
                         flag2 = true;
                         break;
                     }
                 }
                 if (!flag2)
                 {
                     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 person2.residentPack.personBenefits)
                         {
                             if (benefit5.BenefitId == benefit2.Id)
                             {
                                 benefit4 = benefit5;
                                 break;
                             }
                         }
                         if (benefit4 == null)
                         {
                             benefit4 = new PersonBenefit {
                                 BenefitId = benefit2.Id
                             };
                             person2.residentPack.personBenefits.Add(benefit4);
                         }
                         PersonBenefitDocument document = new PersonBenefitDocument {
                             BenefitId = benefit4.BenefitId,
                             DateDoc = benefit.DocDate,
                             NumDoc = (string) (benefit.DocNumber ?? ""),
                             SerDoc = (string) (benefit.DocSeries ?? ""),
                             WhereDoc = benefit.DocOrg,
                             TypeDocFasetId = benefit.TypeDocFasetId,
                             TypeDocName = benefit.DocType,
                             NumNotif = benefit.NoticeNumber,
                             DateNotif = benefit.NoticeDate,
                             FromDate = (benefit.FromDate != System.DateTime.MinValue) ? benefit.FromDate : System.DateTime.Parse("01.01.1990"),
                             ToDate = benefit.ToDate
                         };
                         person2.residentPack.personBenefitDocuments.Add(document);
                         person2.residentPack.personBenefitDocumentLink.Add(document, benefit4);
                     }
                 }
             }
         }
         foreach (PersonBenefit benefit6 in person2.residentPack.personBenefits)
         {
             flag = true;
             benefit6.PersonId = person2.residentPack.Person.Id;
             benefit6.SaveChanges();
             foreach (System.Collections.Generic.KeyValuePair<PersonBenefitDocument, PersonBenefit> pair2 in person2.residentPack.personBenefitDocumentLink)
             {
                 if (pair2.Value == benefit6)
                 {
                     pair2.Key.PersonBenefitId = benefit6.Id;
                     pair2.Key.SaveChanges();
                 }
             }
         }
     }
     if (flag)
     {
         AIS.SN.UI.Messages.ShowWarning("Не забудьте установить льготы!");
     }
     foreach (EqualityPerson person3 in originalPersons)
     {
         ApartmentResident resident6 = null;
         foreach (ApartmentResident resident7 in person3.residentPack.apartmentResidents)
         {
             if (resident7.ToDate == System.DateTime.MinValue)
             {
                 resident6 = resident7;
                 break;
             }
             if ((resident6 == null) || (resident7.ToDate > resident6.ToDate))
             {
                 resident6 = resident7;
             }
         }
         if ((resident6 != null) && (resident6.ToDate != System.DateTime.MinValue))
         {
             bool flag3 = false;
             foreach (ApartmentResidentBenefit benefit7 in ApartmentResidentBenefit.FindOnPersonBenefitByPersonId(resident6.PersonId))
             {
                 if ((benefit7.ToDate == System.DateTime.MinValue) || (benefit7.ToDate > resident6.ToDate))
                 {
                     if (benefit7.FromDate > resident6.ToDate)
                     {
                         benefit7.IsDeleted = true;
                     }
                     else
                     {
                         benefit7.ToDate = resident6.ToDate;
                     }
                     benefit7.SaveChanges();
                     flag3 = true;
                 }
             }
             bool flag4 = false;
             foreach (ApartmentResidentVacation vacation in ApartmentResidentVacation.FindByApartmentIdResidentId(0L, resident6.Id))
             {
                 if ((vacation.ToDate == System.DateTime.MinValue) || (vacation.ToDate > resident6.ToDate))
                 {
                     if (vacation.FromDate > resident6.ToDate)
                     {
                         vacation.IsDeleted = true;
                     }
                     else
                     {
                         vacation.ToDate = resident6.ToDate;
                     }
                     vacation.SaveChanges();
                     flag4 = true;
                 }
             }
             if (flag4)
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person3.residentPack.Person.LName, " ", person3.residentPack.Person.FName, " ", person3.residentPack.Person.MName, "'\nзакрыто временное отсутствие, в связи с выпиской." }));
             }
             if (flag3)
             {
                 AIS.SN.UI.Messages.ShowWarning(string.Concat((string[]) new string[] { "У человека '", person3.residentPack.Person.LName, " ", person3.residentPack.Person.FName, " ", person3.residentPack.Person.MName, "'\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);
     }
 }