Subversion Repository Public Repository

ChrisCompleteCodeTrunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Telerik.Reporting;

namespace Action_Tire_Payment_Processor
{
    public partial class ReceiptPreview : Form
    {
        public ReceiptPreview(int RecID, bool Loyalty, string cardType = "Loyalty Card")
        {
            InitializeComponent();
            Report report = null;
            System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
            settings.IgnoreWhitespace = true;
            string pl = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "ATC Loyalty Receipt.trdx");
            string pr = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "ATC Receipt.trdx");
            //using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create((Loyalty?"ATC Loyalty Receipt.trdx":"ATC Receipt.trdx"), settings))
            using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create((Loyalty ? pl : pr), settings))
            {
                Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
                    new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();

                report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
                SqlDataSource sds = report.DataSource as SqlDataSource;
                sds.ConnectionString = Database.ConnectionString;
                if (Loyalty)
                    sds.SelectCommand = "SELECT * FROM [Gift_Card_Transactions] WHERE [Gift_Card_Transactions].[ID] = @Transactions_ID";
                if (!Loyalty)
                    sds.SelectCommand = "SELECT * FROM [Transactions] WHERE [Transactions].[ID] = @Transactions_ID";
                report.DataSource = sds;
            }

            InstanceReportSource irs = new InstanceReportSource();
            irs.ReportDocument = report;
            irs.Parameters.Add(new Telerik.Reporting.Parameter("ID", RecID));
            if (Loyalty)
            {
                irs.Parameters.Add(new Telerik.Reporting.Parameter("CardType", cardType));
            }
            
            reportViewer1.ReportSource = irs;
            reportViewer1.RefreshReport();
        }
    }
}

Commits for ChrisCompleteCodeTrunk/ATTP/Action Tire Payment Processor/ReceiptPreview.cs

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000