Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            register = new LoginControllerImpl();
            string       jobnumber = textBox1.Text;
            string       password  = textBox2.Text;
            string       workunit  = textBox3.Text;
            WorkerEntity obj       = new WorkerEntity(jobnumber, password, workunit);

            register.JudgeNull(obj);
            bool term  = false; //判断是否添加成功
            bool judge = false; //判断是否重复添加

            if (jobnumber != "" && password != "" && workunit != "")
            {
                term  = register.InsertDatabase(obj); //判断是否添加成功
                judge = register.Register(obj);       //判断是否重复添加
            }

            if (judge == true)
            {
                MessageBox.Show("用户已注册!");
            }
            else
            {
                if (term == true)
                {
                    MessageBox.Show("注册成功!");
                    Login login = new Login();
                    this.Hide();
                    login.Show();
                }
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            login = new LoginControllerImpl();
            string jobnumber = textBox1.Text;
            string password  = textBox2.Text;
            string workunit  = comboBox1.Text;

            WorkerEntity obj   = new WorkerEntity(jobnumber, password, workunit);
            SalerManage  saler = new SalerManage(obj);

            login.JudgeNull(obj);

            bool term = login.VisitDatabase(obj);

            if (term == true)
            {
                login.JumpShow(obj);
                this.Hide();
                MessageBox.Show("登录成功");
            }
            else
            {
                MessageBox.Show("没有此用户!请重新输入!");
            }
        }