private void button1_Click(object sender, EventArgs e) { try { DB_functions fun = new DB_functions(); DB_functions.Fields_Track fields = new DB_functions.Fields_Track(); fields.f1 = txtDescription.Text; fields.f2 = txtStops.Text; fields.f3 = int.Parse(txtTime.Text); fields.f4 = chbCity.Checked; DateTime time = DateTime.Parse(dtpCreate.Value.ToString("dd.MM.yyyy")); fields.f5 = time; fields.f6 = false; fun.Save(fields); dsTableAdapters.TrackTableAdapter taT = new dsTableAdapters.TrackTableAdapter(); taT.Update(ds.Track); this.Close(); } catch (Exception E) { MessageBox.Show("Невозможно сохранить", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void маршрутыToolStripMenuItem_Click(object sender, EventArgs e) { frmAdmin frm = new frmAdmin(); dsTableAdapters.TrackTableAdapter ta = new dsTableAdapters.TrackTableAdapter(); ta.Fill(ds.Track); frm.dgvAdmin.DataSource = ds.Track; frm.dgvAdmin.Update(); frm.ShowDialog(); ta.Update(ds.Track); }
private void btnTrack_Click(object sender, EventArgs e) { dsTableAdapters.TrackTableAdapter taTrack = new dsTableAdapters.TrackTableAdapter(); taTrack.Fill(ds.Track); dgvMain.DataSource = ds.Track; dgvMain.Columns[1].HeaderText = "Название"; dgvMain.Columns[2].HeaderText = "Остановки"; dgvMain.Columns[3].HeaderText = "Время в пути"; dgvMain.Columns[4].HeaderText = "По городу"; dgvMain.Columns[5].HeaderText = "Дата создания"; dgvMain.Columns[6].HeaderText = "Одобрен"; dgvMain.Update(); }