Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)                //根据样机码删除样机
        {
            string   phoneCode = this.txtPhoneCode.Text;
            PhoneBLL phonebll  = new PhoneBLL();

            if (txtPhoneCode.Text == "")
            {
                MessageBox.Show("请通过输入样机码进行样机删除", "提示");
                return;
            }

            if (MessageBox.Show("确定要删除该条样机信息吗?", "Warning",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                if (phonebll.delByPhoneCode(phoneCode))
                {
                    MessageBox.Show("删除成功!", "提示");
                }
                else
                {
                    MessageBox.Show("删除失败,请检查信息是否正确", "提示");
                }
            }
            else
            {
                //不执行任务
            }

            phones = phonebll.getAllPhones();
            PhoneDataGrid.DataSource = phones;

            this.txtPhoneCode.Clear();
            this.txtPhoneName.Clear();
            this.cbbPhoneStage.Text = "";
            this.cbbInf1.Text       = "";
            this.cbbInf2.Text       = "";
            this.cbbInf3.Text       = "";
            this.cbbInf4.Text       = "";
            this.cbbPhoneOwner.Text = "";
        }