diff --git a/AyaNovaQBI/Map.cs b/AyaNovaQBI/Map.cs index c14f7ca..6b465d2 100644 --- a/AyaNovaQBI/Map.cs +++ b/AyaNovaQBI/Map.cs @@ -35,21 +35,21 @@ namespace AyaNovaQBI _aya = new DataTable("AyaNova"); _aya.Columns.Add("name", typeof(string)); - _aya.Columns.Add("linked", typeof(bool)); _aya.Columns.Add("id", typeof(long)); + _aya.Columns.Add("linked", typeof(bool)); + //Case 339 _aya.DefaultView.Sort = "name asc"; gridAya.DataSource = _aya; _qb = new DataTable("QuickBooks"); _qb.Columns.Add("name", typeof(string)); - _qb.Columns.Add("linked", typeof(bool)); _qb.Columns.Add("id", typeof(string)); + _qb.Columns.Add("linked", typeof(bool)); //Case 339 _qb.DefaultView.Sort = "name asc"; gridQB.DataSource = _qb; - } private void Map_Load(object sender, EventArgs e) @@ -91,7 +91,7 @@ namespace AyaNovaQBI _aya.Rows.Clear(); _qb.Rows.Clear(); - _qb.Rows.Add(new object[] { string.Empty, "- nothing / not mapped -" }); + //Case 147 updateAyaNovaPricesToolStripMenuItem.Visible = false; @@ -103,6 +103,29 @@ namespace AyaNovaQBI #region client + /* + foreach(ClientPickList.ClientPickListInfo i in Util.AyaClientList) + { + if(i.Active) + { + bool bLinked=Util.QBI.Maps.Contains(i.ID); + if(DisplayRow(bLinked)) + _aya.Rows.Add(new object[] {i.ID,i.Name,bLinked}); + + } + } + + //Fill QB table with QB Customers from prefetched table + foreach(DataRow dr in Util.QBClients.Rows) + { + bool bLinked=Util.QBI.Maps.Contains(dr["ID"].ToString(),RootObjectTypes.Client); + if(DisplayRow(bLinked)) + _qb.Rows.Add(new object[] {dr["ID"].ToString(),dr["FullName"].ToString(),bLinked}); + } + + */ + + foreach (var i in util.AyaClientList) { if (i.Active) @@ -115,18 +138,18 @@ namespace AyaNovaQBI { qbItem = new IntegrationItem(); } - _aya.Rows.Add(new object[] { i.Id, qbItem.IntegrationItemId, i.Name, qbItem.IntegrationItemName }); + _aya.Rows.Add(new object[] { i.Name, i.Id, bLinked }); } } } - //Fill QB table with QB Customers from prefetched table + //Fill QB table foreach (DataRow dr in util.QBClients.Rows) { - //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); - //if (DisplayRow(bLinked)) - _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() }); + bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); + if (DisplayRow(bLinked)) + _qb.Rows.Add(new object[] { dr["FullName"].ToString(), dr["ID"].ToString(), bLinked }); } #endregion client break; @@ -142,18 +165,18 @@ namespace AyaNovaQBI if (DisplayRow(bLinked)) { var qbItem = util.QBIntegration.Items.FirstOrDefault(z => z.AType == _Type && z.Id == i.Id); - _aya.Rows.Add(new object[] { i.Id, qbItem.IntegrationItemId, i.Name, qbItem.IntegrationItemName }); + _aya.Rows.Add(new object[] { i.Name, i.Id, bLinked }); } } } - //Fill QB table with QB Customers from prefetched table + //Fill QB table foreach (DataRow dr in util.QBVendors.Rows) { - //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); - //if (DisplayRow(bLinked)) - _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() }); + bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); + if (DisplayRow(bLinked)) + _qb.Rows.Add(new object[] { dr["FullName"].ToString(), dr["ID"].ToString(), bLinked }); } #endregion Vendor break; @@ -181,7 +204,7 @@ namespace AyaNovaQBI if (DisplayRow(bLinked)) { var qbItem = util.QBIntegration.Items.FirstOrDefault(z => z.AType == _Type && z.Id == i.Id); - _aya.Rows.Add(new object[] { i.Id, qbItem.IntegrationItemId, i.Name, qbItem.IntegrationItemName }); + _aya.Rows.Add(new object[] { i.Name, i.Id, bLinked }); } } @@ -192,9 +215,9 @@ namespace AyaNovaQBI { if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Service || (util.qbitemtype)dr["Type"] == util.qbitemtype.OtherCharge) { - //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); - //if (DisplayRow(bLinked)) - _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() }); + bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); + if (DisplayRow(bLinked)) + _qb.Rows.Add(new object[] { dr["FullName"].ToString(), dr["ID"].ToString(), bLinked }); } } #endregion Rate @@ -224,7 +247,7 @@ namespace AyaNovaQBI if (DisplayRow(bLinked)) { var qbItem = util.QBIntegration.Items.FirstOrDefault(z => z.AType == _Type && z.Id == i.Id); - _aya.Rows.Add(new object[] { i.Id, qbItem.IntegrationItemId, i.Name, qbItem.IntegrationItemName }); + _aya.Rows.Add(new object[] { i.Name, i.Id, bLinked }); } } @@ -235,9 +258,9 @@ namespace AyaNovaQBI { if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Service || (util.qbitemtype)dr["Type"] == util.qbitemtype.OtherCharge) { - //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); - //if (DisplayRow(bLinked)) - _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() }); + bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); + if (DisplayRow(bLinked)) + _qb.Rows.Add(new object[] { dr["FullName"].ToString(), dr["ID"].ToString(), bLinked }); } } #endregion Rate @@ -260,7 +283,7 @@ namespace AyaNovaQBI if (DisplayRow(bLinked)) { var qbItem = util.QBIntegration.Items.FirstOrDefault(z => z.AType == _Type && z.Id == i.Id); - _aya.Rows.Add(new object[] { i.Id, qbItem.IntegrationItemId, i.Name, qbItem.IntegrationItemName }); + _aya.Rows.Add(new object[] { i.Name, i.Id, bLinked }); } } @@ -271,9 +294,9 @@ namespace AyaNovaQBI { if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Inventory || (util.qbitemtype)dr["Type"] == util.qbitemtype.NonInventory || (util.qbitemtype)dr["Type"] == util.qbitemtype.Assembly) { - //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); - //if (DisplayRow(bLinked)) - _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() }); + bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString()); + if (DisplayRow(bLinked)) + _qb.Rows.Add(new object[] { dr["FullName"].ToString(), dr["ID"].ToString(), bLinked }); } } #endregion Part