Beispiel #1
0
        /// <summary>
        /// Ngarkon ne CrystaReportViewer nje raport ne varesi te parametrit raporti
        /// </summary>
        /// <param name="raporti">percakton se cili raport do te ngarkohet</param>
        public void NgarkoRaport(string raporti)
        {
            switch (raporti)
            {
            case "ShfaqDhomaNePerdorim":
                this.crystalReportViewer1.ReportSource = new CrDhomaNePerdorim();
                break;

            case "ShfaqDhomatEPashlyera":
                this.crystalReportViewer1.ReportSource = new CrDhomatEPashlyera();
                break;

            case "ShfaqBilanci":
                this.crystalReportViewer1.ReportSource = new CrBilancSipasDatave();
                break;

            case "ShfaqBilanciPerDatenEdhene":
                CrBilancDitor cr = new CrBilancDitor();
                cr.SetDataSource(Application.StartupPath + "\\ShfaqBilanci.xml");
                this.crystalReportViewer1.ReportSource = cr;
                break;

            case "RezervimeVlefshme":
                this.crystalReportViewer1.ReportSource = new CrRezervimeVlefshme();
                break;

            case "RezervimeVlefshmePerAgjensi":
                this.crystalReportViewer1.ReportSource = new CrRezervimeVlefshmeAgjensi();
                break;

            case "RezervimeVlefshmePerEmerMbiemer":
                this.crystalReportViewer1.ReportSource = new CrRezervimeVlefshmeEmerMbiemer();
                break;

            case "Dhomat":
                this.crystalReportViewer1.ReportSource = new CrDhomat();
                break;

            case "ShfaqBilancMujor":
                CrBilancMujor cr2 = new CrBilancMujor();
                cr2.SetDataSource(Application.StartupPath + "\\BilancMujor.xml");
                this.crystalReportViewer1.ReportSource = new CrBilancMujor();
                break;

            case "ShfaqGrafikMujor":
                this.crystalReportViewer1.ReportSource = new CrGrafikMujor();
                break;

            case "HyrjeNeHotel":
                this.crystalReportViewer1.ReportSource = new CrHyrjeNeHotel();
                break;

            case "HyrjeNeHotelGrup":
                this.crystalReportViewer1.ReportSource = new CrHyrjeNeHotelGrup();
                break;

            case "FatureKlienti":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeKlient();
                break;

            case "FatureKlientiAng":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeKlientAng();
                break;

            case "FatureKlientiIt":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeKlientIt();
                break;

            case "FatureKlientiFr":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeKlientFr();
                break;

            case "FatureGrupi":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomaGrup();
                break;

            case "FatureGrupiAng":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomaGrupAng();
                break;

            case "FatureGrupiIt":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomaGrupIt();
                break;

            case "FatureGrupiFr":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomaGrupFr();
                break;

            case "FatureDhomaGrupi":
                this.crystalReportViewer1.ReportSource = new CrDorezoGrupPjeserisht();
                break;

            case "FatureDhomaGrupiAng":
                this.crystalReportViewer1.ReportSource = new CrDorezoGrupPjeserishtAng();
                break;

            case "FatureDhomaGrupiIt":
                this.crystalReportViewer1.ReportSource = new CrDorezoGrupPjeserishtIt();
                break;

            case "FatureDhomaGrupiFr":
                this.crystalReportViewer1.ReportSource = new CrDorezoGrupPjeserishtFr();
                break;

            case "FatureNjeDhomeGrupi":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeGrupi();
                break;

            case "FatureNjeDhomeGrupiAng":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeGrupiAng();
                break;

            case "FatureNjeDhomeGrupiIt":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeGrupiIt();
                break;

            case "FatureNjeDhomeGrupiFr":
                this.crystalReportViewer1.ReportSource = new CrDorezoDhomeGrupiFr();
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Ben ngarkimin dhe printimin e raportit pa e hapur raportin ne PrintPreview, nepermjet nje
        /// printDialog.
        /// </summary>
        /// <param name="raporti"></param>
        public void Printo(string raporti)
        {
            PrintDocument printDocument = new PrintDocument();
            string        printerName   = "";
            short         copies        = 1;

            printDocument.DocumentName = "Raport";
            printDialog.Document       = printDocument;
            if (printDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            printerName = printDialog.PrinterSettings.PrinterName;
            copies      = printDialog.PrinterSettings.Copies;
            try
            {
                switch (raporti)
                {
                case "ShfaqDhomatEPashlyera":
                    CrDhomatEPashlyera crDhomaPashlyera = new CrDhomatEPashlyera();
                    crDhomaPashlyera.PrintOptions.PrinterName = printerName;
                    crDhomaPashlyera.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "ShfaqBilanci":
                    CrBilancSipasDatave crBilancSipasDatave = new CrBilancSipasDatave();
                    crBilancSipasDatave.PrintOptions.PrinterName = printerName;
                    crBilancSipasDatave.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "ShfaqBilanciPerDatenEdhene":
                    CrBilancDitor crBilancDitor = new CrBilancDitor();
                    crBilancDitor.PrintOptions.PrinterName = printerName;
                    crBilancDitor.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "RezervimeVlefshme":
                    CrRezervimeVlefshme crRezervimeVlefshme = new CrRezervimeVlefshme();
                    crRezervimeVlefshme.PrintOptions.PrinterName = printerName;
                    crRezervimeVlefshme.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "RezervimeVlefshmePerAgjensi":
                    CrRezervimeVlefshmeAgjensi crRezervimeVlefshmeAgjensi = new CrRezervimeVlefshmeAgjensi();
                    crRezervimeVlefshmeAgjensi.PrintOptions.PrinterName = printerName;
                    crRezervimeVlefshmeAgjensi.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "RezervimeVlefshmePerEmerMbiemer":
                    CrRezervimeVlefshmeEmerMbiemer crRezervimeVlefshmeEmerMbiemer = new CrRezervimeVlefshmeEmerMbiemer();
                    crRezervimeVlefshmeEmerMbiemer.PrintOptions.PrinterName = printerName;
                    crRezervimeVlefshmeEmerMbiemer.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "Dhomat":
                    CrDhomat crDhomat = new CrDhomat();
                    crDhomat.PrintOptions.PrinterName = printerName;
                    crDhomat.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "ShfaqBilancMujor":
                    CrBilancMujor crBilancMujor = new CrBilancMujor();
                    crBilancMujor.PrintOptions.PrinterName = printerName;
                    crBilancMujor.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "ShfaqGrafikMujor":
                    CrGrafikMujor crGrafikMujor = new CrGrafikMujor();
                    crGrafikMujor.PrintOptions.PrinterName = printerName;
                    crGrafikMujor.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "HyrjeNeHotel":
                    CrHyrjeNeHotel crHyrjeNeHotel = new CrHyrjeNeHotel();
                    crHyrjeNeHotel.PrintOptions.PrinterName = printerName;
                    crHyrjeNeHotel.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "HyrjeNeHotelGrup":
                    CrHyrjeNeHotelGrup crHyrjeNeHotelGrup = new CrHyrjeNeHotelGrup();
                    crHyrjeNeHotelGrup.PrintOptions.PrinterName = printerName;
                    crHyrjeNeHotelGrup.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureKlienti":
                    CrDorezoDhomeKlient crDorezoDhomeKlient = new CrDorezoDhomeKlient();
                    crDorezoDhomeKlient.PrintOptions.PrinterName = printerName;
                    crDorezoDhomeKlient.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureKlientiAng":
                    CrDorezoDhomeKlientAng crDorezoDhomeKlient1 = new CrDorezoDhomeKlientAng();
                    crDorezoDhomeKlient1.PrintOptions.PrinterName = printerName;
                    crDorezoDhomeKlient1.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureKlientiIt":
                    CrDorezoDhomeKlientIt crDorezoDhomeKlient2 = new CrDorezoDhomeKlientIt();
                    crDorezoDhomeKlient2.PrintOptions.PrinterName = printerName;
                    crDorezoDhomeKlient2.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureKlientiFr":
                    CrDorezoDhomeKlientFr crDorezoDhomeKlient3 = new CrDorezoDhomeKlientFr();
                    crDorezoDhomeKlient3.PrintOptions.PrinterName = printerName;
                    crDorezoDhomeKlient3.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureGrupi":
                    CrDorezoDhomaGrup crDorezoDhomaGrup = new CrDorezoDhomaGrup();
                    crDorezoDhomaGrup.PrintOptions.PrinterName = printerName;
                    crDorezoDhomaGrup.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureGrupiAng":
                    CrDorezoDhomaGrupAng crDorezoDhomaGrup1 = new CrDorezoDhomaGrupAng();
                    crDorezoDhomaGrup1.PrintOptions.PrinterName = printerName;
                    crDorezoDhomaGrup1.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureGrupiIt":
                    CrDorezoDhomaGrupIt crDorezoDhomaGrup2 = new CrDorezoDhomaGrupIt();
                    crDorezoDhomaGrup2.PrintOptions.PrinterName = printerName;
                    crDorezoDhomaGrup2.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "FatureGrupiFr":
                    CrDorezoDhomaGrupFr crDorezoDhomaGrup3 = new CrDorezoDhomaGrupFr();
                    crDorezoDhomaGrup3.PrintOptions.PrinterName = printerName;
                    crDorezoDhomaGrup3.PrintToPrinter(copies, true, 0, 0);
                    break;

                case "CrDorezoGrupPjeserisht":
                    CrDorezoGrupPjeserisht crDorezoGrupPjeserisht = new CrDorezoGrupPjeserisht();
                    crDorezoGrupPjeserisht.PrintOptions.PrinterName = printerName;
                    crDorezoGrupPjeserisht.PrintToPrinter(copies, true, 0, 0);
                    break;
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Kontrolloni nese printeri qe keni zgjedhur per printim nuk ka probleme",
                                                     "Printimi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }