private void confirmBtn_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox4.Text == "" || textBox6.Text == "" || textBox8.Text == "" || comboBox1.Text == "" || textBox7.Text == "") { MessageBox.Show("Provide all information..."); } else { Admin admin = new Admin(); admin.Name = textBox2.Text; admin.Gender = comboBox1.Text; admin.Phone = textBox1.Text; admin.Address = textBox4.Text; admin.Dob = textBox7.Text; admin.Salary = Convert.ToDouble(textBox6.Text); admin.Password = textBox8.Text; AdminServices adminServices = new AdminServices(); bool check = adminServices.AddAdmin(admin); if (check) { MessageBox.Show("Admin Added"); } else { MessageBox.Show("Error Occured !"); } } }
private void button6_Click(object sender, EventArgs e) { AdminInfo admin = new AdminInfo(); admin.Adminname = this.tex_user.Text; admin.Username = this.tex_username.Text; admin.Userpwd = this.tex_pwd.Text; int ret = AdminServices.AddAdmin(admin); if (ret > 0) { MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } this.dataGridView2.DataSource = AdminServices.GetALLAdmin(); }