Example #1
0
        public void openCsv()
        {
            openFileDialog1.FileName = "file";//
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                name = openFileDialog1.FileName;
                List <Aval> CSV_Struct = new List <Aval>();
                CSV_Struct = Aval.ReadFile(name);
                for (int i = 0; i <= CSV_Struct.Count - 1; i++)
                {
                    //MessageBox.Show(i.ToString());
                    //listView1.Items.Add(CSV_Struct[i].name);
                    //listView1.Items[i].SubItems.Add(CSV_Struct[i].recivPayNum);
                    //listView1.Items[i].SubItems.Add(CSV_Struct[i].mfo);
                    //listView1.Items[i].SubItems.Add(CSV_Struct[i].rahunok);
                    //listView1.Items[i].SubItems.Add(CSV_Struct[i].zkpo);
                    //listView1.Items[i].SubItems.Add(CSV_Struct[i].datePayment.ToString());

                    int n = dataGridView1.Rows.Add();

                    dataGridView1.Rows[n].Cells[0].Value = "0";
                    dataGridView1.Rows[n].Cells[1].Value = "1";
                    dataGridView1.Rows[n].Cells[2].Value = CSV_Struct[i].recivPayNum;
                    dataGridView1.Rows[n].Cells[3].Value = CSV_Struct[i].datePayment.ToString();
                    dataGridView1.Rows[n].Cells[4].Value = "!!";
                    dataGridView1.Rows[n].Cells[5].Value = CSV_Struct[i].mfo;
                    dataGridView1.Rows[n].Cells[6].Value = "00";
                    dataGridView1.Rows[n].Cells[7].Value = CSV_Struct[i].rahunok;
                    dataGridView1.Rows[n].Cells[8].Value = CSV_Struct[i].summa;
                    //dataGridView1.Rows[n].Cells[9].Value = "0";
                    // dataGridView1.Rows[n].Cells[10].Value = CSV_Struct[i].name;

                    n = dataGridView2.Rows.Add();
                    dataGridView2.Rows[n].Cells[0].Value  = "0";
                    dataGridView2.Rows[n].Cells[1].Value  = "1";
                    dataGridView2.Rows[n].Cells[2].Value  = CSV_Struct[i].recivPayNum;
                    dataGridView2.Rows[n].Cells[3].Value  = CSV_Struct[i].dateP.ToString("dd.MM.yyyy");
                    dataGridView2.Rows[n].Cells[4].Value  = Properties.Settings.Default.mfo;
                    dataGridView2.Rows[n].Cells[5].Value  = CSV_Struct[i].mfo;
                    dataGridView2.Rows[n].Cells[6].Value  = Properties.Settings.Default.rahunok;
                    dataGridView2.Rows[n].Cells[7].Value  = CSV_Struct[i].rahunok;
                    dataGridView2.Rows[n].Cells[8].Value  = CSV_Struct[i].summa;
                    dataGridView2.Rows[n].Cells[9].Value  = "0";
                    dataGridView2.Rows[n].Cells[10].Value = CSV_Struct[i].name;
                    dataGridView2.Rows[n].Cells[12].Value = CSV_Struct[i].zkpo;
                    dataGridView2.Rows[n].Cells[11].Value = addDateToStr(findZkpo(CSV_Struct[i].zkpo), CSV_Struct[i].dateP.ToString("dd.MM.yyyy"));
                }
            }



            //string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"RO1306__.csv");


            //Заполняем listView из нашей структуры
        }