//------------------------------------------------------------------- private void RecupereListeSites(CFormWaiting waiter) { try { waiter.ReportProgress(I.T("Connecting to Timos|20009")); InventoryService.InventoryService service = new TimosInventory.InventoryService.InventoryService(); service.Url = CTimosInventoryRegistre.TimosServiceURL; int nIdSession = service.OpenSession(); if (nIdSession < 0) { waiter.ShowError(I.T("Can not open distant session|20001")); return; } waiter.ReportProgress(I.T("Import site list...|20010")); DataSet ds = service.GetReferencesSites(nIdSession); service.CloseSession(nIdSession); CMemoryDb db = CMemoryDb.FromDataSet(ds); m_dbDeconnectee = db; UpdateArbre(waiter); } catch (Exception e) { waiter.ShowError(I.T("Error while transfering data|20008")); return; } finally { } }
public bool SendSurvey(int nIdSession, DataSet ds) { C2iSessionInventaire session = GetSessionWeb(nIdSession) as C2iSessionInventaire; if (session == null) { return(false); } CMemoryDb db = CMemoryDb.FromDataSet(ds); CResultAErreur result = CInventoryConvertor.IntegreReleves(session, db); return(result.Result); }
//------------------------------------------------------------------- private void m_btnCreerBase_Click(object sender, EventArgs e) { bool bMajOk = false; CFormWaiting.DoWork((DoWorkDelegate) delegate(CFormWaiting waiter) { List <int> lstIds = new List <int>(); foreach (TreeNode node in CheckedNodes()) { CSite site = node.Tag as CSite; if (site != null && site.IdTimos != null) { lstIds.Add(site.IdTimos.Value); } } if (lstIds.Count == 0) { waiter.ShowError(I.T("You should select sites you want to import|20004")); return; } try { waiter.ReportProgress(I.T("Connecting to Timos|20009")); InventoryService.InventoryService service = new TimosInventory.InventoryService.InventoryService(); service.Url = CTimosInventoryRegistre.TimosServiceURL; int nIdSession = service.OpenSession(); if (nIdSession < 0) { waiter.ShowError(I.T("Can not open distant session|20001")); return; } DateTime dt = DateTime.Now; waiter.ReportProgress(I.T("Updating configuration data|20015")); DataSet ds = service.GetBaseConfig(nIdSession); CMemoryDb db = CMemoryDb.FromDataSet(ds); waiter.ReportProgress(I.T("Importing @1 site(s)|20011", lstIds.Count.ToString())); ds = service.GetSites(nIdSession, lstIds.ToArray()); db.EnforceConstraints = false; ds.EnforceConstraints = false; CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CSite.c_nomTable], db); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CParametrageSystemeCoordonnees.c_nomTable], db); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CParametrageNiveau.c_nomTable], db); CListeEntitesDeMemoryDb <CSite> lstSites = new CListeEntitesDeMemoryDb <CSite>(db); foreach (CSite site in lstSites) { if (site.IdTimos != null) { waiter.ReportProgress(I.T("Import site @1 details|20016", site.Libelle)); ds = service.GetEquipments(nIdSession, site.IdTimos.Value); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CEquipement.c_nomTable], db); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CParametrageSystemeCoordonnees.c_nomTable], db); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CParametrageNiveau.c_nomTable], db); CImporteurDataTimos.IntegreTableDepuisTimos(ds.Tables[CRelationEquipementChampCustom.c_nomTable], db); } } db.EnforceConstraints = true; service.CloseSession(nIdSession); TimeSpan sp = DateTime.Now - dt; Console.WriteLine("Récupère sites : " + sp.TotalMilliseconds); CTimosInventoryDb.SetDbTimos(db); CTimosInventoryRegistre.DateDonneesTimos = DateTime.Now; bMajOk = true; } catch (Exception ex) { waiter.ShowError(ex.ToString()); return; } finally { } }); if (bMajOk) { Close(); } }