This commit is contained in:
2022-06-24 19:19:27 +00:00
parent 53dc74036f
commit 5dbe054880
5 changed files with 263 additions and 23 deletions

View File

@@ -105,6 +105,12 @@
<Compile Include="Timestamp.cs" /> <Compile Include="Timestamp.cs" />
<Compile Include="UserType.cs" /> <Compile Include="UserType.cs" />
<Compile Include="util.cs" /> <Compile Include="util.cs" />
<Compile Include="Waiting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Waiting.Designer.cs">
<DependentUpon>Waiting.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="auth.resx"> <EmbeddedResource Include="auth.resx">
<DependentUpon>auth.cs</DependentUpon> <DependentUpon>auth.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@@ -127,6 +133,9 @@
<EmbeddedResource Include="tfa.resx"> <EmbeddedResource Include="tfa.resx">
<DependentUpon>tfa.cs</DependentUpon> <DependentUpon>tfa.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Waiting.resx">
<DependentUpon>Waiting.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

79
AyaNovaQBI/Waiting.Designer.cs generated Normal file
View File

@@ -0,0 +1,79 @@
namespace AyaNovaQBI
{
partial class Waiting
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

39
AyaNovaQBI/Waiting.cs Normal file
View File

@@ -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();
}
}
}
}

120
AyaNovaQBI/Waiting.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -474,26 +474,24 @@ namespace AyaNovaQBI
Cancel = 2 Cancel = 2
} }
public static List<InvoiceableItem> GetInvoiceableItems() //public static List<InvoiceableItem> GetInvoiceableItems()
{ //{
var random = new Random(); // var random = new Random();
var l = new List<InvoiceableItem>(); // var l = new List<InvoiceableItem>();
for (int i = 1; i < random.Next(25, 100); i++) // 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 }); // 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) // return l.OrderBy(x => x.Customer)
.ThenBy(x => x.ServiceNumber) // .ThenBy(x => x.ServiceNumber)
.ThenBy(x => x.ServiceDate) // .ThenBy(x => x.ServiceDate)
.ToList(); // .ToList();
} //}
public static async Task<bool> InitializeQBI(StringBuilder initErrors) public static async Task<bool> 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 //LOGIN to v8 first
auth d = new auth(); auth d = new auth();
if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
@@ -507,7 +505,7 @@ namespace AyaNovaQBI
} }
//Get license //LICENSED?
var r = await GetAsync("license"); var r = await GetAsync("license");
ALicense = r.ObjectResponse["data"]["license"].ToObject<AyaNovaLicense>(); ALicense = r.ObjectResponse["data"]["license"].ToObject<AyaNovaLicense>();
@@ -533,13 +531,11 @@ namespace AyaNovaQBI
} }
//PFC - integration object check (fetch or create if not present) //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)) if (!await IntegrationCheck(initErrors))
return false; return false;
LOG_AVAILABLE = true; LOG_AVAILABLE = true;
await IntegrationLog($"PFC: AyaNova user \"{AyaNovaUserName}\" starting QBI session, pre-flight check (PFC) commencing");
await IntegrationLog($"PFC: AyaNova user \"{AyaNovaUserName}\" starting QBI, pre-flight check (PFC) commencing");
//QB CONNECTION validation and setup //QB CONNECTION validation and setup
try try
@@ -552,9 +548,6 @@ namespace AyaNovaQBI
else else
{ {
await IntegrationLog($"PFC: QB Company name= {QCompanyName}, QB Country version={QCountry}, QBVersion={QVersion}, Companyfile={QCompanyFile}"); 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
//PFC - PopulateQBListCache() //PFC - PopulateQBListCache()
//PFC - PopulateAyaListCache() //PFC - PopulateAyaListCache()