private void button1_Click(object sender, EventArgs e) { bool check; Control.Control control= new Control.Control(); Entity.Entity entity = new Entity.Entity(); entity.setUsername(this.textBox1.Text); entity.setPassword(this.textBox2.Text); check = control.checkUsers(entity.getUsername(), entity.getPassword()); dt = control.getCustomer(entity.getUsername()); if (check) { check1 = true; mainForm main = new mainForm(); main.ShowDialog(); this.textBox1.Text = ""; this.textBox2.Text = ""; } else { this.textBox1.Text = ""; this.textBox2.Text = ""; MessageBox.Show("密码错误或用户名不存在"); } }
private void button1_Click(object sender, EventArgs e) { mainForm.dbv.dgv.DataSource = null; bool m_check; Control.Control control = new Control.Control(); Entity.Entity entity = new Entity.Entity(); entity.setM_Username(this.textBox1.Text); entity.setM_Password(this.textBox2.Text); m_check = control.checkM_Users(entity.getM_Username(), entity.getM_Password()); if (m_check) { this.Visible = false; mainForm main = new mainForm(); main.ShowDialog(); this.Close(); } else { this.textBox1.Text = ""; this.textBox2.Text = ""; MessageBox.Show("密码错误或管理员不存在"); } }