private void ForwardPackage(ICommunicationPackage communicationPackage, Guid targetBranchId)
        {
            XmlTransferObject forwardedPkgData = new XmlTransferObject
            {
                DeferredTransactionId = communicationPackage.XmlData.DeferredTransactionId,
                Id = Guid.NewGuid(),
                LocalTransactionId = Guid.NewGuid(),
                XmlType            = "CommercialDocumentSnapshotEx",
                Content            = this.CurrentPackage.Xml.ToString(System.Xml.Linq.SaveOptions.DisableFormatting)
            };
            ICommunicationPackage pkg = new CommunicationPackage(forwardedPkgData);

            pkg.DatabaseId = Makolab.Fractus.Kernel.Mappers.DictionaryMapper.Instance.GetBranch(targetBranchId).DatabaseId;
            CommunicationPackageRepository pkgRepo = new CommunicationPackageRepository(this.UnitOfWork);

            pkgRepo.PutToOutgoingQueue(pkg);
        }
Example #2
0
        private void ExecuteIncomeShift()
        {
            CommunicationPackage statusPkg = GenerateShiftDocumentStatusPackage();

            string oppositeWarehouseFieldId = DictionaryMapper.Instance.GetDocumentField(Makolab.Fractus.Kernel.Enums.DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId).Id.Value.ToString().ToUpperInvariant();
            string oppositeWarehouseId      = this.CurrentPackage.Xml.Root.Element("documentAttrValue").Elements()
                                              .Where(row => row.Element("documentFieldId").Value.Equals(oppositeWarehouseFieldId))
                                              .Select(row => row.Element("textValue").Value)
                                              .SingleOrDefault();

            if (oppositeWarehouseId == null)
            {
                throw new InvalidDataException("Missing opposite warehouse id in document attributes");
            }

            Warehouse w = DictionaryMapper.Instance.GetWarehouse(new Guid(oppositeWarehouseId));

            statusPkg.DatabaseId = DictionaryMapper.Instance.GetBranch(w.BranchId).DatabaseId;
            CommunicationPackageRepository pkgRepo = new CommunicationPackageRepository(this.UnitOfWork);

            pkgRepo.PutToOutgoingQueue(statusPkg);
        }