This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -366,7 +448,7 @@ namespace AyaNovaQBI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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" +
|
||||
@@ -506,7 +588,7 @@ namespace AyaNovaQBI
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void gridQB_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
@@ -516,7 +598,7 @@ namespace AyaNovaQBI
|
||||
private void gridQB_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
var hasSelection = gridQB.SelectedRows.Count > 0;
|
||||
|
||||
|
||||
if (hasSelection)
|
||||
gridAya.ClearSelection();
|
||||
}
|
||||
@@ -524,13 +606,13 @@ namespace AyaNovaQBI
|
||||
private void gridAya_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
var hasSelection = gridAya.SelectedRows.Count > 0;
|
||||
|
||||
|
||||
if (hasSelection)
|
||||
gridQB.ClearSelection();
|
||||
gridQB.ClearSelection();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user