From 064611aba341aeed5b7cf1255de37999df6e55e6 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 20 Mar 2023 12:07:13 +0100 Subject: [PATCH] 20-03-2023 --- ReportViewer/ReportDataLoader.cs | 24 +++--- ReportViewer/frmMain.Designer.cs | 47 ++++++----- ReportViewer/frmMain.cs | 17 +++- ReportViewer/frmMain.resx | 4 +- ReportViewer/frmWaitForm.Designer.cs | 92 ++++++++++++++++++++ ReportViewer/frmWaitForm.cs | 43 ++++++++++ ReportViewer/frmWaitForm.resx | 120 +++++++++++++++++++++++++++ 7 files changed, 309 insertions(+), 38 deletions(-) create mode 100644 ReportViewer/frmWaitForm.Designer.cs create mode 100644 ReportViewer/frmWaitForm.cs create mode 100644 ReportViewer/frmWaitForm.resx diff --git a/ReportViewer/ReportDataLoader.cs b/ReportViewer/ReportDataLoader.cs index c352bd0..9caaa6d 100644 --- a/ReportViewer/ReportDataLoader.cs +++ b/ReportViewer/ReportDataLoader.cs @@ -149,6 +149,14 @@ namespace ReportViewer private static SqlCommand GetSQLCommand(DateTime? date) { var cmd = new SqlCommand(); + var dateConstraint = ""; + + if (date != null) + { + cmd.Parameters.Add("DATE", SqlDbType.DateTime).Value = date; + dateConstraint = " AND c029 = '@DATE' "; + } + var baseSQL = "SELECT " + "c010, " + "c012, " + @@ -163,19 +171,11 @@ namespace ReportViewer "STRING_AGG(u047, CHAR(13)) AS u047 " + "FROM t025 " + "WHERE c044 IS NOT NULL AND c045 IS NOT NULL AND U047 IS NOT NULL " + - "AND NOT (c023 = 'L' AND c024 = 'L' AND c025 = 'L' AND c026 = 'L')" + + "AND NOT (c023 = 'L' AND c024 = 'L' AND c025 = 'L' AND c026 = 'L') " + + dateConstraint + "GROUP BY c010, c012, c013, c014, c017, c029, c044, c089, c154"; - - if (date != null) - { - cmd.CommandText = baseSQL + " AND c029 = '@DATE'"; - cmd.Parameters.Add("DATE", SqlDbType.DateTime).Value = date; - } - else - { - cmd.CommandText = baseSQL; - } - + + cmd.CommandText = baseSQL; return cmd; } diff --git a/ReportViewer/frmMain.Designer.cs b/ReportViewer/frmMain.Designer.cs index 9188e4a..a6987fd 100644 --- a/ReportViewer/frmMain.Designer.cs +++ b/ReportViewer/frmMain.Designer.cs @@ -50,16 +50,17 @@ ribbonStatusBar = new DevExpress.XtraBars.Ribbon.RibbonStatusBar(); sidePanel1 = new DevExpress.XtraEditors.SidePanel(); layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); - dateEdit1 = new DevExpress.XtraEditors.DateEdit(); + dateEditDate = new DevExpress.XtraEditors.DateEdit(); Root = new DevExpress.XtraLayout.LayoutControlGroup(); layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); documentViewer1 = new DevExpress.XtraPrinting.Preview.DocumentViewer(); + splashScreenManager1 = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(frmWaitForm), true, true); ((System.ComponentModel.ISupportInitialize)ribbon).BeginInit(); sidePanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dateEdit1.Properties.CalendarTimeProperties).BeginInit(); - ((System.ComponentModel.ISupportInitialize)dateEdit1.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dateEditDate.Properties.CalendarTimeProperties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dateEditDate.Properties).BeginInit(); ((System.ComponentModel.ISupportInitialize)Root).BeginInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem1).BeginInit(); SuspendLayout(); @@ -152,7 +153,7 @@ // txtOrdersLoaded.Caption = "{0} Aufträge geladen"; txtOrdersLoaded.Id = 9; - txtOrdersLoaded.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barStaticItem1.ImageOptions.SvgImage"); + txtOrdersLoaded.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("txtOrdersLoaded.ImageOptions.SvgImage"); txtOrdersLoaded.Name = "txtOrdersLoaded"; txtOrdersLoaded.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; txtOrdersLoaded.Tag = "{0} Aufträge geladen"; @@ -162,8 +163,9 @@ // txtNoOrdersLoaded.Caption = "Keine Aufträge gefunden!"; txtNoOrdersLoaded.Id = 10; - txtNoOrdersLoaded.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barStaticItem2.ImageOptions.SvgImage"); + txtNoOrdersLoaded.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("txtNoOrdersLoaded.ImageOptions.SvgImage"); txtNoOrdersLoaded.Name = "txtNoOrdersLoaded"; + txtNoOrdersLoaded.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; txtNoOrdersLoaded.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; // // ribbonPage1 @@ -233,7 +235,7 @@ // // layoutControl1 // - layoutControl1.Controls.Add(dateEdit1); + layoutControl1.Controls.Add(dateEditDate); layoutControl1.Dock = DockStyle.Fill; layoutControl1.Location = new Point(0, 0); layoutControl1.Name = "layoutControl1"; @@ -242,17 +244,17 @@ layoutControl1.TabIndex = 0; layoutControl1.Text = "layoutControl1"; // - // dateEdit1 + // dateEditDate // - dateEdit1.EditValue = null; - dateEdit1.Location = new Point(12, 28); - dateEdit1.MenuManager = ribbon; - dateEdit1.Name = "dateEdit1"; - dateEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); - dateEdit1.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); - dateEdit1.Size = new Size(173, 20); - dateEdit1.StyleController = layoutControl1; - dateEdit1.TabIndex = 4; + dateEditDate.EditValue = null; + dateEditDate.Location = new Point(12, 28); + dateEditDate.MenuManager = ribbon; + dateEditDate.Name = "dateEditDate"; + dateEditDate.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + dateEditDate.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + dateEditDate.Size = new Size(173, 20); + dateEditDate.StyleController = layoutControl1; + dateEditDate.TabIndex = 4; // // Root // @@ -265,7 +267,7 @@ // // layoutControlItem1 // - layoutControlItem1.Control = dateEdit1; + layoutControlItem1.Control = dateEditDate; layoutControlItem1.Location = new Point(0, 0); layoutControlItem1.Name = "layoutControlItem1"; layoutControlItem1.Size = new Size(177, 351); @@ -282,6 +284,10 @@ documentViewer1.Size = new Size(792, 371); documentViewer1.TabIndex = 3; // + // splashScreenManager1 + // + splashScreenManager1.ClosingDelay = 500; + // // FrmMain // AutoScaleDimensions = new SizeF(6F, 13F); @@ -301,8 +307,8 @@ sidePanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)layoutControl1).EndInit(); layoutControl1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)dateEdit1.Properties.CalendarTimeProperties).EndInit(); - ((System.ComponentModel.ISupportInitialize)dateEdit1.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)dateEditDate.Properties.CalendarTimeProperties).EndInit(); + ((System.ComponentModel.ISupportInitialize)dateEditDate.Properties).EndInit(); ((System.ComponentModel.ISupportInitialize)Root).EndInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem1).EndInit(); ResumeLayout(false); @@ -319,7 +325,7 @@ private DevExpress.XtraPrinting.Preview.DocumentViewer documentViewer1; private DevExpress.XtraBars.BarButtonItem barButtonItem1; private DevExpress.XtraLayout.LayoutControl layoutControl1; - private DevExpress.XtraEditors.DateEdit dateEdit1; + private DevExpress.XtraEditors.DateEdit dateEditDate; private DevExpress.XtraLayout.LayoutControlGroup Root; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; private DevExpress.XtraBars.BarCheckItem checkHP; @@ -336,5 +342,6 @@ private DevExpress.XtraBars.BarButtonItem barButtonItem3; private DevExpress.XtraBars.BarStaticItem txtOrdersLoaded; private DevExpress.XtraBars.BarStaticItem txtNoOrdersLoaded; + private DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager1; } } \ No newline at end of file diff --git a/ReportViewer/frmMain.cs b/ReportViewer/frmMain.cs index 9a2fc54..9915c67 100644 --- a/ReportViewer/frmMain.cs +++ b/ReportViewer/frmMain.cs @@ -1,6 +1,7 @@ using DigitalData.Modules.Logging; using DigitalData.Modules.Config; using DigitalData.Modules.Database; +using Microsoft.VisualBasic; namespace ReportViewer { @@ -33,6 +34,7 @@ namespace ReportViewer try { formLoading = true; + dateEditDate.EditValue = DateTime.Now; configManager = new ConfigManager(logConfig, Application.UserAppDataPath); database = new MSSQLServer(logConfig, configManager.Config.ConnectionString); @@ -60,6 +62,8 @@ namespace ReportViewer { try { + splashScreenManager1.ShowWaitForm(); + Config.ServiceProvider provider = null; if (loader == null) @@ -82,8 +86,8 @@ namespace ReportViewer DateTime? date = null; - if (dateEdit1.EditValue != null) - date = (DateTime)dateEdit1.EditValue; + if (dateEditDate.EditValue != null) + date = (DateTime)dateEditDate.EditValue; loader.Load(date, provider); barButtonItem2.Enabled = true; @@ -93,17 +97,22 @@ namespace ReportViewer txtOrdersLoaded.Caption = string.Format((string)txtOrdersLoaded.Tag, loader.OrdersLoaded); txtOrdersLoaded.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; txtNoOrdersLoaded.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; - } + } else { txtOrdersLoaded.Caption = string.Format((string)txtOrdersLoaded.Tag, loader.OrdersLoaded); txtOrdersLoaded.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; txtNoOrdersLoaded.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; - } + } } catch (Exception ex) { logger.Error(ex); + MessageBox.Show("Unbehandelter Fehler: " + ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + finally + { + splashScreenManager1.CloseWaitForm(); } } diff --git a/ReportViewer/frmMain.resx b/ReportViewer/frmMain.resx index 7f6d502..321e7c4 100644 --- a/ReportViewer/frmMain.resx +++ b/ReportViewer/frmMain.resx @@ -228,7 +228,7 @@ MS44LDQsNGgtNGw2LDZsNi02SDI4eiIgY2xhc3M9IkdyZWVuIiAvPg0KPC9zdmc+Cw== - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIyLjEsIFZlcnNpb249MjIuMS40 LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -246,7 +246,7 @@ ZWVuIiAvPg0KICA8L2c+DQo8L3N2Zz4L - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIyLjEsIFZlcnNpb249MjIuMS40 LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl diff --git a/ReportViewer/frmWaitForm.Designer.cs b/ReportViewer/frmWaitForm.Designer.cs new file mode 100644 index 0000000..daefa16 --- /dev/null +++ b/ReportViewer/frmWaitForm.Designer.cs @@ -0,0 +1,92 @@ +namespace ReportViewer +{ + partial class frmWaitForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.progressPanel1 = new DevExpress.XtraWaitForm.ProgressPanel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // progressPanel1 + // + this.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent; + this.progressPanel1.Appearance.Options.UseBackColor = true; + this.progressPanel1.AppearanceCaption.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.progressPanel1.AppearanceCaption.Options.UseFont = true; + this.progressPanel1.AppearanceDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.progressPanel1.AppearanceDescription.Options.UseFont = true; + this.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.progressPanel1.ImageHorzOffset = 20; + this.progressPanel1.Location = new System.Drawing.Point(0, 17); + this.progressPanel1.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.progressPanel1.Name = "progressPanel1"; + this.progressPanel1.Size = new System.Drawing.Size(246, 39); + this.progressPanel1.TabIndex = 0; + this.progressPanel1.Text = "progressPanel1"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent; + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.progressPanel1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 14, 0, 14); + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(246, 73); + this.tableLayoutPanel1.TabIndex = 1; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ClientSize = new System.Drawing.Size(246, 73); + this.Controls.Add(this.tableLayoutPanel1); + this.DoubleBuffered = true; + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "Form1"; + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + } + + #endregion + + private DevExpress.XtraWaitForm.ProgressPanel progressPanel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + } +} diff --git a/ReportViewer/frmWaitForm.cs b/ReportViewer/frmWaitForm.cs new file mode 100644 index 0000000..60f8068 --- /dev/null +++ b/ReportViewer/frmWaitForm.cs @@ -0,0 +1,43 @@ +using DevExpress.XtraWaitForm; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace ReportViewer +{ + public partial class frmWaitForm : WaitForm + { + public frmWaitForm() + { + InitializeComponent(); + this.progressPanel1.AutoHeight = true; + } + + #region Overrides + + public override void SetCaption(string caption) + { + base.SetCaption(caption); + this.progressPanel1.Caption = caption; + } + public override void SetDescription(string description) + { + base.SetDescription(description); + this.progressPanel1.Description = description; + } + public override void ProcessCommand(Enum cmd, object arg) + { + base.ProcessCommand(cmd, arg); + } + + #endregion + + public enum WaitFormCommand + { + } + } +} \ No newline at end of file diff --git a/ReportViewer/frmWaitForm.resx b/ReportViewer/frmWaitForm.resx new file mode 100644 index 0000000..9d1fc38 --- /dev/null +++ b/ReportViewer/frmWaitForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file