/// <summary> /// The fill batch from zglv. /// </summary> /// <param name="batch"> /// The batch. /// </param> /// <param name="obj"> /// The obj. /// </param> /// <param name="session"> /// The session. /// </param> protected override void FillBatchFromZglv(Batch batch, Zags_VNov obj, ISession session) { batch.Number = 1; // short.Parse(obj.Zglv.Version); // по номеру отдела ищем загс в справочнике obj.Zglv.NumDep. и его родитель это тфомс // batch.Tfoms // batch.Sender = отделение загс // batch.Receiver = batch.Tfoms var indx = obj.Zglv.Period.IndexOf('-'); var startDate = DateTime.ParseExact(obj.Zglv.Period.Substring(0, indx), "dd.MM.yyyy", null); // DateTime endDate = DateTime.ParseExact(obj.Zglv.Period.Substring(indx + 1, obj.Zglv.Period.Length - indx - 1), "dd.MM.yyyy", null); var periodCode = GetPeriodCode(startDate); var codePeriod = ConceptCacheManager.GetById(periodCode); var period = ObjectFactory.GetInstance <IPeriodManager>() .GetBy(x => x.Year == startDate && x.Code == codePeriod) .FirstOrDefault() ?? new Period { Year = startDate, Code = codePeriod }; session.Save(period); batch.Period = period; batch.Subject = ConceptCacheManager.GetById(ExchangeSubjectType.Zags); }
/// <summary> /// The get pfr exchange. /// </summary> /// <param name="item"> /// The item. /// </param> /// <param name="batch"> /// The batch. /// </param> /// <returns> /// The <see cref="QueryResponse"/>. /// </returns> protected override QueryResponse GetQueryResponse(string item, Batch batch) { var result = new QueryResponse { Snils = SnilsChecker.SsToShort(item), Feature = ConceptCacheManager.GetById(PfrFeature.PfrFeature1), Message = batch.Messages.First(), Employment = true }; return(result); }
/// <summary> /// The get pfr exchange. /// </summary> /// <param name="item"> /// The item. /// </param> /// <param name="batch"> /// The batch. /// </param> /// <returns> /// The <see cref="QueryResponse"/>. /// </returns> protected override QueryResponse GetQueryResponse(Zl item, Batch batch) { var result = new QueryResponse { Message = batch.Messages.First(), Snils = SnilsChecker.SsToShort(item.Snils), Feature = GetFeature(item), InsuredPersonData = new InsuredPersonDatum { Snils = SnilsChecker.SsToShort(item.Snils), LastName = item.Fam, FirstName = item.Im, MiddleName = item.Ot, Birthday = string.IsNullOrEmpty(item.Dr) ? null : (DateTime?) DateTime.ParseExact(item.Dr, "dd.MM.yyyy", null), BirthdayType = int.Parse(item.Dostdr), Birthplace = item.AddressR, Gender = !string.IsNullOrEmpty(item.W) && item.W.ToLower() == "м" ? ConceptCacheManager.GetById(Sex.Sex1) : ConceptCacheManager.GetById(Sex.Sex2), }, Address = new address { Postcode = item.Index, Unstructured = item.AddressReg }, DocumentUdl = new Document(), Employment = item.IdZl == "1" }; if (item.Doc != null) { result.DocumentUdl.DateIssue = string.IsNullOrEmpty(item.Doc.DateDoc) ? null : (DateTime?)DateTime.ParseExact(item.Doc.DateDoc, "dd.MM.yyyy", null); if (result.DocumentUdl.DateIssue.HasValue && result.DocumentUdl.DateIssue.Value <= new DateTime(1753, 1, 1)) { result.DocumentUdl.DateIssue = null; } result.DocumentUdl.Number = item.Doc.NDoc; result.DocumentUdl.Series = item.Doc.SDoc; result.DocumentUdl.DocumentType = ConceptCacheManager.GetBy(x => x.ShortName == item.Doc.NameDoc && x.Oid.Id == Oid.ДокументУдл) .FirstOrDefault(); } return(result); }
/// <summary> /// The get feature. /// </summary> /// <param name="item"> /// The item. /// </param> /// <returns> /// The <see cref="Concept"/> . /// </returns> private Concept GetFeature(Zl item) { switch (item.Pi) { case "0": return(null); case "1": return(ConceptCacheManager.GetById(PfrFeature.PfrFeature1)); case "2": return(ConceptCacheManager.GetById(PfrFeature.PfrFeature2)); case "3": return(ConceptCacheManager.GetById(PfrFeature.PfrFeature3)); } return(null); }
/// <summary> /// The get query response. /// </summary> /// <param name="item"> /// The item. /// </param> /// <param name="batch"> /// The batch. /// </param> /// <returns> /// The <see cref="QueryResponse"/>. /// </returns> protected override QueryResponse GetQueryResponse(DeathInfo item, Batch batch) { var result = new QueryResponse { InsuredPersonData = new InsuredPersonDatum { FirstName = item.Fio.Im, LastName = item.Fio.Fam, MiddleName = item.Fio.Ot, Gender = !string.IsNullOrEmpty(item.W) && item.W.ToLower() == "м" ? ConceptCacheManager.GetById(Sex.Sex1) : ConceptCacheManager.GetById(Sex.Sex2), Birthday = string.IsNullOrEmpty(item.Dr) ? null : (DateTime?) DateTime.ParseExact(item.Dr, "dd.MM.yyyy", null), Birthplace = GetBirthPlace(item.Mr) }, DeadInfo = new DeadInfo { DateDead = string.IsNullOrEmpty(item.DateDeath) ? new DateTime(2200, 1, 1) : DateTime.ParseExact(item.DateDeath, "dd.MM.yyyy", null), ActRecordNumber = item.NumRecord, ActRecordDate = string.IsNullOrEmpty(item.DateRecord) ? null : (DateTime?) DateTime.ParseExact(item.DateRecord, "dd.MM.yyyy", null) }, Address = new address { Unstructured = GetLastLiveAddress(item.LastAddressF) }, DocumentUdl = new Document(), Message = batch.Messages.First() }; ////var foundOrg = organizationManager.GetBy(z => z.FullName == item.OrgZags.Name_Org).FirstOrDefault(); ////if (foundOrg != null) ////{ //// result.Organisation = new Organisation(); //// result.Organisation.Id = foundOrg.Id; ////} if (item.Doc != null) { result.DocumentUdl.DateIssue = string.IsNullOrEmpty(item.Doc.DateDoc) ? null : (DateTime?)DateTime.ParseExact(item.Doc.DateDoc, "dd.MM.yyyy", null); if (result.DocumentUdl.DateIssue.HasValue && result.DocumentUdl.DateIssue.Value <= new DateTime(1753, 1, 1)) { result.DocumentUdl.DateIssue = null; } result.DocumentUdl.Number = item.Doc.NumDoc; result.DocumentUdl.IssuingAuthority = item.Doc.IssuedBy; result.DocumentUdl.Series = item.Doc.SerDoc; result.DocumentUdl.DocumentType = ConceptCacheManager.GetBy(x => x.ShortName == item.Doc.TypeDoc && x.Oid.Id == Oid.ДокументУдл) .FirstOrDefault(); } return(result); }