Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (button2.Text == "添加")
            {
                ManagerInfo InsertData = new ManagerInfo()
                {
                    MName = textBox3.Text.Trim(),
                    MPwd  = textBox2.Text.Trim(),
                    MType = radioButton1.Checked ? 1 : 0
                };
                if (miBll.Add(InsertData))
                {
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else
            {
                ManagerInfo ModifierData = new ManagerInfo()
                {
                    MName = textBox3.Text.Trim(),
                    MPwd  = textBox2.Text.Trim(),
                    MType = radioButton1.Checked ? 1 : 0,
                    Mid   = Convert.ToInt32(textBox1.Text.Trim())
                };

                if (miBll.Modifier(ModifierData))
                {
                    MessageBox.Show("修改成功!");
                    LoadList();
                }
                ;
            }
        }