private void button4_Click(object sender, System.EventArgs e)
        {
            var specikacia = new SirsiaSpecifikaciaKontraktu
            {
                Burza = textBoxBurza.Text,
                EndRok = textBoxEnd.Text,
                HodnotaBod = textBoxHodnotaBodu.Text,
                Kategoria = textBoxKategoria.Text,
                Komodita = textBoxNazov.Text,
                StartRok = textBoxStart.Text,
                Symbol = textBoxSymbol.Text,
                TypyKontraktov = textBoxMesiace.Text,
                Url = textBoxUrl.Text,
                UrlCon = textBoxUrlCon.Text,
                VelkostTicku = double.Parse(textBoxHodnotaTicku.Text,CultureInfo.GetCultureInfoByIetfLanguageTag("en"))
            };

            _jadro.UlozZmenySpecifikacii(specikacia, listBox1.SelectedIndex);
            MessageBox.Show(@"Ukladanie dokoncene", @"Ïnfo", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 2
0
 private IEnumerable<string> ParsujKontraktyVsetky(SirsiaSpecifikaciaKontraktu item)
 {
     return item.TypyKontraktov.Where((t, i) => i%2 == 0).Select(t => t.ToString(CultureInfo.InvariantCulture)).ToList();
 }
Esempio n. 3
0
 public void UlozZmenySpecifikacii(SirsiaSpecifikaciaKontraktu specikacia, int selectedIndex)
 {
     new PracaSoSubormi().UlozZmenySpecifikacii(specikacia, selectedIndex);
 }
        public void UlozZmenySpecifikacii(SirsiaSpecifikaciaKontraktu specikacia, int selectedIndex)
        {
            var file = System.Environment.CurrentDirectory.Substring(0, System.Environment.CurrentDirectory.LastIndexOf("bin")) + "Kontrakty\\Specifikacie.csv";
            var records = GetKontraktyPodrobnejsie();
            File.Delete(file);

            using (StreamWriter sw = new StreamWriter(file, true))
            {
                try
                {
                    var writer = new CsvWriter(sw);
                    writer.Configuration.Delimiter = ";";
                    writer.WriteHeader(typeof (SirsiaSpecifikaciaKontraktu));
                    for (int i = 0; i < selectedIndex; i++)
                    {
                        writer.WriteRecord(records[i]);
                    }
                    writer.WriteRecord(specikacia);
                    for (int i = selectedIndex + 1; i < records.Count; i++)
                    {
                        writer.WriteRecord(records[i]);
                    }
                    sw.Close();
                }
                catch (Exception e)
                {
                    var ee = e.Data["CsvHelper"];
                    Console.WriteLine(e.Data.Values);
                }
            }

            var text = File.ReadAllText(file).Replace(";0.", ";0,");
            File.WriteAllText(file, text);
        }