Пример #1
0
        /// <summary>
        /// 点击treeListLogisticCompany结点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeListLogisticCompany_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            TreeListNode focusedNode = treeListLogisticCompany.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            List <Alading.Entity.LogisticCompanyTemplate> templateList = new List <Alading.Entity.LogisticCompanyTemplate>();

            if (focusedNode.Tag == null)//获取全部信息
            {
                templateList = LogisticCompanyService.GetAllLogisticCompanyTemplate();
            }
            else
            {
                templateList = LogisticCompanyService.GetLogisticCompanyTemplate(c => c.LogisticCompanyCode == focusedNode.Tag.ToString());
            }
            gcLogisticComTemplate.DataSource = templateList;
            gvLogisticComTemplate.BestFitColumns();

            //加载Template
            LoadTemplate(gvLogisticComTemplate.FocusedRowHandle);
        }
Пример #2
0
        private void LoadPrintPreview(Alading.Entity.Trade trade)
        {
            if (trade != null && !string.IsNullOrEmpty(trade.TemplateCode))
            {
                LogisticCompanyTemplate template = LogisticCompanyService.GetLogisticCompanyTemplate(t => t.TemplateCode == trade.TemplateCode).FirstOrDefault();

                if (template != null)
                {
                    byte[]       decommpressBytes = CompressHelper.Decompress(template.TemplateData);
                    MemoryStream memStream        = new MemoryStream(decommpressBytes);
                    XtraReport   xtraReport       = new XtraReport();
                    xtraReport.PrintingSystem = expressPreview.PrintingSystem;
                    xtraReport.LoadLayout(memStream);
                    xtraReport.CreateDocument(true);
                    memStream.Close();

                    SetValue(xtraReport, "收件人", trade.receiver_name);
                    SetValue(xtraReport, "收件人电话", trade.receiver_phone);
                    SetValue(xtraReport, "收件人手机", trade.receiver_mobile);
                    SetValue(xtraReport, "收件人地址", trade.receiver_address);
                    SetValue(xtraReport, "收件人邮编", trade.receiver_zip);
                    SetValue(xtraReport, "寄件人", trade.seller_name);
                    SetValue(xtraReport, "寄件人手机", trade.seller_mobile);
                    SetValue(xtraReport, "寄件人电话", trade.seller_phone);
                }
            }
            //PrintingSystem printingSystem = new PrintingSystem();

            ////非常关键,设置打印页面大小
            ////自定义的纸张,注意单位是:百分之一英寸 0.01英寸
            //PaperSize customPaperSize = new PaperSize("Custom Paper Size", 500, 550);
            //Margins customMargins = new Margins(0, 0, 0, 0);
            //PageSettings customPageSettings = new PageSettings();
            //customPageSettings.PaperSize = customPaperSize;
            //customPageSettings.Margins = customMargins;
            //printingSystem.PageSettings.Assign(customPageSettings);

            //this.printCtrlExpress.PrintingSystem = printingSystem;

            //XtraReport xtraReport = new XtraReport();
            //xtraReport.LoadLayout(@"d:\XtraReport.repx");
            //xtraReport.PrintingSystem = printingSystem;
            //xtraReport.CreateDocument(true);

            ////预览配货单
            //PrintingSystem printingProductSystem = new PrintingSystem();
            //this.printCtrlProduct.PrintingSystem = printingProductSystem;

            //PreviewReport productReport = new PreviewReport();
            //Parameter parameter = productReport.Parameters["TradeCode"];
            //parameter.Value = "20100345789531";
            //productReport.PrintingSystem = printingProductSystem;
            //productReport.CreateDocument(true);
            //printingProductSystem.ExecCommand(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, new object[] { true });
        }