示例#1
0
        public void AppsPrint(PrintablePrint method)
        {
            if (!method.IsPrinted)
            {
                var singleton = this.Strategy.Session.GetSingleton();
                var logo      = this.TakenBy?.ExistLogoImage == true ?
                                this.TakenBy.LogoImage.MediaContent.Data :
                                singleton.LogoImage.MediaContent.Data;

                var images = new Dictionary <string, byte[]>
                {
                    { "Logo", logo },
                };

                if (this.ExistOrderNumber)
                {
                    var session        = this.Strategy.Session;
                    var barcodeService = session.ServiceProvider.GetRequiredService <IBarcodeService>();
                    var barcode        = barcodeService.Generate(this.OrderNumber, BarcodeType.CODE_128, 320, 80);
                    images.Add("Barcode", barcode);
                }

                var model = new Print.SalesOrderModel.Model(this);
                this.RenderPrintDocument(this.TakenBy?.SalesOrderTemplate, model, images);

                this.PrintDocument.Media.FileName = $"{this.OrderNumber}.odt";
            }
        }
示例#2
0
        public void GivenSalesOrder_WhenCreatingPrintModel_ThenPrintModelIsNotNull()
        {
            // Arrange
            var demo = new Demo(this.Session, null);

            demo.Execute();
            this.Session.Derive(true);

            var order = new SalesOrders(this.Session).Extent().First;

            // Act
            var printModel = new Print.SalesOrderModel.Model(order);

            // Assert
            Assert.NotNull(printModel);
        }