Пример #1
0
 private void m_lnkSupprimerReleves_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (MessageBox.Show(I.T("Delete @1 survey(s)|20039", m_wndListeReleves.CheckedItems.Count.ToString() + " ?"),
                         "",
                         MessageBoxButtons.YesNo,
                         MessageBoxIcon.Question) == DialogResult.Yes)
     {
         foreach (ListViewItem item in m_wndListeReleves.CheckedItems)
         {
             CReleveSite rel = item.Tag as CReleveSite;
             if (rel != null)
             {
                 rel.ClearRelevesEquipements();
                 CResultAErreur result = rel.Delete();
                 if (!result)
                 {
                     CFormAlerte.Afficher(result.Erreur);
                     break;
                 }
             }
         }
         CTimosInventoryDb.GetInventaireDatas().AcceptChanges();
         CTimosInventoryDb.SetDbInventaire(CTimosInventoryDb.GetInventaireDatas());
         InitListeReleves();
     }
 }
Пример #2
0
        private void m_lnkEnvoyerReleves_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DateTime           dt         = DateTime.Now;
            List <CReleveSite> lstReleves = new List <CReleveSite>();

            foreach (ListViewItem item in m_wndListeReleves.CheckedItems)
            {
                CReleveSite rel = item.Tag as CReleveSite;
                if (rel != null)
                {
                    lstReleves.Add(rel);
                }
            }
            List <CReleveSite> lstTransmitted = new List <CReleveSite>();

            CFormWaiting.DoWork((DoWorkDelegate) delegate(CFormWaiting waiter)
            {
                waiter.ReportProgress(I.T("Connecting to Timos|20009"));
                InventoryService.InventoryService service = new TimosInventory.InventoryService.InventoryService();
                service.Url = CTimosInventoryRegistre.TimosServiceURL;

                int nIdSession;
                try
                {
                    nIdSession = service.OpenSession();

                    foreach (CReleveSite releve in lstReleves)
                    {
                        if (releve != null)
                        {
                            CMemoryDb db          = new CMemoryDb();
                            db.EnforceConstraints = false;
                            db.ImporteObjet(releve, true, false);
                            waiter.ReportProgress(I.T("Send survey @1|20038",
                                                      releve.Site.Libelle));
                            bool bResult = service.SendSurvey(nIdSession, db);
                            if (bResult)
                            {
                                lstTransmitted.Add(releve);
                            }
                        }
                    }
                    foreach (CReleveSite releve in lstTransmitted)
                    {
                        releve.ClearRelevesEquipements();
                        releve.Delete();
                    }
                    service.CloseSession(nIdSession);
                    TimeSpan sp = DateTime.Now - dt;
                    Console.WriteLine("Transmission relevé : " + sp.TotalMilliseconds);
                }
                catch
                {
                }
            });
            CTimosInventoryDb.SetDbInventaire(CTimosInventoryDb.GetInventaireDatas());
            if (lstTransmitted.Count != lstReleves.Count)
            {
                CFormAlerte.Afficher(I.T("Due to unknown error, Some surveys could not be send|20043"));
            }


            InitListeReleves();
        }
Пример #3
0
 //--------------------------------------------------------------
 private void SaveDatas()
 {
     m_panelEquipements.MajChamps();
     CTimosInventoryDb.SetDbInventaire(CTimosInventoryDb.GetInventaireDatas());
 }