diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index d87ac84..d9a2ddd 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -105,6 +105,12 @@ + + Form + + + Waiting.cs + auth.cs @@ -127,6 +133,9 @@ tfa.cs + + Waiting.cs + SettingsSingleFileGenerator diff --git a/AyaNovaQBI/Waiting.Designer.cs b/AyaNovaQBI/Waiting.Designer.cs new file mode 100644 index 0000000..01bac36 --- /dev/null +++ b/AyaNovaQBI/Waiting.Designer.cs @@ -0,0 +1,79 @@ +namespace AyaNovaQBI +{ + partial class Waiting + { + /// + /// 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.lblOps = new System.Windows.Forms.Label(); + this.lblStep = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lblOps + // + this.lblOps.Dock = System.Windows.Forms.DockStyle.Top; + this.lblOps.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblOps.Location = new System.Drawing.Point(0, 0); + this.lblOps.Name = "lblOps"; + this.lblOps.Size = new System.Drawing.Size(345, 28); + this.lblOps.TabIndex = 0; + this.lblOps.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblStep + // + this.lblStep.Dock = System.Windows.Forms.DockStyle.Top; + this.lblStep.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblStep.Location = new System.Drawing.Point(0, 28); + this.lblStep.Name = "lblStep"; + this.lblStep.Size = new System.Drawing.Size(345, 28); + this.lblStep.TabIndex = 1; + this.lblStep.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Waiting + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Window; + this.ClientSize = new System.Drawing.Size(345, 66); + this.ControlBox = false; + this.Controls.Add(this.lblStep); + this.Controls.Add(this.lblOps); + this.Cursor = System.Windows.Forms.Cursors.AppStarting; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Waiting"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Processing"; + this.TopMost = true; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lblOps; + private System.Windows.Forms.Label lblStep; + } +} \ No newline at end of file diff --git a/AyaNovaQBI/Waiting.cs b/AyaNovaQBI/Waiting.cs new file mode 100644 index 0000000..57da805 --- /dev/null +++ b/AyaNovaQBI/Waiting.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class Waiting : Form + { + public Waiting() + { + InitializeComponent(); + } + + public string Ops + { + set + { + lblOps.Text = value; + this.Refresh(); + } + } + + public string Step + { + set + { + lblStep.Text = value; + this.Refresh(); + } + } + + } +} diff --git a/AyaNovaQBI/Waiting.resx b/AyaNovaQBI/Waiting.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/Waiting.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index d66027b..74903e3 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -474,26 +474,24 @@ namespace AyaNovaQBI Cancel = 2 } - public static List GetInvoiceableItems() - { - var random = new Random(); - var l = new List(); - for (int i = 1; i < random.Next(25, 100); i++) - l.Add(new InvoiceableItem { Customer = $"Customer {random.Next(1, 5)}", Linked = random.Next(2) == 1, Project = $"project {i}", ServiceDate = DateTime.Now.ToString("g"), ServiceNumber = (40 + i).ToString(), Status = $"Waiting to be invoiced", StatusColor = "FF00FFAA", WorkorderId = 4 }); + //public static List GetInvoiceableItems() + //{ + // var random = new Random(); + // var l = new List(); + // for (int i = 1; i < random.Next(25, 100); i++) + // l.Add(new InvoiceableItem { Customer = $"Customer {random.Next(1, 5)}", Linked = random.Next(2) == 1, Project = $"project {i}", ServiceDate = DateTime.Now.ToString("g"), ServiceNumber = (40 + i).ToString(), Status = $"Waiting to be invoiced", StatusColor = "FF00FFAA", WorkorderId = 4 }); - return l.OrderBy(x => x.Customer) - .ThenBy(x => x.ServiceNumber) - .ThenBy(x => x.ServiceDate) - .ToList(); + // return l.OrderBy(x => x.Customer) + // .ThenBy(x => x.ServiceNumber) + // .ThenBy(x => x.ServiceDate) + // .ToList(); - } + //} public static async Task InitializeQBI(StringBuilder initErrors) - { - //COPY most of this code from qbi v7 becuase it has a lot of edge cases in it and it's complex and thorough, but break it into abstracted bits so can be replicated in other accounting add-on's more easily - - //This is pre-pfc block of stuff that doesn't map well from v7 qbi plugin to here so replicate it in spirit here but not much is copyable just the concepts + { + //LOGIN to v8 first auth d = new auth(); if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) @@ -507,7 +505,7 @@ namespace AyaNovaQBI } - //Get license + //LICENSED? var r = await GetAsync("license"); ALicense = r.ObjectResponse["data"]["license"].ToObject(); @@ -533,13 +531,11 @@ namespace AyaNovaQBI } //PFC - integration object check (fetch or create if not present) - //Need this early so can log any issues with other aspects if (!await IntegrationCheck(initErrors)) return false; LOG_AVAILABLE = true; - - await IntegrationLog($"PFC: AyaNova user \"{AyaNovaUserName}\" starting QBI, pre-flight check (PFC) commencing"); + await IntegrationLog($"PFC: AyaNova user \"{AyaNovaUserName}\" starting QBI session, pre-flight check (PFC) commencing"); //QB CONNECTION validation and setup try @@ -551,10 +547,7 @@ namespace AyaNovaQBI } else { - await IntegrationLog($"PFC: QB Company name= {QCompanyName}, QB Country version={QCountry}, QBVersion={QVersion}, Companyfile={QCompanyFile}"); - //once connected collect the country, version we are dealing with (Util.qbValidate) - //confirm qb is 2008 or newer and bail if not (util.qbvalidate) - //cache company name and other qb info + await IntegrationLog($"PFC: QB Company name= {QCompanyName}, QB Country version={QCountry}, QBVersion={QVersion}, Companyfile={QCompanyFile}"); //PFC - PopulateQBListCache() //PFC - PopulateAyaListCache()