public static CreditSlipSpecification CreateCreditSlipSpecification(CreditSlip creditSlip, ISession session) { var creditSlipSpecification = new CreditSlipSpecification { CreditSlip = creditSlip ?? CreateAndSave(session, CreateCreditSlip), NomenclatureNumberModification = new NomenclatureNumberModification { Rn = 452602307 }, TaxBand = new TaxBand { Rn = 250854500 }, PLANQUANT = 1, FACTQUANT = 1, PLANQUANTALT = 0, FACTQUANTALT = 0, Price = 1, PRICEMEAS = false, PRICECALCRULE = true, ACCPRICE = (decimal)0.85, ACCPRICEMEAS = false, ACCSUMM = (decimal)0.85, PLANSUM = (decimal)0.85, PLANSUMTAX = 1, PLANSUMNDS = (decimal)0.15, FACTSUM = (decimal)0.85, FACTSUMTAX = 1, FACTSUMNDS = (decimal)0.15, AUTOCALCSIGN = true, SerNumb = "1Ser" }; return(creditSlipSpecification); }
private CreditSlipSpecification FillCreditSlipSpecification(PlanReceiptOrderPersonalAccount x, CreditSlip creditSlip) { var tax = _repositoryTax.Specify().Where(a => a.TaxBand == x.PlaneCertificate.TaxBand).Future().First().Value; var planCertificate = x.PlaneCertificate; var creditSlipSpecification = new CreditSlipSpecification { CreditSlip = creditSlip, NomenclatureNumberModification = planCertificate.ModificationNomenclature, TaxBand = planCertificate.TaxBand, PLANQUANT = (decimal)x.CountByDocument, FACTQUANT = (decimal)x.CountFact, //тут надо смотреть основную единицу измерения и пересчитавать PLANQUANTALT = 0, FACTQUANTALT = 0, Price = (decimal)planCertificate.Price, PRICEMEAS = false, PRICECALCRULE = true, ACCPRICE = (decimal)planCertificate.Price, ACCPRICEMEAS = false, ACCSUMM = CreditSlipDomainAlgorithmsOfCalculation.SumWithoutNDS((decimal)x.CountFact, (decimal)planCertificate.Price), PLANSUM = CreditSlipDomainAlgorithmsOfCalculation.SumWithoutNDS((decimal)x.CountByDocument, (decimal)planCertificate.Price), PLANSUMTAX = CreditSlipDomainAlgorithmsOfCalculation.SumWithNDS((decimal)x.CountByDocument, (decimal)planCertificate.Price, tax), PLANSUMNDS = CreditSlipDomainAlgorithmsOfCalculation.SumNDS((decimal)x.CountByDocument, (decimal)planCertificate.Price, tax), FACTSUM = CreditSlipDomainAlgorithmsOfCalculation.SumWithoutNDS((decimal)x.CountFact, (decimal)planCertificate.Price), FACTSUMTAX = CreditSlipDomainAlgorithmsOfCalculation.SumWithNDS((decimal)x.CountFact, (decimal)planCertificate.Price, tax), FACTSUMNDS = CreditSlipDomainAlgorithmsOfCalculation.SumNDS((decimal)x.CountFact, (decimal)planCertificate.Price, tax), AUTOCALCSIGN = true, SerNumb = planCertificate.CertificateQuality.Cast }; creditSlip.CreditSlipSpecifications.Add(creditSlipSpecification); return(creditSlipSpecification); }
public void Test8() { var connection = new NhConnection("hibernate.cfg.xml"); connection.Connecting(); ISession session = connection.GetSessionFactory().OpenSession(); // CreditSlip creditSlip = SampleEntity.CreateCreditSlip(); var creditSlip = session.QueryOver <CreditSlip>() .Where(x => x.State == CreditSlipState.NotFulfilled) .Take(1) .UnderlyingCriteria.UniqueResult <CreditSlip>(); CreditSlipSpecification creditSlipSpec_1 = SampleEntity.CreateCreditSlipSpecification(creditSlip, session); CreditSlipSpecification creditSlipSpec_2 = SampleEntity.CreateCreditSlipSpecification(creditSlip, session); creditSlipSpec_1.SerNumb = "new ser numb qqq"; creditSlipSpec_2.SerNumb = "new ser numb zzz 2"; creditSlip.CreditSlipSpecifications.Add(creditSlipSpec_1); creditSlip.CreditSlipSpecifications.Add(creditSlipSpec_2); using (ITransaction tr = session.BeginTransaction()) { session.Save(creditSlipSpec_1); tr.Commit(); } using (ITransaction tr = session.BeginTransaction()) { session.Delete(creditSlipSpec_1); session.Delete(creditSlipSpec_2); tr.Commit(); } }