예제 #1
0
        public void UpdateLicenceEdition(Guid licenceEditionDocBlobKey, int editionPartIndex, Lot lot)
        {
            PartVersion<PersonLicenceEditionDO> licenceEditionPartVersion = lot.Index.GetPart<PersonLicenceEditionDO>(string.Format("licenceEditions/{0}", editionPartIndex));

            using (var transaction = this.unitOfWork.BeginTransaction())
            {
                licenceEditionPartVersion.Content.PrintedDocumentBlobKey = licenceEditionDocBlobKey;

                GvaFile printedLicenceFile = new GvaFile()
                {
                    Filename = "migratedLicence",
                    FileContentId = licenceEditionDocBlobKey,
                    MimeType = "application/pdf"
                };

                this.unitOfWork.DbContext.Set<GvaFile>().Add(printedLicenceFile);

                this.unitOfWork.Save();

                licenceEditionPartVersion.Content.PrintedFileId = printedLicenceFile.GvaFileId;

                lot.UpdatePart<PersonLicenceEditionDO>(string.Format("licenceEditions/{0}", licenceEditionPartVersion.Part.Index), licenceEditionPartVersion.Content, this.userContext);

                lot.Commit(this.userContext, this.lotEventDispatcher);
                this.lotRepository.ExecSpSetLotPartTokens(licenceEditionPartVersion.PartId);

                this.unitOfWork.Save();

                transaction.Commit();
            }
        }
예제 #2
0
        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);
        }