Ejemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         _objLoadData = new clLoadData();
         _objConnection = new clConnection();
         _objMessage = new clMessage();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        private void frmInserts_Load(object sender, EventArgs e)
        {
            string arquivo = string.Format("Inserts_{3}_{0}_{1}_{2}.txt",
                                DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, _strTabela);
            StreamWriter objWt = new StreamWriter(arquivo, false);

            try
            {
                //Inicio teste
                //long lTamnhoString = (long)_strInserts.Count;

                //if (lTamnhoString > 100000)
                //    lTamnhoString = lTamnhoString;
                //Fim teste

                if (_strInserts != null)
                    for (int i = 0; i < _strInserts.Count; i++)
                        objWt.WriteLine(_strInserts[i].ToString());

                if (objWt != null)
                {
                    objWt.Flush();
                    objWt.Close();
                }

                _strNomeArqGerado = arquivo;
                StreamReader objRe = new StreamReader(arquivo);
                txtInserts.Text = objRe.ReadToEnd();

                if (objRe != null)
                    objRe.Close();

                lblErrorInfo.Text = string.Format("{0} insert(s) gerado(s)", _strInserts.Count);
                _objLoadData = new clLoadData();
                _objConnection = new clConnection();
                //_objMessage = new clMessage();

                TimeSpan fim = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
                TimeSpan total = new TimeSpan();

                total = fim.Subtract(_objTimerInicio);

                lblInfo.Text = string.Format("Tempo de geração:{0}", total.ToString());
                lklArqGerado.Text = string.Format("{0}{1}", "Arquivo gerado: ", arquivo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message, "Migration",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //if (objWt != null)
                //{
                //    objWt.Flush();
                //    objWt.Close();
                //}
            }
        }