public static bool ProceduraDiServizioPostLogon() { try { using (Session ses = new Session()) { DateTime inizioAnno = new DateTime(DateTime.Today.Year, 1, 1); DateTime fineAnno = new DateTime(DateTime.Today.Year + 1, 1, 1); GroupOperator criteria = new GroupOperator(GroupOperatorType.And); criteria.Operands.Add(new BinaryOperator("Vendita.DataContabile", inizioAnno, BinaryOperatorType.GreaterOrEqual)); criteria.Operands.Add(new BinaryOperator("Vendita.DataContabile", fineAnno, BinaryOperatorType.Less)); criteria.Operands.Add(new BinaryOperator("Vendita.Postazione.Oid", Program.Postazione.Oid)); XPCollection <Stampa> stampe = new XPCollection <Stampa>(ses, criteria); stampe.TopReturnedObjects = 1; if (stampe.Count > 0) { XtraReportStampa2 report = new XtraReportStampa2(); report.xpCollection1.Criteria = new BinaryOperator("Oid", stampe[0].Oid); report.ShowPrintMarginsWarning = false; report.ShowPrintStatusDialog = false; report.ExportToPdf("tmp.pdf"); } } } catch (Exception ex) { XtraMessageBox.Show( String.Format( "Errore nella procedura di servizio post logon ({0}). Riavviare il programma e riprovare.", ex.Message), "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
private static void Print(Stampa stampa) { if (stampa.TipoStampa == EnumTipoStampa.Standard) { XtraReportStampa2 report = new XtraReportStampa2(); report.xpCollection1.Criteria = new BinaryOperator("Oid", stampa.Oid); report.ShowPrintMarginsWarning = false; report.ShowPrintStatusDialog = false; if (string.IsNullOrEmpty(Program.Postazione.PrinterName)) { report.ShowPreview(); } else { report.Print(Program.Postazione.PrinterName); } } if (stampa.TipoStampa == EnumTipoStampa.Card) { XtraReportStampaMyFe report = new XtraReportStampaMyFe(); report.xpCollection1.Criteria = new BinaryOperator("Oid", stampa.Oid); report.ShowPrintMarginsWarning = false; report.ShowPrintStatusDialog = false; if (string.IsNullOrEmpty(Program.Postazione.PrinterName)) { report.ShowPreview(); } else { report.Print(Program.Postazione.PrinterName); } } if (stampa.TipoStampa == EnumTipoStampa.CardInternet) { XtraReportStampaMyFeOnline report = new XtraReportStampaMyFeOnline(); report.xpCollection1.Criteria = new BinaryOperator("Oid", stampa.Oid); report.ShowPrintMarginsWarning = false; report.ShowPrintStatusDialog = false; if (string.IsNullOrEmpty(Program.Postazione.PrinterName)) { report.ShowPreview(); } else { report.Print(Program.Postazione.PrinterName); } } if (stampa.TipoStampa == EnumTipoStampa.CardAlbergatori) { XtraReportStampaMyFeAlberghi report = new XtraReportStampaMyFeAlberghi(); report.xpCollection1.Criteria = new BinaryOperator("Oid", stampa.Oid); report.ShowPrintMarginsWarning = false; report.ShowPrintStatusDialog = false; if (string.IsNullOrEmpty(Program.Postazione.PrinterName)) { report.ShowPreview(); } else { report.Print(Program.Postazione.PrinterName); } } }