コード例 #1
0
        private void button1_Click(object sender, EventArgs e)                          //将不需要显示的样机字段改变
        {
            PhoneBLL phonebll     = new PhoneBLL();
            string   PhoneNameD   = this.cbbPhoneNameD.Text;
            string   PhoneStageD  = this.cbbPhoneStageD.Text;
            string   PhoneDisplay = this.cbbPhoneDisplay.Text;

            if (cbbPhoneNameD.Text == "" || cbbPhoneStageD.Text == "" || cbbPhoneDisplay.Text == "")
            {
                MessageBox.Show("请通过样机名称 与 样机阶段 进行选择", "提示");
                return;
            }

            if (MessageBox.Show("确定对选中的样机名称与样机阶段进行操作?", "Warning",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                if (phonebll.updatePhoneDisplay(PhoneNameD, PhoneStageD, PhoneDisplay))
                {
                    MessageBox.Show("更新样机状态成功", "提示");
                }
                else
                {
                    MessageBox.Show("更新失败,请检查信息是否正确", "提示");
                }
            }
            else
            {
                //不执行任务
            }

            phones = phonebll.getAllPhones();
            PhoneDataGrid.DataSource = phones;                  //将数据库中的数据提到列表中,再通过 DataGrid控件显示;
        }