This commit is contained in:
2022-07-03 19:40:04 +00:00
parent da74cd12bf
commit c2eb7a2da3
6 changed files with 393 additions and 33 deletions

View File

@@ -92,6 +92,12 @@
<DependentUpon>CopyableMessageBox.cs</DependentUpon>
</Compile>
<Compile Include="Integration.cs" />
<Compile Include="LinkAyaObjectToQBConfirm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LinkAyaObjectToQBConfirm.Designer.cs">
<DependentUpon>LinkAyaObjectToQBConfirm.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -196,6 +202,9 @@
<EmbeddedResource Include="CopyableMessageBox.resx">
<DependentUpon>CopyableMessageBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LinkAyaObjectToQBConfirm.resx">
<DependentUpon>LinkAyaObjectToQBConfirm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -0,0 +1,126 @@
namespace AyaNovaQBI
{
partial class LinkAyaObjectToQBConfirm
{
/// <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.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.edAyaObjects = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.edQBItem = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(550, 368);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 16;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(12, 368);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 15;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// edAyaObjects
//
this.edAyaObjects.Enabled = false;
this.edAyaObjects.Location = new System.Drawing.Point(12, 33);
this.edAyaObjects.Multiline = true;
this.edAyaObjects.Name = "edAyaObjects";
this.edAyaObjects.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.edAyaObjects.Size = new System.Drawing.Size(613, 224);
this.edAyaObjects.TabIndex = 17;
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(613, 21);
this.label1.TabIndex = 18;
this.label1.Text = "Link the following AyaNova objects:";
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(15, 279);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(610, 21);
this.label2.TabIndex = 19;
this.label2.Text = "To QuickBooks object:";
//
// edQBItem
//
this.edQBItem.Enabled = false;
this.edQBItem.Location = new System.Drawing.Point(12, 303);
this.edQBItem.Name = "edQBItem";
this.edQBItem.Size = new System.Drawing.Size(610, 20);
this.edQBItem.TabIndex = 20;
//
// LinkAyaObjectToQBConfirm
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(637, 403);
this.ControlBox = false;
this.Controls.Add(this.edQBItem);
this.Controls.Add(this.label2);
this.Controls.Add(this.edAyaObjects);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "LinkAyaObjectToQBConfirm";
this.Text = "Link AyaNova object(s)";
this.Load += new System.EventHandler(this.LinkAyaObjectToQBConfirm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TextBox edAyaObjects;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox edQBItem;
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Windows.Forms;
namespace AyaNovaQBI
{
public partial class LinkAyaObjectToQBConfirm : Form
{
public LinkAyaObjectToQBConfirm()
{
InitializeComponent();
}
public string AyaItems { set { this.edAyaObjects.Text = value; } }
public string QBItem { set { this.edQBItem.Text = value; } }
private void LinkAyaObjectToQBConfirm_Load(object sender, EventArgs e)
{
btnCancel.Text = util.AyaTranslations["Cancel"];
btnOK.Text = util.AyaTranslations["OK"];
}
}
}

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

@@ -61,30 +61,6 @@ namespace AyaNovaQBI
private void mapSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (gridAya.SelectedRows.Count == 0) return;
//we have selection now get qb item
MapSelectQBItem s = new MapSelectQBItem();
s.QBItems = _qb;
string SelectedQBItem = string.Empty;
if (s.ShowDialog() == DialogResult.Cancel)
return;
else
SelectedQBItem = s.SelectedQBItem;
s.Dispose();
var selectedAyaNovaIndexes = new List<long>();
foreach (DataGridViewRow r in gridAya.SelectedRows)
{
selectedAyaNovaIndexes.Add((long)r.Cells[0].Value);
}
//todo: here we need to update the linking (and save right away or wait??)
var v = SelectedQBItem;
}
private void importSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
@@ -93,7 +69,113 @@ namespace AyaNovaQBI
private void linkSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
bool IsAyaGrid = false;
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
IsAyaGrid = gridAya.SelectedRows.Count > 0;
if (IsAyaGrid)
{
//we have selection now get qb item
MapSelectQBItem s = new MapSelectQBItem();
s.QBItems = _qb;
string SelectedQBItem = string.Empty;
if (s.ShowDialog() == DialogResult.Cancel)
return;
else
SelectedQBItem = s.SelectedQBItem.ToString();
s.Dispose();
var selectedAyaNovaIds = new List<long>();
foreach (DataGridViewRow r in gridAya.SelectedRows)
{
selectedAyaNovaIds.Add((long)r.Cells[0].Value);
}
//todo: here we need to update the linking (and save right away or wait??)
//#################################
//LINKING
//LinkAyaObjectToQBConfirm d = new LinkAyaObjectToQBConfirm();
//d.ToLabel = "To QuickBooks object:\r\n" + rowdrop.Cells["Name"].Value.ToString();
//DataTable dtTemp = new DataTable();
//dtTemp.Columns.Add("Name", typeof(string));
//foreach (object o in moveData.Rows)
//{
// dtTemp.Rows.Add(new object[] { ((AyaNameID)o).Name });
//}
//d.DTRows = dtTemp;
//if (d.ShowDialog() != DialogResult.OK) return;
////
//// QBNameID q=(QBNameID)moveData.Rows[0];
//// if(MessageBox.Show(
//// "Link the AyaNova object(s): " + q.Name + "\r\n" +
//// "to the QuickBooks object: " + + "\r\n\r\n" +
//// "Are you sure?","Link QuickBooks object",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
//// ==DialogResult.No) return;
////ok, link away...
//foreach (object o in moveData.Rows)
//{
// //qb listid
// string dropID = rowdrop.Cells["ID"].Value.ToString();
// string dropName = rowdrop.Cells["Name"].Value.ToString();
// IntegrationMap m = null;
// //Is AyaNova object already mapped?
// if (Util.QBI.Maps.Contains(((AyaNameID)o).ID))
// {
// //Get the mapping
// m = Util.QBI.Maps[((AyaNameID)o).ID];
// //Is it already linked to the selected qb object?
// //Yes so do nothing and continue on to the next object
// if (m.ForeignID == dropID)
// continue;
// else
// {
// //No, AyaNova object was mapped elsewhere, prompt user if this is ok
// if (MessageBox.Show(
// "AyaNova object: " + ((AyaNameID)o).Name + "\r\n" +
// "Is already linked to QuickBooks object: " + m.Name + "\r\n" +
// "Do you really want to change the link to the QuickBooks object: " + dropName + "\r\n",
// "Change link?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
// == DialogResult.No) continue;
// }
// //If we're here it's because the object is already mapped
// //but the users has signified they want to change the map to another object so...
// m.ForeignID = dropID;
// m.Name = rowdrop.Cells["Name"].Value.ToString();
// m.LastSync = System.DateTime.Now;
// }
// else
// {
// //not already present, so add it, easy peasy...
// m = Util.QBI.Maps.Add(Util.QBI);
// m.RootObjectID = ((AyaNameID)o).ID;
// m.RootObjectType = _Type;
// m.ForeignID = dropID;
// m.Name = dropName;
// m.LastSync = System.DateTime.Now;
// }
//}
//Util.QBI = (Integration)Util.QBI.Save();
Initialize();
//#################################
}
else
{
}
}
@@ -404,7 +486,7 @@ namespace AyaNovaQBI
_Type = AyaType.Part;
this.Text = "Map / Import - Parts";
Initialize();
if (!util.QBIntegration.Items.Any(z=>z.AType==AyaType.Vendor))
if (!util.QBIntegration.Items.Any(z => z.AType == AyaType.Vendor))
{
MessageBox.Show(
"If you plan on importing QuickBooks items into AyaNova parts\r\n" +

View File

@@ -17,12 +17,13 @@ namespace AyaNovaQBI
InitializeComponent();
}
public string SelectedQBItem => cbQBItems.SelectedValue.ToString();
// public string SelectedQBItemName => cbQBItems.selected.ToString();
public DataTable QBItems { get; set; }
private void MapSelectQBItem_Load(object sender, EventArgs e)
{
cbQBItems.DataSource = QBItems;
cbQBItems.DisplayMember = "FullName";
cbQBItems.ValueMember = "ID";
//cbQBItems.ValueMember = "ID";
btnCancel.Text = util.AyaTranslations["Cancel"];
btnOK.Text = util.AyaTranslations["OK"];
}