Exemple #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            List <Trademark> tm_list = new List <Trademark>();

            if (rbPrintChoosen.Checked)
            {
                if (gridView1.SelectedRowsCount > 0)
                {
                    int Id = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.Columns["Id"]).ToString());
                    tm_list = tempRecList.Where(i => i.Id == Id).ToList(); //.First()
                }
            }
            else if (rbPrintAll.Checked)
            {
                //tm_list = filteredRecs;
                for (int m = 0; m < gridView1.RowCount; m++)
                {
                    int Id = Convert.ToInt32(gridView1.GetRowCellValue(m, "Id").ToString());
                    tm_list.Add(tempRecList.Where(i => i.Id == Id).First());
                }
            }


            List <Trademark_Full> TM_Full_List = new List <Trademark_Full>();

            foreach (Trademark tm in tm_list)
            {
                TM_Full_List.Add(new Trademark_Full(tm));
            }

            if (TM_Full_List.Count > 0)
            {
                BindingList <Trademark_Full> tmBList = new BindingList <Trademark_Full>(TM_Full_List);

                //send tm_list to report
                Report_TmBasic rep_tmBasic = new Report_TmBasic(tmBList);

                DevExpress.XtraReports.UI.ReportPrintTool RepPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rep_tmBasic);

                //rep_tmBasic.ShowPreviewMarginLines = false;
                RepPrintTool.PreviewForm.AllowFormSkin = false;

                RepPrintTool.ShowPreview();
            }
        }
Exemple #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            List <Trademark> tm_list = new List <Trademark>();

            if (rbPrintChoosen.Checked)
            {
                if (dgvTempRecs.SelectedRows.Count > 0)
                {
                    int Id = Convert.ToInt32(dgvTempRecs.SelectedRows[0].Cells["tmp_Id"].Value.ToString());
                    tm_list = tempRecList.Where(i => i.Id == Id).ToList(); //.First()
                }
            }
            else if (rbPrintAll.Checked)
            {
                tm_list = filteredRecs;
            }

            List <Trademark_Full> TM_Full_List = new List <Trademark_Full>();

            foreach (Trademark tm in tm_list)
            {
                TM_Full_List.Add(new Trademark_Full(tm));
            }

            if (TM_Full_List.Count > 0)
            {
                BindingList <Trademark_Full> tmBList = new BindingList <Trademark_Full>(TM_Full_List);

                //send tm_list to report
                Report_TmBasic rep_tmBasic = new Report_TmBasic(tmBList);

                DevExpress.XtraReports.UI.ReportPrintTool RepPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(rep_tmBasic);

                //rep_tmBasic.ShowPreviewMarginLines = false;
                RepPrintTool.PreviewForm.AllowFormSkin = false;

                RepPrintTool.ShowPreview();
            }
        }