public void OnNext(PaymentCash value) { RemainingPriceToPay = value.RemainingPriceToPay; if (RemainingPriceToPay == 0) { FinishMakingDrink(); } }
public void TablePerHierarchySupportsInheritance() { var cardPayment = new PaymentCard { Amount = 2000M, Receipt = "ęśąćż" }; var cashPayment = new PaymentCash { Amount = 100M }; var notebookSoldIt = new SoldIt { WhatSold = "Notebook", Payment = cardPayment }; var keyboardSoldIt = new SoldIt { WhatSold = "Keyboard", Payment = cashPayment }; var dbConnectionString = DbConnectionString.Create(nameof(ConfiguringRelationships), GetCallerName()); var dbCtxOptions = dbConnectionString .AsSqlConnectionString <ShippingContext>() .EnsureDb(); using (var context = dbCtxOptions.BuildDbContext().StartLogging(_testOutput.AsLineWriter())) { context.AddRange(new[] { notebookSoldIt, keyboardSoldIt }); context.SaveChanges(); } using (var context = dbCtxOptions.BuildDbContext().StartLogging(_testOutput.AsLineWriter())) { var notebookPayment = context .SoldIts .Where(si => si.WhatSold == "Notebook") .Select(si => si.Payment) .Single(); var keyboardPayment = context .SoldIts .Where(si => si.WhatSold == "Keyboard") .Select(si => si.Payment) .Single(); notebookPayment.Should().BeOfType <PaymentCard>("because the original type has been preserved"); notebookPayment.Type.Should().Be("card", $"because that's a discriminator value indicating {nameof(PaymentCard)} type"); keyboardPayment.Should().BeOfType <PaymentCash>("because the original type has been preserved"); keyboardPayment.Type.Should().Be("cash", $"because that's a discriminator value indicating {nameof(PaymentCash)} type"); context .Set <Payment>() .OfType <PaymentCard>() .First().Receipt .Should() .Be("ęśąćż", "because that's another way to handle a hierarchical table"); } }
public void Insert(string PaymentCashCode,DateTime PaymentCashDate,int? PaymentCashMemberID,int? PaymentCashCompanyID,decimal PaymentCashSum,int PaymentStatus,int? PaymentType,int? PaymentOrderID,string PaymentMemo,int? CreatedBy,DateTime? CreatedOn,int? ModifiedBy,DateTime? ModifiedOn) { PaymentCash item = new PaymentCash(); item.PaymentCashCode = PaymentCashCode; item.PaymentCashDate = PaymentCashDate; item.PaymentCashMemberID = PaymentCashMemberID; item.PaymentCashCompanyID = PaymentCashCompanyID; item.PaymentCashSum = PaymentCashSum; item.PaymentStatus = PaymentStatus; item.PaymentType = PaymentType; item.PaymentOrderID = PaymentOrderID; item.PaymentMemo = PaymentMemo; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.Save(UserName); }