private void SearchThread(object state) { Regex regDir = CPatternMatch.Convert(m_strDirPattern); Regex regFile = CPatternMatch.Convert(m_strFilePattern); CRepertoire repSel = null; CFichier ficSel = null; CFichier fichierTrouve = null; if (m_formMain != null) { repSel = m_formMain.GetRepertoireSel(); ficSel = m_formMain.GetFichierSel(); if (repSel != null) { fichierTrouve = repSel.FindNext(true, repSel, ficSel, regDir, regFile, m_indicateurProgression); if (fichierTrouve != null) { m_formMain.SelectFichier(fichierTrouve); } } } CFormProgression.EndIndicateur(m_indicateurProgression); m_threadSearch = null; Invoke((MethodInvoker) delegate { UpdateVisuel(); }); if (fichierTrouve == null) { MessageBox.Show("Pattern not found"); } }
private void m_btnOK_Click(object sender, System.EventArgs e) { CResultAErreur result = CResultAErreur.True; IDestinationExport destination = m_panelOptionsExport.DestinationExport; if (destination == null || !destination.EstValidePourExport()) { result.EmpileErreur(I.T("Export destination is not valid|227")); CFormAlerte.Afficher(result); return; } m_destinationExport = destination; m_exporteur = Exporteur; //C2iStructureExportInDB structure = (C2iStructureExportInDB)m_cmbStructures.SelectedValue; m_multistructure = m_panelMultiStructure.MultiStructure; if (m_multistructure == null) { result.EmpileErreur(I.T("Invalid structure|228")); CFormAlerte.Afficher(result); return; } m_multistructure.ContexteDonnee = CSc2iWin32DataClient.ContexteCourant; CFormProgression.StartThreadWithProgress(I.T("Exporting data|229"), new System.Threading.ThreadStart(StartExport)); /* * * result = structure.GetDataSet ( false, m_listeObjets, null ); * * //result = structure.Export(m_listeObjets.ContexteDonnee.IdSession, m_listeObjets, ref ds, null); * * if (!result) * { * CFormAlerte.Afficher(result); * return; * } * * DataSet ds = (DataSet)result.Data; * * CDestinationExportFile dest = new CDestinationExportFile(m_panelOptions.FileName); * * result = Exporteur.Export(ds, dest); * if (!result) * CFormAlerte.Afficher(result); * else * CFormAlerte.Afficher("Exportation des données réussie"); * * ds.Dispose();*/ Close(); }
private void StartSearch() { if (m_threadSearch == null) { m_threadSearch = new Thread(SearchThread); UpdateVisuel(); m_strDirPattern = m_txtDirPattern.Text; m_strFilePattern = m_txtFilePattern.Text; m_bCancelRequest = false; m_indicateurProgression = CFormProgression.GetNewIndicateurAndPopup("Searching"); m_threadSearch.Start(); } }
private void StartExport() { CResultAErreur result = CResultAErreur.True; try { try { CFormProgression.Indicateur.SetBornesSegment(0, 100); CFormProgression.Indicateur.PushSegment(0, 80); CFormProgression.Indicateur.SetInfo(I.T("Generating data|232")); } catch {} result = m_multistructure.GetDataSet(false, m_listeObjets, CFormProgression.Indicateur); try { CFormProgression.Indicateur.PopSegment(); CFormProgression.Indicateur.PushSegment(80, 100); CFormProgression.Indicateur.SetInfo(I.T("Generating data|232")); } catch {} if (!result) { CFormAlerte.Afficher(result); return; } DataSet ds = (DataSet)result.Data; result = m_exporteur.Export(ds, m_destinationExport); try { CFormProgression.EndIndicateur(CFormProgression.Indicateur); } catch {} ds.Dispose(); CFormAlerte.Afficher(I.T("Export completed with succes|225")); } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); result.EmpileErreur(I.T("Error during data export|226")); } if (!result) { CFormAlerte.Afficher(result); } }
//-------------------------------------------------------------- private void m_btnImporter_Click(object sender, EventArgs e) { CConfigMappagesSmartImport config = null; DataTable table = null; CResultAErreur result = PrepareImport(ref config, ref table); if (!result || table == null) { CFormAlerte.Afficher(result.Erreur); return; } if (!CFormOptionsImport.EditeOptions(m_optionsExecution)) { return; } IIndicateurProgression indicateur = null; indicateur = CFormProgression.GetNewIndicateurAndPopup(I.T("Importing data|20245")); CResultAErreurType <CSessionImport> resSession; resSession = config.DoImportSurServeur(CSc2iWin32DataClient.ContexteCourant.IdSession, table, m_optionsExecution, indicateur); CFormProgression.EndIndicateur(indicateur); if (m_optionsExecution.NomFichierSauvegarde != null && m_optionsExecution.NomFichierSauvegarde.Length > 0) { result = CSerializerObjetInFile.SaveToFile(resSession.DataType, "IMPORT_SESSION", m_optionsExecution.NomFichierSauvegarde); if (!result) { CFormAlerte.Afficher(result.Erreur); } } SetSessionEnCours(resSession.DataType); CFormEditionSessionImport.EditeSession(m_sessionImport); }
private void m_btnTesterImport_Click(object sender, EventArgs e) { CConfigMappagesSmartImport config = null; DataTable table = null; CResultAErreur result = PrepareImport(ref config, ref table); if (!result || table == null) { CFormAlerte.Afficher(result.Erreur); return; } DialogResult dr = MessageBox.Show(I.T("Would you like to save configuration first ?|20225"), "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Cancel) { return; } if (dr == DialogResult.Yes) { if (!SaveConfig()) { return; } } if (!CFormOptionsSimulation.EditeOptions(m_optionsSimulation)) { return; } using (CContexteDonnee ctx = new CContexteDonnee(CSc2iWin32DataClient.ContexteCourant.IdSession, true, false)) { CContexteImportDonnee contexteImport = new CContexteImportDonnee(ctx); contexteImport.StartLine = m_optionsSimulation.StartLine; contexteImport.EndLine = m_optionsSimulation.EndLine; contexteImport.BestEffort = true; IIndicateurProgression indicateur = null; indicateur = CFormProgression.GetNewIndicateurAndPopup(I.T("Testing import|20246")); result = config.ImportTable(table, contexteImport, indicateur); CFormProgression.EndIndicateur(indicateur); indicateur = null; if (!result) { CFormAlerte.Afficher(result.Erreur); return; } if (m_optionsSimulation.TestDbWriting) { CSessionClient session = CSessionClient.GetSessionForIdSession(ctx.IdSession); session.BeginTrans(); result = ctx.SaveAll(false); session.RollbackTrans(); if (!result) { if (CFormAlerte.Afficher(result.Erreur, EFormAlerteBoutons.ContinuerAnnuler, EFormAlerteType.Info) == System.Windows.Forms.DialogResult.Cancel) { return; } } } if (CFormResultatSmartImport.ShowImportResult(ctx, contexteImport, config, m_rootValues, table)) { result = ctx.SaveAll(true); if (!result) { CFormAlerte.Afficher(result.Erreur); return; } } } }