Beispiel #1
0
 private void BuslineEdit_Load(object sender, EventArgs e)
 {
     if (Intent.State == "ADD")
     {
         bl = new Busline();
     }
     else
     {
         textBox1.Text = bl.BlNo;
         textBox2.Text = bl.Start;
         textBox3.Text = bl.End;
         textBox4.Text = bl.Distance;
     }
 }
Beispiel #2
0
        private void ChangeBtn3_Click(object sender, EventArgs e)
        {
            if (listView3.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择一行");
                return;
            }

            Intent.State = "CHANGE";
            BuslineEdit ble = new BuslineEdit();
            Busline     bl  = new Busline();

            bl.SetValue(
                listView3.SelectedItems[0].SubItems[0].Text,
                listView3.SelectedItems[0].SubItems[1].Text,
                listView3.SelectedItems[0].SubItems[2].Text,
                listView3.SelectedItems[0].SubItems[3].Text
                );
            ble.bl        = bl;
            Intent.OLD_ID = bl.BlNo;

            if (ble.ShowDialog() == DialogResult.OK)
            {
                sql = @"" +
                      " UPDATE [Buslines]" +
                      " SET" +
                      "   [BlNo]=" + ble.bl.BlNo + "," +
                      "   [Start]='" + ble.bl.Start + "'," +
                      "   [End]='" + ble.bl.End + "'," +
                      "   [Distance]=" + ble.bl.Distance + "" +
                      " WHERE [BlNo]=" + Intent.OLD_ID + "";
                db.SetBySQL(sql);

                UpdateListView();
            }
        }