コード例 #1
0
        private void m_lnkExporter_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (!(m_dataGrid.DataSource is DataSet))
            {
                CFormAlerte.Afficher(I.T("This function cannot be used with this data set|30036"), EFormAlerteType.Erreur);
                return;
            }
            IExporteurDataset  exporteur   = null;
            IDestinationExport destination = null;

            if (CFormOptionsExport.EditeOptions(ref destination, ref exporteur))
            {
                if (exporteur != null)
                {
                    CResultAErreur result = exporteur.Export((DataSet)m_dataGrid.DataSource, destination);
                    if (!result)
                    {
                        CFormAlerte.Afficher(result);
                        return;
                    }
                    else
                    {
                        CFormAlerte.Afficher(I.T("Export finished|30037"));
                    }
                }
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        private void m_lnkExport_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IExporteurDataset  exporteur   = null;
            IDestinationExport destination = null;

            if (CFormOptionsExport.EditeOptions(ref destination, ref exporteur))
            {
                if (exporteur != null)
                {
                    DataSet   dsExport    = new DataSet();
                    DataTable tableExport = new DataTable("EXPORT");
                    foreach (DataGridViewColumn colView in m_grid.Columns)
                    {
                        if (!tableExport.Columns.Contains(colView.HeaderText))
                        {
                            tableExport.Columns.Add(colView.HeaderText);
                        }
                    }
                    int rowIndex = 0;
                    foreach (DataGridViewRow rowView in m_grid.Rows)
                    {
                        tableExport.Rows.Add(tableExport.NewRow());
                        foreach (DataGridViewColumn colView in m_grid.Columns)
                        {
                            int colIndex = colView.Index;
                            tableExport.Rows[rowIndex][colIndex] = rowView.Cells[colIndex].Value;
                        }
                        rowIndex++;
                    }

                    dsExport.Tables.Add(tableExport);
                    CResultAErreur result = exporteur.Export(dsExport, destination);
                    if (!result)
                    {
                        CFormAlerte.Afficher(result);
                        return;
                    }
                    else
                    {
                        CFormAlerte.Afficher(I.T("Export completed|30037"));
                    }
                }
            }
        }