Example #1
0
        private void FillRelationshipBetweenDocuments(long inDocument, long outDocument)
        {
            var documentLink = new RelationshipBetweenDocuments
            {
                InDocument  = inDocument,
                OutDocument = outDocument,
                InUnitCode  = NamesOfSectionSystem.CertificateQuality,
                OutUnitCode = NamesOfSectionSystem.CreditSlipSpecification
            };

            _repositoryLink.Insert(documentLink);
        }
Example #2
0
        private void Create()
        {
            var newCreditSlips = new List <CreditSlip>();



            CreateEntities.DoForEach(x =>
            {
                if (!newCreditSlips.Any() ||
                    (newCreditSlips.All(c => c.PersonalAccount != x.PersonalAccount)) ||
                    (newCreditSlips.Any(c => c.PersonalAccount == x.PersonalAccount &&
                                        c.CreditSlipSpecifications.Any(n =>
                                                                       n.SerNumb == x.PlaneCertificate.CertificateQuality.Cast &&
                                                                       n.NomenclatureNumberModification ==
                                                                       x.PlaneCertificate.ModificationNomenclature)
                                        ))
                    )
                {
                    var creditSlip = FillCreditSlip(x);
                    var creditSlipSpecification = FillCreditSlipSpecification(x, creditSlip);
                    _repositoryCreditSlip.Insert(creditSlip);
                    FillRelationshipBetweenDocuments(x.PlaneCertificate.CertificateQuality.Rn,
                                                     creditSlipSpecification.Rn);

                    newCreditSlips.Add(creditSlip);
                }
                else
                {
                    newCreditSlips.DoForEach(z =>
                    {
                        if (z.PersonalAccount == x.PersonalAccount &&
                            !z.CreditSlipSpecifications.Any(n => n.SerNumb == x.PlaneCertificate.CertificateQuality.Cast
                                                            &&
                                                            n.NomenclatureNumberModification ==
                                                            x.PlaneCertificate.ModificationNomenclature))
                        {
                            var creditSlipSpecification = FillCreditSlipSpecification(x, z);
                            _repositoryCreditSlipSpecs.Insert(creditSlipSpecification);
                            FillRelationshipBetweenDocuments(x.PlaneCertificate.CertificateQuality.Rn,
                                                             creditSlipSpecification.Rn);
                        }
                    });
                }
            });
        }