Exemplo n.º 1
0
        /// <summary>
        /// 点击修改按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button3_Click(object sender, EventArgs e)
        {
            if (textBox3.Text == "")
            {
                MessageBox.Show("ID不可为空"); return;
            }
            Ticket model = new Ticket();

            model.Id        = Convert.ToInt32(textBox3.Text);
            model.movieName = textBox6.Text;
            model.date      = textBox7.Text;
            model.price     = textBox5.Text;
            if (TicketDAL.FindModel(new Ticket(model.Id), "id") == null)
            {
                MessageBox.Show("不存在此ID"); return;
            }
            if (TicketDAL.AlterByPK(model, "id"))
            {
                FillDataGirdView(); MessageBox.Show("修改成功"); return;
            }
        }