Esempio n. 1
0
File: Form1.cs Progetto: D43R/lab8
 private void EditElem_Click(object sender, EventArgs e)
 {
     try
     {
         int     k = DBOutput.CurrentRow.Index;
         AddElem a = new AddElem();
         a.ReturnForm = this;
         InitializeEditWindow(a, mainList[k]);
         this.Hide();
         a.ShowDialog();
         if (a.ok)
         {
             mainList[k].busNumber   = a.bn;
             mainList[k].routeNumber = a.rn;
             mainList[k].driverName  = a.dn;
             mainList[k].busState    = a.bs;
             if (mainList[k].busState)
             {
                 mainList[k].busStateString = "В парке";
             }
             else
             {
                 mainList[k].busStateString = "На маршруте";
             }
             DBOutput.Rows.Clear();
             GetItemsFromList(mainList);
         }
     }
     catch
     {
         MessageBox.Show("Ошибка");
     }
 }
Esempio n. 2
0
File: Form1.cs Progetto: D43R/lab8
 private void InitializeEditWindow(AddElem a, bus b)
 {
     a.Text = "Редактировать элемент";
     a.routeNumTextBox.Text   = b.routeNumber.ToString();
     a.DriverNameTextBox.Text = b.driverName;
     a.BusNumTextBox.Text     = b.busNumber.ToString();
 }
Esempio n. 3
0
File: Form1.cs Progetto: D43R/lab8
        private void AddItemButton_Click(object sender, EventArgs e)
        {
            AddElem a = new AddElem();

            a.ReturnForm = this;
            this.Hide();
            a.ShowDialog();
            if (a.ok)
            {
                if (!SearchFunc(a.bn.ToString()))
                {
                    bus pazik = new bus(a.rn, a.dn, a.bn, a.bs);
                    mainList.Add(pazik);
                    DBOutput.Rows.Clear();
                    GetItemsFromList(mainList);
                }
                else
                {
                    MessageBox.Show("Автобус с таким номером уже существует.");
                }
            }
        }