Пример #1
0
        public IEnumerable <Contractor> GetContractors()
        {
            var entities = _contractorRepo.GetAll();
            var mapper   = new ContractorMapper();

            return(mapper.Map(entities.ToList()));
        }
Пример #2
0
        public void AddContractor(Contractor contractor)
        {
            var mapper = new ContractorMapper();
            var entity = mapper.Map(contractor);

            _contractorRepo.Add(entity);
            _contractorRepo.Save();
        }
Пример #3
0
        public override void OnValidateTransaction(IBusinessObject businessObject)
        {
            ContractorMapper mapper = DependencyContainerManager.Container.Get <ContractorMapper>();
            bool             b      = mapper.CheckContractorCodeExistence(businessObject.FullXml);

            if (b)
            {
                throw new ClientException(ClientExceptionId.ContractorCodeAlreadyExists);
            }
        }
Пример #4
0
        private void CreateOrUpdateNegativePayment(FinancialDocument document)
        {
            Guid?payerId = document.DocumentType.FinancialDocumentOptions.PayerId;

            if (payerId == null)
            {
                return;
            }

            Payment negativePayment = document.Payments.Where(p => p.Amount < 0).FirstOrDefault();

            if (negativePayment == null)
            {
                negativePayment = document.Payments.CreateNew(BusinessObjectStatus.New);
                ContractorMapper contractorMapper = DependencyContainerManager.Container.Get <ContractorMapper>();
                Contractor       payer            = (Contractor)contractorMapper.LoadBusinessObject(BusinessObjectType.Contractor, payerId.Value);
                negativePayment.Contractor = payer;
                var addr = payer.Addresses.GetDefaultAddress();

                if (addr != null)
                {
                    negativePayment.ContractorAddressId = addr.Id.Value;
                }

                negativePayment.Direction         = document.Payments[0].Direction;
                negativePayment.PaymentCurrencyId = document.DocumentCurrencyId;
                negativePayment.SystemCurrencyId  = document.SystemCurrencyId;
                negativePayment.ExchangeDate      = document.ExchangeDate;
                negativePayment.ExchangeRate      = document.ExchangeRate;
                negativePayment.ExchangeScale     = document.ExchangeScale;
                negativePayment.Date    = document.IssueDate;
                negativePayment.DueDate = document.IssueDate;
            }

            if (!ConfigurationMapper.Instance.OnePositionFinancialDocuments)
            {
                negativePayment.Description = this.MergeDescriptions(document);
            }
            else
            {
                negativePayment.Description = document.Payments[0].Description;
            }

            string beginning = "Za dokument: ";

            if (negativePayment.Description.StartsWith(beginning))
            {
                negativePayment.Description = negativePayment.Description.Substring(beginning.Length);
            }

            negativePayment.Amount = -document.Payments.Where(pp => pp.Amount > 0).Sum(a => a.Amount);
        }
Пример #5
0
        public void DeleteContractor(Contractor contractor)
        {
            var mapper         = new ContractorMapper();
            var entity         = mapper.Map(contractor);
            var entityToDelete = _contractorRepo.Get(entity.ContractorId);

            _contractorRepo.Delete(entityToDelete);
            var labourEntity = _labourRepo.Find(x => x.ContractorId == entityToDelete.ContractorId);

            labourEntity.ToList().ForEach(x => x.ContractorId = null);
            _labourRepo.Save();
            _contractorRepo.Save();
        }
        /// <summary>
        /// Method executed when parent <see cref="Coordinator"/> enters the <c>ValidateTransaction</c> phase.
        /// </summary>
        /// <param name="businessObject">Optional parameter.</param>
        public override void OnValidateTransaction(IBusinessObject businessObject)
        {
            var presentGroupsId = from node in ((Configuration)this.businessObject.AlternateVersion).Value.Descendants()
                                  where node.Name.LocalName == "group" && node.Attribute("id") != null && node.Attribute("id").Value.Length != 0
                                  select node.Attribute("id").Value;

            var modifiedGroupsId = from node in this.businessObject.Value.Descendants()
                                   where node.Name.LocalName == "group" && node.Attribute("id") != null && node.Attribute("id").Value.Length != 0
                                   select node.Attribute("id").Value;

            var deletedGroupsId = from grpId in presentGroupsId
                                  where modifiedGroupsId.Contains(grpId) == false
                                  select grpId;

            Configuration conf = (Configuration)businessObject;

            if (conf.Key == "contractors.group")
            {
                ContractorMapper mapper = DependencyContainerManager.Container.Get <ContractorMapper>();

                //check if any group that contains attached contractors has been deleted
                foreach (string group in deletedGroupsId)
                {
                    int count = mapper.GetContractorGroupMembershipsCount(new Guid(group));

                    if (count > 0)
                    {
                        throw new ClientException(ClientExceptionId.ContractorsGroupDeleteException, null, "count:" + count.ToString(CultureInfo.InvariantCulture));
                    }
                }
            }
            else if (conf.Key == "items.group")
            {
                ItemMapper mapper = DependencyContainerManager.Container.Get <ItemMapper>();

                //check if any group that contains attached contractors has been deleted
                foreach (string group in deletedGroupsId)
                {
                    int count = mapper.GetItemGroupMembershipsCount(new Guid(group));

                    if (count > 0)
                    {
                        throw new ClientException(ClientExceptionId.ItemsGroupDeleteException, null, "count:" + count.ToString(CultureInfo.InvariantCulture));
                    }
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Loads the <see cref="BusinessObject"/> with a specified Id. It appends modification user name.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to load.</param>
        /// <param name="id">The id of the <see cref="IBusinessObject"/> to load.</param>
        /// <returns>Loaded <see cref="BusinessObject"/></returns>
        internal override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            Item             result           = (Item)this.MapperTyped.LoadBusinessObject(BusinessObjectType.Item, id);
            ContractorMapper contractorMapper = new ContractorMapper();

            if (result.ModificationUserId.HasValue)
            {
                Contractor modificationUser = contractorMapper.LoadBusinessObject(result.ModificationUserId.Value);
                result.ModificationUser = modificationUser.FullName;
            }

            if (result.CreationUserId.HasValue)
            {
                Contractor creationUser = contractorMapper.LoadBusinessObject(result.CreationUserId.Value);
                result.CreationUser = creationUser.FullName;
            }

            return(result);
        }
Пример #8
0
        public static void GenerateSalesOrder(XElement source, CommercialDocument destination, bool isNew)
        {
            if (destination == null)
            {
                return;
            }

            #region Contractors
            string           str;
            ContractorMapper contractorMapper = DependencyContainerManager.Container.Get <ContractorMapper>();
            Contractor       sourceSeller     = null;
            if (source.Element("karta-klienta").Element("klient").Element("nip") != null)
            {
                str = source.Element("karta-klienta").Element("klient").Element("nip").Value;

                sourceSeller = contractorMapper.GetContractorByNip(str);
                if (sourceSeller == null)
                {
                    throw new ClientException(ClientExceptionId.ObjectNotFound);
                }
            }

            if (source.Element("karta-klienta").Element("klient").Element("nazwa") != null && sourceSeller == null)
            {
                str = source.Element("karta-klienta").Element("klient").Element("nazwa").Value;

                sourceSeller = contractorMapper.GetContractorByFullName(str);
                if (sourceSeller == null)
                {
                    throw new ClientException(ClientExceptionId.ObjectNotFound);
                }
            }


            destination.Contractor = sourceSeller;
            #endregion

            #region Parsing Lines
            var sourceLines = new List <CustomXmlOrderLine>();

            double            coloreValue            = 0;
            XDocument         codesInputDocument     = XDocument.Parse(XmlName.EmptyRoot);
            XPathDocument     itemsLists             = new XPathDocument(source.CreateReader());
            XPathNavigator    oXPathNavigator        = itemsLists.CreateNavigator();
            XPathNodeIterator oIpozycjaNodesIterator = oXPathNavigator.Select("/source/karta-klienta/pozycja");
            int lineNumber = 1;
            foreach (XPathNavigator item in oIpozycjaNodesIterator)
            {
                var lineInfo = new CustomXmlOrderLine();
                lineInfo.ItemUnit = item.SelectSingleNode("ilosc").Value.Replace(",", "."); //jeśli < 1000 to wstawiam ten produkt
                if (!item.SelectSingleNode("kod_fr").IsEmptyElement)
                {
                    lineInfo.ItemCode = item.SelectSingleNode("kod_fr").Value;
                }
                else
                {
                    lineInfo.ItemCode = item.SelectSingleNode("produkt").Value;
                }

                if (int.Parse(lineInfo.ItemUnit) < 1000)
                {
                    lineInfo.ItemDescription = "directUse";
                }
                else
                {
                    lineInfo.ItemDescription = "getItemEquivalent";
                }
                lineInfo.Quantity = decimal.Parse(item.SelectSingleNode("sztuk").ToString().Replace(",", "."));

                //Brakuje logiki zamiany towarów na opakowane
                sourceLines.Add(lineInfo);

                codesInputDocument.Root.Add(
                    new XElement("line"
                                 , new XElement("LineNumber", lineNumber.ToStringInvariant())
                                 , new XElement(XmlName.Code, lineInfo.ItemCode)
                                 , new XElement("itemDescription", lineInfo.ItemDescription)
                                 , new XElement("itemUnit", lineInfo.ItemUnit)
                                 , new XElement("quantity", lineInfo.Quantity)
                                 ));
                lineNumber++;

                if (!item.SelectSingleNode("wartosc-pigment").IsEmptyElement)
                {
                    //to się sumuje do usługi barwienie z sumą kosztów
                    coloreValue = coloreValue + double.Parse(item.SelectSingleNode("wartosc-pigment").Value);
                }
            }

            // Dodanie pozycji usługowej z wycena wartości barwienia
            if (coloreValue != 0)
            {
                var lineInfo = new CustomXmlOrderLine();
                coloreValue = Math.Round(coloreValue, 2);

                lineInfo.ItemCode = "Pigment - barwienie";
                lineInfo.Quantity = 1;
                sourceLines.Add(lineInfo);

                codesInputDocument.Root.Add(
                    new XElement("line"
                                 , new XElement("LineNumber", lineNumber.ToStringInvariant())
                                 , new XElement(XmlName.Code, lineInfo.ItemCode)
                                 , new XElement("defaultPrice", coloreValue)
                                 , new XElement("quantity", 1)
                                 , new XElement("itemDescription", "directUse")
                                 ));
            }
            #endregion



            #region AddLines
            XDocument  itemsNotFound = XDocument.Parse(XmlName.EmptyRoot);
            ItemMapper itemMapper    = DependencyContainerManager.Container.Get <ItemMapper>();
            XElement   documentItems = EcIntegrationFactory.CheckItemsExistence(itemMapper, codesInputDocument); //p_checkItemsExistenceByCode

            XPathDocument     itemsCheckedLists = new XPathDocument(documentItems.CreateReader());
            XPathNavigator    itemsNavigator    = itemsCheckedLists.CreateNavigator();
            XPathNodeIterator itemsIterator     = itemsNavigator.Select("/root/line");
            lineNumber = 1;
            foreach (XPathNavigator line in itemsIterator)
            {
                if (line.SelectSingleNode("id") != null)
                {
                    destination.CalculationType         = (CalculationType)Enum.Parse(typeof(CalculationType), "Gross");
                    destination.CalculationTypeSelected = true;

                    CommercialDocumentLine commercialDocumentLine = destination.Lines.CreateNew();
                    commercialDocumentLine.Quantity        = (decimal)line.SelectSingleNode("quantity").ValueAsDouble;
                    commercialDocumentLine.ItemVersion     = new Guid(line.SelectSingleNode("version").Value);
                    commercialDocumentLine.ItemId          = new Guid(line.SelectSingleNode("id").Value);
                    commercialDocumentLine.UnitId          = new Guid(line.SelectSingleNode("unitId").Value);
                    commercialDocumentLine.VatRateId       = new Guid(line.SelectSingleNode("vatRateId").Value);
                    commercialDocumentLine.ItemCode        = line.SelectSingleNode("code").Value;
                    commercialDocumentLine.ItemName        = line.SelectSingleNode("name").Value;
                    commercialDocumentLine.ItemTypeId      = line.SelectSingleNode("itemTypeId").Value;
                    commercialDocumentLine.InitialNetPrice = Convert.ToDecimal(line.SelectSingleNode("defaultPrice").Value, CultureInfo.InvariantCulture);

                    commercialDocumentLine.Calculate(commercialDocumentLine.Quantity, commercialDocumentLine.InitialNetPrice, 0);
                }
                else
                {
                    itemsNotFound.Root.Add(
                        new XElement("itemsNotFound",
                                     XElement.Load(line.ReadSubtree()))
                        );
                }
            }
            source.Add(XElement.Load(itemsNotFound.Root.CreateReader()));
            source.Element("karta-klienta").Remove();
            #endregion

            //Vat Table
            destination.Calculate();
        }
Пример #9
0
        /// <summary>
        /// Validates the <see cref="BusinessObject"/>.
        /// </summary>
        public override void Validate()
        {
            if (this.Status == BusinessObjectStatus.New)
            {
                int catalogueLimit = ConfigurationMapper.Instance.CatalogueLimit;

                if (catalogueLimit > 0)
                {
                    ContractorMapper mapper = DependencyContainerManager.Container.Get <ContractorMapper>();
                    int count = mapper.GetContractorsCount();

                    if (count >= catalogueLimit)
                    {
                        throw new ClientException(ClientExceptionId.CatalogueLimitError, null, "catalogueLimit:" + catalogueLimit.ToString(CultureInfo.InvariantCulture));
                    }
                }
            }

            Configuration.Configuration conf = ConfigurationMapper.Instance.GetConfiguration(SessionManager.User, "contractors.allowOneGroupMembership").FirstOrDefault();

            if (conf != null && conf.Value.Value.ToUpperInvariant() == "TRUE" &&
                this.GroupMemberships != null && this.GroupMemberships.Children.Count > 1)
            {
                throw new ClientException(ClientExceptionId.ContractorOneGroupMembershipEnforcement);
            }

            conf = ConfigurationMapper.Instance.GetConfiguration(SessionManager.User, "contractors.enforceGroupMembership").FirstOrDefault();

            if (conf != null && conf.Value.Value.ToUpperInvariant() == "TRUE" &&
                this.GroupMemberships != null && this.GroupMemberships.Children.Count == 0)
            {
                throw new ClientException(ClientExceptionId.ContractorGroupMembershipEnforcement);
            }

            base.Validate();

            if (this.AlternateVersion != null)
            {
                Contractor alt = (Contractor)this.AlternateVersion;

                if (this.IsBank != alt.IsBank ||
                    this.IsEmployee != alt.IsEmployee)
                {
                    throw new ClientException(ClientExceptionId.ContractorTypeChangeError);
                }
            }

            if (this.Accounts != null)
            {
                this.Accounts.Validate();
            }

            if (this.Addresses != null)
            {
                this.Addresses.Validate();
            }

            if (this.Attributes != null)
            {
                this.Attributes.Validate();
            }

            if (this.GroupMemberships != null)
            {
                this.GroupMemberships.Validate();
            }

            if (this.Relations != null)
            {
                this.Relations.Validate();
            }
        }
Пример #10
0
        private static void CreateNextCorrectiveDocument(CommercialDocument lastCorrectiveDoc, CommercialDocument destination)
        {
            destination.CorrectedDocument = lastCorrectiveDoc;

            //copy header
            destination.CalculationType    = lastCorrectiveDoc.CalculationType;
            destination.DocumentCurrencyId = lastCorrectiveDoc.DocumentCurrencyId;
            destination.GrossValue         = lastCorrectiveDoc.GrossValue;
            destination.NetValue           = lastCorrectiveDoc.NetValue;
            destination.SummationType      = lastCorrectiveDoc.SummationType;
            destination.VatValue           = lastCorrectiveDoc.VatValue;
            //Jednak event date powinien być podpowiadany jako bieżąca data
            destination.EventDate = SessionManager.VolatileElements.CurrentDateTime;            //lastCorrectiveDoc.EventDate;

            if (lastCorrectiveDoc.Contractor != null)
            {
                ContractorMapper contractorMapper = DependencyContainerManager.Container.Get <ContractorMapper>();
                Contractor       contractor       = (Contractor)contractorMapper.LoadBusinessObject(BusinessObjectType.CommercialDocument, lastCorrectiveDoc.Contractor.Id.Value);

                destination.Contractor          = contractor;
                destination.ContractorAddressId = lastCorrectiveDoc.ContractorAddressId;
            }

            //copy attributes if specified
            foreach (DocumentAttrValue attr in lastCorrectiveDoc.Attributes.Children)
            {
                if (attr.DocumentFieldName == DocumentFieldName.Attribute_SupplierDocumentDate ||
                    attr.DocumentFieldName == DocumentFieldName.Attribute_SupplierDocumentNumber)
                {
                    DocumentAttrValue dstAttr = destination.Attributes.CreateNew();
                    dstAttr.DocumentFieldName = attr.DocumentFieldName;
                    dstAttr.Value             = new XElement(attr.Value);
                }
            }

            //create vat tables
            foreach (CommercialDocumentVatTableEntry vtEntry in lastCorrectiveDoc.VatTableEntries.Children)
            {
                if (lastCorrectiveDoc.IsSettlementDocument && (vtEntry.GrossValue < 0 || vtEntry.NetValue < 0 || vtEntry.VatValue < 0))
                {
                    continue;
                }

                if (vtEntry.GrossValue != 0 || vtEntry.NetValue != 0 || vtEntry.VatValue != 0)
                {
                    CommercialDocumentVatTableEntry dstVtEntry = destination.VatTableEntries.CreateNew();

                    dstVtEntry.GrossValue = vtEntry.GrossValue;
                    dstVtEntry.NetValue   = vtEntry.NetValue;
                    dstVtEntry.VatValue   = vtEntry.VatValue;
                    dstVtEntry.VatRateId  = vtEntry.VatRateId;
                }
            }

            if (lastCorrectiveDoc.IsSettlementDocument)
            {
                destination.NetValue   = destination.VatTableEntries.Sum(s => s.NetValue);
                destination.GrossValue = destination.VatTableEntries.Sum(s => s.GrossValue);
                destination.VatValue   = destination.VatTableEntries.Sum(s => s.VatValue);
            }

            //create only these lines that werent corrected inside the same document
            var linesToCopy = from line in lastCorrectiveDoc.Lines.Children
                              where (lastCorrectiveDoc.Lines.Children.Where(w => w.CorrectedLine != null).Select(s => s.CorrectedLine.Id.Value)).Contains(line.Id.Value) == false
                              select line;

            foreach (CommercialDocumentLine srcLine in linesToCopy)
            {
                CommercialDocumentLine line = destination.Lines.CreateNew();
                line.CorrectedLine      = srcLine;
                line.DiscountGrossValue = srcLine.DiscountGrossValue;
                line.DiscountNetValue   = srcLine.DiscountNetValue;
                line.DiscountRate       = srcLine.DiscountRate;
                line.GrossPrice         = srcLine.GrossPrice;
                line.GrossValue         = srcLine.GrossValue;
                line.InitialGrossPrice  = srcLine.InitialGrossPrice;
                line.InitialGrossValue  = srcLine.InitialGrossValue;
                line.InitialNetPrice    = srcLine.InitialNetPrice;
                line.InitialNetValue    = srcLine.InitialNetValue;
                line.ItemId             = srcLine.ItemId;
                line.ItemName           = srcLine.ItemName;
                line.ItemVersion        = srcLine.ItemVersion;
                line.NetPrice           = srcLine.NetPrice;
                line.NetValue           = srcLine.NetValue;
                line.Quantity           = srcLine.Quantity;
                line.UnitId             = srcLine.UnitId;
                line.VatRateId          = srcLine.VatRateId;
                line.VatValue           = srcLine.VatValue;
                line.WarehouseId        = srcLine.WarehouseId;
                line.ItemCode           = srcLine.ItemCode;
                line.ItemTypeId         = srcLine.ItemTypeId;
            }
        }
Пример #11
0
        public static void CreateIncomeShiftDocumentFromOutcomeShift(XElement source, WarehouseDocument destination)
        {
            //TODO: tutaj powinno byc odczytywanie z MM- jaki jest typ dokumentu lustrzanego
            destination.DocumentTypeId = DictionaryMapper.Instance.GetDocumentType("MM+").Id.Value;

            if (source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("contractorId") != null)
            {
                ContractorMapper contractorMapper = DependencyContainerManager.Container.Get <ContractorMapper>();
                Contractor       contractor       = (Contractor)contractorMapper.CreateNewBusinessObject(BusinessObjectType.Contractor, null);
                contractor.Id          = new Guid(source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("contractorId").Value);
                destination.Contractor = contractor;
            }

            destination.Number.FullNumber = source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("fullNumber").Value;
            destination.Number.Number     = Convert.ToInt32(source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("number").Value, CultureInfo.InvariantCulture);
            destination.Number.SeriesId   = new Guid(source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("seriesId").Value);
            destination.Value             = Convert.ToDecimal(source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("value").Value, CultureInfo.InvariantCulture);
            destination.DocumentStatus    = DocumentStatus.Saved;

            //set warehouse as destination wh in the source
            Guid whDocumentFieldId = DictionaryMapper.Instance.GetDocumentField(DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId).Id.Value;

            string warehouseId = (from node in source.Element("root").Element("documentAttrValue").Elements()
                                  where node.Element("documentFieldId").Value == whDocumentFieldId.ToUpperString()
                                  select node).ElementAt(0).Element("textValue").Value;

            destination.WarehouseId = new Guid(warehouseId);

            //create attributes
            DocumentAttrValue attr = null;

            var attrs = destination.Attributes.Children.Where(a => a.DocumentFieldName == DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId);

            if (attrs.Count() == 1)
            {
                attr = attrs.ElementAt(0);
            }
            else
            {
                attr = destination.Attributes.CreateNew();
                attr.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId;
            }

            attr.Value.Value = source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("warehouseId").Value;

            attr = destination.Attributes.CreateNew();
            attr.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentStatus;
            attr.Value.Value       = source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("status").Value;

            attr = destination.Attributes.CreateNew();
            attr.DocumentFieldName = DocumentFieldName.ShiftDocumentAttribute_OppositeDocumentId;
            attr.Value.Value       = source.Element("root").Element("warehouseDocumentHeader").Element("entry").Element("id").Value;

            DocumentField df = DictionaryMapper.Instance.GetDocumentField(DocumentFieldName.Attribute_IncomeShiftOrderId);

            if (df != null)
            {
                var srcAttr = source.Element("root").Element("documentAttrValue").Elements("entry").Where(e => e.Element("documentFieldId").Value == df.Id.ToUpperString()).FirstOrDefault();

                if (srcAttr != null)
                {
                    attr = destination.Attributes.CreateNew();
                    attr.DocumentFieldName = DocumentFieldName.Attribute_IncomeShiftOrderId;
                    attr.Value.Value       = srcAttr.Element("textValue").Value;
                }
            }
            //

            bool isLocalShift = destination.IsLocalShift();

            if (isLocalShift)
            {
                destination.DocumentStatus = DocumentStatus.Committed;
            }

            //create lines
            foreach (XElement entry in source.Element("root").Element("warehouseDocumentLine").Elements().OrderBy(e => Convert.ToInt32(e.Element("ordinalNumber").Value, CultureInfo.InvariantCulture)))
            {
                WarehouseDocumentLine line = destination.Lines.CreateNew();

                if (!isLocalShift)
                {
                    line.Direction = 0;
                }

                line.ItemId      = new Guid(entry.Element("itemId").Value);
                line.IncomeDate  = DateTime.Parse(entry.Element("outcomeDate").Value, CultureInfo.InvariantCulture);
                line.Quantity    = Convert.ToDecimal(entry.Element("quantity").Value, CultureInfo.InvariantCulture);
                line.Price       = Convert.ToDecimal(entry.Element("price").Value, CultureInfo.InvariantCulture);
                line.Value       = Convert.ToDecimal(entry.Element("value").Value, CultureInfo.InvariantCulture);
                line.UnitId      = new Guid(entry.Element("unitId").Value);
                line.WarehouseId = destination.WarehouseId;
            }
            //
        }