Exemplo n.º 1
0
        public void TestPrintBarCode()
        {
            var barCodeList =
                new List <BarCode>();

            for (var counter = 0; counter < 36; counter++)
            {
                barCodeList.Add(CreateBarCode());
            }

            //Print
            PrintBarCode.InializePrinting(barCodeList, Resources.ConstBarCodeTemplate2);

            Assert.AreEqual(1, 1, "Test performed");
        }
Exemplo n.º 2
0
        private void BtnPrintClick(object sender, EventArgs e)
        {
            try
            {
                if (!UserService.AllowToPerform(Resources.PermissionPrintProductCode))
                {
                    const string briefMsg  = "អំពី​សិទ្ឋិ​ប្រើ​ប្រាស់";
                    var          detailMsg = Resources.MsgUserPermissionDeny;
                    using (var frmMessageBox = new FrmExtendedMessageBox())
                    {
                        frmMessageBox.BriefMsgStr    = briefMsg;
                        frmMessageBox.DetailMsgStr   = detailMsg;
                        frmMessageBox.IsCanceledOnly = true;
                        frmMessageBox.ShowDialog(this);
                        return;
                    }
                }

                if (rdbProduct.Checked)
                {
                    DoPrintProduct();
                    return;
                }

                if (rdbPrintAll.Checked)
                {
                    _barCodeList.Clear();
                    foreach (var t in _productList)
                    {
                        var product = t;
                        if (product == null)
                        {
                            continue;
                        }

                        for (var qtyCounter = 0; qtyCounter < product.QtyInStock; qtyCounter++)
                        {
                            //var product = _ProductList[counter];
                            var barCode =
                                new BarCode
                            {
                                BarCodeValue  = product.ProductCode,
                                DisplayStr    = product.CategoryStr,
                                AdditionalStr = (product.QtyInStock.ToString("N0") + " / " + product.QtyInStock.ToString("N0")),
                                UnitPrice     = "$ " + (t).UnitPriceOut.ToString("N", AppContext.CultureInfo),
                                Description   = product.ProductName + @" \ " + product.SizeStr
                            };

                            var foreignCode = product.ForeignCode;
                            if (!string.IsNullOrEmpty(foreignCode))
                            {
                                barCode.DisplayStr += " (" + foreignCode + ")";
                            }
                            _barCodeList.Add(barCode);
                        }

                        (t).PrintCheck = true;
                        (t).PublicQty  =
                            (t).QtyInStock +
                            " / " +
                            (t).QtyInStock;
                    }
                    dgvProduct.Refresh();
                }

                var barCodeTemplate = AppContext.BarCodeTemplate;

                //var barCodePrintingTypeList =
                //    _CommonService.GetAppParametersByType(
                //        Int32.Parse(Resources.AppParamBarcodePrintingType, AppContext.CultureInfo));

                //var barCodePrintingType = string.Empty;
                //if (barCodePrintingTypeList != null)
                //{
                //    if(barCodePrintingTypeList.Count != 0)
                //    {
                //        var appParameter = (AppParameter) barCodePrintingTypeList[0];
                //        if (appParameter != null)
                //            barCodePrintingType = appParameter.ParameterValue;
                //    }
                //}

                if (string.IsNullOrEmpty(barCodeTemplate))
                {
                    barCodeTemplate = Resources.ConstBarCodeTemplate1;
                }

                if (!Resources.ConstBarCodeTemplate6.Equals(barCodeTemplate))
                {
                    PrintBarCode.InializePrinting(_barCodeList, barCodeTemplate);
                }
                else
                {
                    var fileName     = Resources.ConstBarcodeExcelFile;
                    var printBarCode = new PrintBarCode();
                    printBarCode.PrintBarcodeHandler(
                        Application.StartupPath + @"\" + fileName,
                        string.Empty,
                        _barCodeList);
                }

                SetFocusToProductList();
            }
            catch (Exception exception)
            {
                FrmExtendedMessageBox.UnknownErrorMessage(
                    Resources.MsgCaptionUnknownError,
                    exception.Message);
            }
        }
Exemplo n.º 3
0
        private void btnPrint_Click(object sender, System.EventArgs e)
        {
            PrintBarCode temp = new PrintBarCode(this.ylblWZH.Text.Trim(), this.ylblTSFLH.Text.Trim(), this.ylblZCH.Text.Trim());                //(文种号(1),图书分类号(8),种次号(4)

            temp.ShowDialog();
        }