Esempio n. 1
0
 /// <summary>
 /// 出票,打印
 /// </summary>
 private void Ticketing(NoteDto note)
 {
     this.Invoke(new Action(() =>
     {
         lbl票号.Text   = note.Seq;
         lbl等候人数.Text = "" + note.WaitCount;
         lbl业务.Text   = note.BusinessName;
         lbl受理窗口.Text = note.WindowsNames;
     }));
     Print(note);
 }
Esempio n. 2
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="templateFileName">模板文件名称</param>
        /// <param name="printer">打印机名称</param>
        private bool Print(NoteDto note, string templateFileName = @"E:\studyspace\all demo\Jonny.AllDemo\src\sqlite\Jonny.AllDemo.SQLiteFirst\frxs\test.frx", string printer = "Microsoft Print to PDF")
        {
            lock (_lock)
            {
                try
                {
                    using (Report report = new Report())
                    {
                        report.Load(templateFileName);
                        DataSet ds = new DataSet();
                        var     dt = new DataTable("Note");
                        dt.Columns.Add(new DataColumn("Seq", typeof(String)));
                        dt.Columns.Add(new DataColumn("WaitCount", typeof(Int32)));
                        dt.Columns.Add(new DataColumn("BusinessName", typeof(String)));
                        dt.Columns.Add(new DataColumn("WindowsNames", typeof(String)));
                        dt.Rows.Add(note.Seq, note.WaitCount, note.BusinessName, note.WindowsNames);

                        ds.Tables.Add(dt);

                        report.RegisterData(ds);

                        // 集合
                        //var dataSet = new List<NoteDto>();
                        //dataSet.Add(note);
                        //report.RegisterData(dataSet, "Note");
                        report.PrintSettings.Printer = printer;
                        //report.PrintSettings.ShowDialog = true;
                        report.Print();
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }