Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                DB_functions fun = new DB_functions();
                DB_functions.Fields_Bus fields = new DB_functions.Fields_Bus();
                DB_functions.Link_BusTrack bt = new DB_functions.Link_BusTrack();

                fields.f1 = txtNumber.Text;
                fields.f2 = cmbMark.Text;
                fields.f3 = cbTour.Checked;
                fields.f4 = cbNew.Checked;
                fields.f5 = int.Parse(txtSits.Text);

                fun.Save(fields);

                bt.f1 = int.Parse(ds.Bus.Rows[ds.Bus.Rows.Count - 1][0].ToString());
                bt.f2 = int.Parse(cmbTrack.SelectedValue.ToString());

                fun.Save(bt);

                dsTableAdapters.BusTableAdapter taB = new dsTableAdapters.BusTableAdapter();
                dsTableAdapters.B_TTableAdapter taBT = new dsTableAdapters.B_TTableAdapter();
                taB.Update(ds.Bus);
                taBT.Update(ds._B_T);

                this.Close();
            }
            catch (Exception E)
            {
                MessageBox.Show("Невозможно сохранить", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void автобусыМаршрутыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAdmin frm = new frmAdmin();
            dsTableAdapters.B_TTableAdapter ta = new dsTableAdapters.B_TTableAdapter();
            ta.Fill(ds._B_T);
            frm.dgvAdmin.DataSource = ds._B_T;
            frm.dgvAdmin.Update();
            frm.ShowDialog();

            ta.Update(ds._B_T);
        }