This commit is contained in:
@@ -73,6 +73,7 @@ namespace AyaNovaQBI
|
||||
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
|
||||
|
||||
IsAyaGrid = gridAya.SelectedRows.Count > 0;
|
||||
bool SaveIntegration = false;
|
||||
|
||||
if (IsAyaGrid)
|
||||
{
|
||||
@@ -119,8 +120,6 @@ namespace AyaNovaQBI
|
||||
IntegrationItem m = util.QBIntegration.Items.FirstOrDefault(z => z.Id == AyaId && z.AType == _Type);
|
||||
if (m != null)
|
||||
{
|
||||
|
||||
|
||||
//Is it already linked to the selected qb object?
|
||||
|
||||
//Yes so do nothing and continue on to the next object
|
||||
@@ -139,22 +138,38 @@ namespace AyaNovaQBI
|
||||
|
||||
//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.IntegrationItemId = QBItemId;
|
||||
m.IntegrationItemName = QBItemName;
|
||||
m.LastSync = System.DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(QBItemId))//confirm not a removal
|
||||
{
|
||||
m.IntegrationItemId = QBItemId;
|
||||
m.IntegrationItemName = QBItemName;
|
||||
m.LastSync = System.DateTime.Now;
|
||||
SaveIntegration = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//user is removing mapping so remove the integrationitem entirely from the collection
|
||||
util.QBIntegration.Items.Remove(m);
|
||||
SaveIntegration = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//not already present, so add it, easy peasy...
|
||||
m = new IntegrationItem { AType = _Type, IntegrationItemName = QBItemName, IntegrationItemId = QBItemId, LastSync = System.DateTime.Now, ObjectId = AyaId };
|
||||
util.QBIntegration.Items.Add(m);
|
||||
if (!string.IsNullOrEmpty(QBItemId))//confirm not a removal
|
||||
{
|
||||
//not already present, so add it, easy peasy...
|
||||
m = new IntegrationItem { AType = _Type, IntegrationItemName = QBItemName, IntegrationItemId = QBItemId, LastSync = System.DateTime.Now, ObjectId = AyaId };
|
||||
util.QBIntegration.Items.Add(m);
|
||||
SaveIntegration = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
if (SaveIntegration)
|
||||
{
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
//#################################
|
||||
}
|
||||
|
||||
15
AyaNovaQBI/MapSelectQBItem.Designer.cs
generated
15
AyaNovaQBI/MapSelectQBItem.Designer.cs
generated
@@ -32,6 +32,7 @@
|
||||
this.cbQBItems = new System.Windows.Forms.ComboBox();
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.ckNothing = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@@ -74,12 +75,24 @@
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// ckNothing
|
||||
//
|
||||
this.ckNothing.AutoSize = true;
|
||||
this.ckNothing.Location = new System.Drawing.Point(16, 56);
|
||||
this.ckNothing.Name = "ckNothing";
|
||||
this.ckNothing.Size = new System.Drawing.Size(80, 17);
|
||||
this.ckNothing.TabIndex = 15;
|
||||
this.ckNothing.Text = "checkBox1";
|
||||
this.ckNothing.UseVisualStyleBackColor = true;
|
||||
this.ckNothing.CheckedChanged += new System.EventHandler(this.ckNothing_CheckedChanged);
|
||||
//
|
||||
// MapSelectQBItem
|
||||
//
|
||||
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(747, 150);
|
||||
this.Controls.Add(this.ckNothing);
|
||||
this.Controls.Add(this.btnOK);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.cbQBItems);
|
||||
@@ -91,6 +104,7 @@
|
||||
this.Text = "QB Items";
|
||||
this.Load += new System.EventHandler(this.MapSelectQBItem_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -100,5 +114,6 @@
|
||||
private System.Windows.Forms.ComboBox cbQBItems;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.CheckBox ckNothing;
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,29 @@ namespace AyaNovaQBI
|
||||
InitializeComponent();
|
||||
}
|
||||
public ComboBox SelectCombo => cbQBItems;
|
||||
public string SelectedQBItemName => ((DataRowView)cbQBItems.SelectedItem).Row[0].ToString();
|
||||
public string SelectedQBItemId => ((DataRowView)cbQBItems.SelectedItem).Row[1].ToString();
|
||||
public string SelectedQBItemName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ckNothing.Checked) return "<nothing / remove link>";
|
||||
return ((DataRowView)cbQBItems.SelectedItem).Row[0].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedQBItemId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ckNothing.Checked) return string.Empty;
|
||||
return ((DataRowView)cbQBItems.SelectedItem).Row[1].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public DataTable QBItems { get; set; }
|
||||
private void MapSelectQBItem_Load(object sender, EventArgs e)
|
||||
{
|
||||
cbQBItems.DataSource = QBItems;
|
||||
|
||||
cbQBItems.DisplayMember = "name";
|
||||
cbQBItems.ValueMember = "id";
|
||||
btnCancel.Text = util.AyaTranslations["Cancel"];
|
||||
@@ -40,5 +57,10 @@ namespace AyaNovaQBI
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ckNothing_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
cbQBItems.Enabled = !ckNothing.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user