Beispiel #1
0
        private void BtnReigster_Click(object sender, EventArgs e)
        {
            string pid = txtId.Text.Trim();

            if (MyUtils.GetPersonById(pid) != null)
            {
                MessageBox.Show("用户已存在,注册失败");
            }
            else
            {
                string name     = txtName.Text.Trim();
                string pwd      = txtPwd.Text;
                Gender gender   = rbMan.Checked ? Gender.男 : Gender.女;
                string birthday = txtBirthday.Value.ToShortDateString();
                string phone    = txtPhone.Text.Trim();
                string email    = txtEmail.Text.Trim();

                Person person = new Person(pid, name, pwd, gender, birthday, phone, email);
                MyUtils.AddPerson(person);
                MessageBox.Show("注册成功");
            }
        }