This commit is contained in:
@@ -77,6 +77,7 @@ namespace AyaNovaQBI
|
||||
|
||||
if (IsAyaGrid)
|
||||
{
|
||||
#region AyaGrid
|
||||
//we have selection now get qb item
|
||||
MapSelectQBItem s = new MapSelectQBItem();
|
||||
|
||||
@@ -165,17 +166,60 @@ namespace AyaNovaQBI
|
||||
}
|
||||
}
|
||||
|
||||
if (SaveIntegration)
|
||||
{
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
//#################################
|
||||
|
||||
#endregion AyaGrid
|
||||
}
|
||||
else
|
||||
{
|
||||
#region QB GRID
|
||||
//################
|
||||
//QB GRID
|
||||
//
|
||||
|
||||
if (gridQB.SelectedRows.Count > 1)
|
||||
{
|
||||
MessageBox.Show("You can not link more than one QuickBooks\r\n" +
|
||||
"object to a single AyaNova object", "Not supported", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var QBItemName = gridQB.SelectedRows[0].Cells[0].Value.ToString();
|
||||
var QBItemId = gridQB.SelectedRows[0].Cells[1].Value.ToString();
|
||||
|
||||
MapSelectAyaNovaItem s = new MapSelectAyaNovaItem();
|
||||
s.Items = _aya;
|
||||
if (s.ShowDialog() == DialogResult.Cancel)
|
||||
return;
|
||||
|
||||
var AyaId = s.SelectedItemId;
|
||||
s.Dispose();
|
||||
|
||||
//This way is a one to one mapping so only one iteration and two potential things to do, add or change link
|
||||
//Is it already present?
|
||||
IntegrationItem m = util.QBIntegration.Items.FirstOrDefault(z => z.ObjectId == AyaId && z.AType == _Type);
|
||||
if (m != null)
|
||||
{
|
||||
m.IntegrationItemId = QBItemId;
|
||||
m.IntegrationItemName = QBItemName;
|
||||
m.LastSync = System.DateTime.Now;
|
||||
SaveIntegration = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//not already present, so add it
|
||||
m = new IntegrationItem { AType = _Type, IntegrationItemName = QBItemName, IntegrationItemId = QBItemId, LastSync = System.DateTime.Now, ObjectId = AyaId };
|
||||
util.QBIntegration.Items.Add(m);
|
||||
SaveIntegration = true;
|
||||
}
|
||||
|
||||
#endregion qb grid
|
||||
}
|
||||
|
||||
if (SaveIntegration)
|
||||
{
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,30 +592,5 @@ namespace AyaNovaQBI
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Simplified, no drag and drop just pick and choose with clicks
|
||||
* A menu to select the ayanova object type which then populates the ayanova items grid of that type showing:
|
||||
A single grid showing all ayanova items of the selected type with their name in the first column and a second column showing what they are mapped to in qb item name, easy peasy, no drag and drop
|
||||
User can select one or more items
|
||||
when one or more are selected
|
||||
a menu item appears saying "MAP Selected items" when they select they can pick a qb item of the type they want and accept in a popup dialog which also shows how many ayanova items are selected
|
||||
a menyu tiem apepars saying UNMAP selected items when they select it it removes the mapping after confirmation dialog from all selected items
|
||||
|
||||
//public static List<InvoiceableItem> GetInvoiceableItems()
|
||||
//{
|
||||
// var random = new Random();
|
||||
// var l = new List<InvoiceableItem>();
|
||||
// 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();
|
||||
|
||||
//}
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user