private void editToolStripMenuItem1_Click(object sender, EventArgs e) { InfoList st = new InfoList(); ListViewItem item = listView1.SelectedItems[0]; st.nomer = item.SubItems[0].Text; st.type = item.SubItems[1].Text; st.punktNaz = item.SubItems[2].Text; st.dataOtpr = Convert.ToDateTime(item.SubItems[3].Text); st.timeOtpr = item.SubItems[4].Text; st.dataPrib = Convert.ToDateTime(item.SubItems[5].Text); st.timePrib = item.SubItems[6].Text; Form2 f2 = new Form2(); f2.Text = "РЕДАКТИРОВАНИЕ РЕЙСА"; f2.list = st; if (f2.ShowDialog() == DialogResult.OK) { int k = 0; for (int i = 0; i < info.Count; i++) { if (info[i].nomer == st.nomer) { k = i; break; } } info.RemoveAt(k); info.Add(f2.list); listView1.Items.Clear(); InfoAddList(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { openFileDialog1.Filter = "Все файлы (*.*)|*.*|Текстовые файлы (*.txt)|*.txt |PDF файлы (*.pdf)|*.pdf"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { using (StreamReader sr = new StreamReader(openFileDialog1.FileName, Encoding.GetEncoding(1251))) { while (!sr.EndOfStream) { InfoList list = new InfoList(); list.nomer = sr.ReadLine(); list.type = sr.ReadLine(); list.punktNaz = sr.ReadLine(); list.dataOtpr = Convert.ToDateTime(sr.ReadLine()); list.timeOtpr = sr.ReadLine(); list.dataPrib = Convert.ToDateTime(sr.ReadLine()); list.timePrib = sr.ReadLine(); info.Add(list); } } InfoAddList(); comboBox1.Items.Add(""); foreach (var item in info) { if (!comboBox1.Items.Contains(item.punktNaz)) { comboBox1.Items.Add(item.punktNaz); } } addComboBox2(); comboBox1.SelectionStart = 0; comboBox2.SelectionStart = 0; } }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.Text = "ДОБАВЛЕНИЕ РЕЙСА"; InfoList list = new InfoList(); f2.list = list; if (f2.ShowDialog() == DialogResult.OK) { info.Add(f2.list); listView1.Items.Clear(); InfoAddList(); } }
private void dellToolStripMenuItem1_Click(object sender, EventArgs e) { InfoList st = new InfoList(); ListViewItem item = listView1.SelectedItems[0]; st.nomer = item.SubItems[0].Text; int k = 0; for (int i = 0; i < info.Count; i++) { if (info[i].nomer == st.nomer) { k = i; break; } } info.RemoveAt(k); listView1.Items.Clear(); InfoAddList(); }