示例#1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            List <ProductListPrint> items = new List <ProductListPrint>();
            Company company = companyBLO.GetCompany();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                Product p = dataGridView1.Rows[i].DataBoundItem as Product;
                items.Add
                (
                    new ProductListPrint
                    (
                        p.Reference,
                        p.Name,
                        p.UnitPrice,
                        p.Picture,
                        company?.Name,
                        company?.Email,
                        company?.PhoneNumber.ToString(),
                        company?.PostalCode,
                        !string.IsNullOrEmpty(company?.Logo) ? File.ReadAllBytes(company?.Logo) : null
                    )
                );
            }
            Form f = new FrmPreview("ProductListRpt.rdlc", items);

            f.Show();
        }
示例#2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            List <ProductListPrint> items = new List <ProductListPrint>();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                Product p = dataGridView1.Rows[i].DataBoundItem as Product;
                items.Add
                (
                    new ProductListPrint
                    (
                        p.Reference,
                        p.Name,
                        p.UnitPrice
                    )
                );
            }
            Form f = new FrmPreview("ProductListRpt.rdlc", items);

            f.Show();
        }