protected void SendSQL_Click(object sender, EventArgs e) { SQL_Request req = new SQL_Request().OpenConnection(); //request all assets req.GetAllData(false); //merge all assets //post merged assets as new master DB if (req.Tag != null) { var cloud = req.Tag as List <Asset>; foreach (Asset a in Global._Library.Assets) { try { var lookup = cloud.FindAssetByNumber(a.AssetNumber); if (lookup == null) { req.AddAsset(a, false); } else if (lookup.AssetNumber == a.AssetNumber) { req.UpdateData(a, false); } } catch { Notification.Text = "SQL-LINK Error"; } } Notification.Text = "SQL-LINK Complete"; } req.CloseConnection(); }
protected void SendSQL_Click(object sender, EventArgs e) { try { SQL_Request req = new SQL_Request().OpenConnection(); //request all assets req.GetAllAssets(false); //merge all assets //post merged assets as new master DB if (req.Tag != null) { var cloud = req.Tag as List <Asset>; //upload assets foreach (Asset a in Global.Library.Assets) { try { var lookup = cloud.FindAssetByNumber(a.AssetNumber); if (lookup == null) { req.AddAsset(a, false); } else if (lookup.AssetNumber == a.AssetNumber) { req.UpdateAsset(a, false); } } catch { //PopNotify("Error", "Error Pushing Library To SQL"); } } //upload settings //upload history //upload notifications //upload Calibrations } req.CloseConnection(); } catch { //PopNotify("Error", "Error Pushing Library To SQL"); } //PopNotify("Complete", "Library Pushed To SQL"); }
public static Task <bool> LibraryAsync() { return(Task.Run(() => { try { SQL_Request req = new SQL_Request().OpenConnection(); //request all assets req.GetAssets(false); //merge all assets //post merged assets as new master DB if (req.Tag != null) { var cloud = req.Tag as List <Asset>; //upload assets foreach (Asset a in Global.AssetCache) { try { var lookup = cloud.FindAssetByNumber(a.AssetNumber); if (lookup == null) { req.AddAsset(a, false); } else if (lookup.AssetNumber == a.AssetNumber) { req.UpdateAsset(a, false); } } catch { //PopNotify("Error", "Error Pushing Library To SQL"); } } } req.CloseConnection(); return true; } catch { return false; } })); }