Exemple #1
0
        public DocCaseDO(DocFile docFile, GvaCaseType caseType)
            : this()
        {
            if (docFile != null)
            {
                this.DocFileId = docFile.DocFileId;
                this.Name = docFile.Name;

                this.File = new BlobDO()
                {
                    Key = docFile.DocFileContentId,
                    Name = docFile.DocFileName,
                    RelativePath = "", //?
                };

                this.DocFileKind = new NomValue()
                {
                    NomValueId = docFile.DocFileKindId,
                    Name = docFile.DocFileKind.Name,
                    Alias = docFile.DocFileKind.Alias
                };
            }

            this.CaseType = new NomValue()
            {
                NomValueId = caseType.GvaCaseTypeId,
                Name = caseType.Name,
                Alias = caseType.Alias
            };
        }
        public IntegrationDocRelationDO(DocRelation d, GvaCaseType caseType)
        {
            this.DocId = d.DocId;

            if (d.Doc != null)
            {
                this.DocRegUri = d.Doc.RegUri;
                this.DocDocTypeName = d.Doc.DocType != null ? d.Doc.DocType.Name : string.Empty;
            }

            this.CaseTypeId = caseType.GvaCaseTypeId;
            this.Set = caseType.LotSet.Alias;
        }
        public PersonDataDO ConvertAppWithFlightCrewDataToPersonData(FlightCrewPersonalData FlightCrewlData, GvaCaseType caseType)
        {
            PersonDataDO personData = new PersonDataDO();

            if (!string.IsNullOrEmpty(FlightCrewlData.CAAPersonalIdentificationNumber))
            {
                int lin = 0;
                if (int.TryParse(FlightCrewlData.CAAPersonalIdentificationNumber, out lin))
                {
                    personData.Lin = lin;
                    personData.LinTypeId = this.nomRepository.GetNomValues("linTypes").Where(l => l.Code == "none").Single().NomValueId;
                }
            }

            string countryName = FlightCrewlData.Citizenship.CountryName;
            string countryCode = FlightCrewlData.Citizenship.CountryGRAOCode;
            if (!string.IsNullOrEmpty(countryName))
            {
                NomValue country = this.nomRepository.GetNomValues("countries").Where(c => c.Name == countryName).FirstOrDefault();
                personData.CountryId = country != null ? country.NomValueId : (int?)null;
            }

            if (countryCode == "BG")
            {
                personData.CountryId = this.nomRepository.GetNomValue("countries", "BG").NomValueId;
                personData.FirstName = FlightCrewlData.BulgarianCitizen.PersonNames.First;
                personData.MiddleName = FlightCrewlData.BulgarianCitizen.PersonNames.Middle;
                personData.LastName = FlightCrewlData.BulgarianCitizen.PersonNames.Last;
                personData.DateOfBirth = FlightCrewlData.BulgarianCitizen.BirthDate;
            }
            else
            {
                personData.FirstName = FlightCrewlData.ForeignCitizen.ForeignCitizenNames.FirstCyrillic;
                personData.LastName = FlightCrewlData.ForeignCitizen.ForeignCitizenNames.LastCyrillic;
                personData.DateOfBirth = FlightCrewlData.ForeignCitizen.BirthDate;
            }

            personData.FirstNameAlt = FlightCrewlData.PersonNamesLatin.PersonFirstNameLatin;
            personData.MiddleNameAlt = FlightCrewlData.PersonNamesLatin.PersonMiddleNameLatin;
            personData.LastNameAlt = FlightCrewlData.PersonNamesLatin.PersonLastNameLatin;

            personData.Email = FlightCrewlData.ContactData.EmailAddress;

            personData.CaseTypes = new List<int>() { caseType.GvaCaseTypeId };

            return personData;
        }
        public void UpdateLotCaseTypes(string set, GvaCaseType caseType, Lot lot, UserContext userContext)
        {
            Part updatedPart = null;
            if (set == "Person")
            {
                PersonDataDO personData = lot.Index.GetPart<PersonDataDO>("personData").Content;
                personData.CaseTypes.Add(caseType.GvaCaseTypeId);
                this.caseTypeRepository.AddCaseTypes(lot, personData.CaseTypes);
                updatedPart = lot.UpdatePart("personData", personData, userContext).Part;
            }
            else if (set == "Organization")
            {
                NomValue caseTypeNom = new NomValue()
                {
                    NomValueId = caseType.GvaCaseTypeId,
                    Name = caseType.Name,
                    Alias = caseType.Alias
                };

                OrganizationDataDO organizationData = lot.Index.GetPart<OrganizationDataDO>("organizationData").Content;
                organizationData.CaseTypes.Add(caseTypeNom);
                this.caseTypeRepository.AddCaseTypes(lot, organizationData.CaseTypes.Select(ct => ct.NomValueId));
                updatedPart = lot.UpdatePart("organizationData", organizationData, userContext).Part;
            }

            lot.Commit(userContext, this.lotEventDispatcher);

            this.unitOfWork.Save();

            this.lotRepository.ExecSpSetLotPartTokens(updatedPart.PartId);
        }
        public PersonDataDO ConvertAppWithPersonAndForeignCitizenBasicDataToPersonData(
            string caaPersonIdentificator,
            string email,
            PersonBasicData personBasicData,
            ForeignCitizenBasicData foreignCitizenBasicData,
            GvaCaseType caseType)
        {
            PersonDataDO personData = new PersonDataDO();

            if (!string.IsNullOrEmpty(caaPersonIdentificator))
            {
                int lin = -1;
                if (int.TryParse(caaPersonIdentificator, out lin))
                {
                    personData.Lin = lin;
                    personData.LinTypeId = this.nomRepository.GetNomValues("linTypes").Where(l => l.Code == "none").Single().NomValueId;
                }
            }

            if (personBasicData != null)
            {
                personData.CountryId = this.nomRepository.GetNomValue("countries", "BG").NomValueId;
                personData.FirstName = personBasicData.Names.First;
                personData.MiddleName = personBasicData.Names.Middle;
                personData.LastName = personBasicData.Names.Last;
                personData.FirstNameAlt = personBasicData.Names.First;
                personData.MiddleNameAlt = personBasicData.Names.Middle;
                personData.LastNameAlt = personBasicData.Names.Last;
                personData.Uin = personBasicData.Identifier.EGN;
            }
            else if (foreignCitizenBasicData != null)
            {
                personData.FirstName = foreignCitizenBasicData.Names.FirstCyrillic;
                personData.LastName = foreignCitizenBasicData.Names.LastCyrillic;
                personData.DateOfBirth = foreignCitizenBasicData.BirthDate;
                personData.FirstNameAlt = foreignCitizenBasicData.Names.FirstLatin;
                personData.LastNameAlt = foreignCitizenBasicData.Names.LastLatin;
                if (!string.IsNullOrEmpty(foreignCitizenBasicData.IdentityDocument.CountryCode))
                {
                    var country = this.nomRepository.GetNomValues("countries").Where(c => c.Code == foreignCitizenBasicData.IdentityDocument.CountryCode).FirstOrDefault();
                    personData.CountryId = country != null ? country.NomValueId : (int?)null;
                }
            }

            personData.Email = email;

            personData.CaseTypes = new List<int>() { caseType.GvaCaseTypeId };

            return personData;
        }