Esempio n. 1
0
        private async void PrivewDoucmentPrinter_Click(object sender, RoutedEventArgs e)
        {
            if (IS_SELECTED)
            {
                if (PrintHelper.Print.IsMounth_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (PrintHelper.Print.IsYear_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (PrintHelper.Print.IsDay_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (!PrintHelper.Print.IsDay_ &&
                         !PrintHelper.Print.IsMounth_ &&
                         !PrintHelper.Print.IsYear_)
                {
                    SYear();
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
            }
            else if (!is_Repair_Selected)
            {
                XtraReport1 report            = new XtraReport1();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();
            }

            if (is_Repair_Selected)
            {
                if (Encode1.Text == "/d")
                {
                    NewModel(type_of_date.day);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = true;
                    PrintHelper.Print.IsYear_   = false;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (Encode1.Text == "/m")
                {
                    NewModel(type_of_date.month);
                    PrintHelper.Print.IsMounth_ = true;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (Encode1.Text == "/y")
                {
                    NewModel(type_of_date.year);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = true;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (String.IsNullOrEmpty(Encode1.Text))
                {
                    NewModel(type_of_date.year);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = true;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else
                {
                    //later
                }
            }
        }