Exemplo n.º 1
0
        private string ShowTemplate(TemplateModel model, int ProductId, string tmpl)
        {
            TemplateVariable   tVariable = new TemplateVariable();
            BarcodeDesignModel tValue    = getBarcodeData(ProductId);
            // var size1 = size;
            var barcode = "barcode" + tmpl;
            var Barcode = @"<input type='hidden' value='" + tValue.Barcode + "' id='hiddenbarcode" + tmpl + "' class='abc'><svg id = 'barcode" + tmpl + "'></svg><script>JsBarcode('#barcode" + tmpl + "', '" + tValue.Barcode + "', {width: 2,height: 40});</script>";
            //        //format: "pharmacode",
            //        //lineColor: "#0aa",
            //+ 'width: 2,'
            //+ 'height: 40,'
            //        // displayValue: false
            //+ '});</script>';
            string updateHtml = "";

            if (model.TemplateHtml != null)
            {
                string html = model.TemplateHtml;
                updateHtml = html.Replace(tVariable.barcode, Barcode);
                updateHtml = updateHtml.Replace(tVariable.name, tValue.Name);
                updateHtml = updateHtml.Replace(tVariable.productname, tValue.ProductName);
                updateHtml = updateHtml.Replace(tVariable.productid, tValue.ProductId);
                updateHtml = updateHtml.Replace(tVariable.unit, tValue.Unit);
                updateHtml = updateHtml.Replace(tVariable.quantity, tValue.Quantity);
                updateHtml = updateHtml.Replace(tVariable.discount, tValue.Discount);
                updateHtml = updateHtml.Replace(tVariable.price, tValue.Price);
                updateHtml = updateHtml.Replace(tVariable.priceafterdiscount, tValue.PriceAfterDiscount);
            }

            model.TemplateHtml = updateHtml;
            return(updateHtml);
        }
Exemplo n.º 2
0
        private BarcodeDesignModel getBarcodeData(int ProductId)
        {
            BarcodeDesignModel model   = new BarcodeDesignModel();
            ProductModel       product = GetById(ProductId);

            //var product = ServerResponse.Invoke<ProductModel>(api + "getProduct?id=" + ProductId, body, get);

            model.Name    = product.ProductSKU;
            model.Barcode = product.Barcode;
            model.Price   = product.ActualSellingPrice.ToString();
            //  model.PriceAfterDiscount = product.PriceAfterDiscount.ToString();
            //model.Discount = product.Discount.ToString();
            model.ProductId = product.ProductSKU;
            //if (product.Quantity == null || product.Quantity == 0)
            //{
            //    model.Quantity = "1";
            //}
            //else
            //{
            //    model.Quantity = product.Quantity.ToString();
            //}
            return(model);
        }