Exemplo n.º 1
0
 //-------------------------------------------------------------------
 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
     {
     }
 }
Exemplo n.º 2
0
        //-------------------------------------------------------------------
        public void UpdateArbre(CFormWaiting waiter)
        {
            if (m_dbDeconnectee == null)
            {
                RecupereListeSites(waiter);
            }
            if (m_dbDeconnectee == null)
            {
                return;
            }
            waiter.ReportProgress(I.T("Loading data...|20012"));
            CListeEntitesDeMemoryDb <CSite> lstSites = new CListeEntitesDeMemoryDb <CSite>(m_dbDeconnectee);

            lstSites.Filtre = new CFiltreMemoryDb(CSite.c_champIdSiteParent + " is null");
            lstSites.Sort   = CSite.c_champLibelle;
            Invoke((MethodInvoker) delegate
            {
                m_arbreSites.BeginUpdate();
                m_arbreSites.Nodes.Clear();
            });
            List <TreeNode> lstNodes = new List <TreeNode>();

            foreach (CSite site in lstSites)
            {
                TreeNode node = CreateNodeSite(site);
                lstNodes.Add(node);
            }
            Invoke((MethodInvoker) delegate
            {
                m_arbreSites.Nodes.AddRange(lstNodes.ToArray());
                m_arbreSites.EndUpdate();
            });
        }