Exemple #1
0
        static void Main(string[] args)
        {
            var loadFile = File.ReadAllLines(@"c:\users\luiz.araujo\documents\visual studio 2015\Projects\FinancialDic\FinancialDic.Load\load.csv");

            _repository = new GenericRepository<Word>();

            var count = 0;

            foreach (var line in loadFile)
            {
                var words = line.Split(';');

                count ++;

                var word = new Word()
                {
                    Id = count,
                    Portuguese = words[0],
                    English = words[1]
                };

                _repository.AddOrUpdate(word);
            }

            Console.WriteLine("Fim");
        }
Exemple #2
0
        private void Form1_DoubleClick(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {

                _repository.RemoveAll();

                var loadFile = File.ReadAllLines(openFileDialog1.FileName);

                progressBar1.Visible = true;
                progressBar1.Minimum = 0;
                progressBar1.Maximum = loadFile.Length;

                var count = 0;

                foreach (var line in loadFile)
                {
                    var words = line.Split(';');

                    count++;
                    progressBar1.Value = count;

                    var word = new Word()
                    {
                        Id = count,
                        Portuguese = words[0],
                        English = words[1]
                    };

                    _repository.AddOrUpdate(word);

                    _words.Add(word);
                }

                _repository.TakeSnapshot();

                this.LoadGrid();

                MessageBox.Show(@"Dados carregados com sucesso.");
                progressBar1.Visible = false;
            }
        }