コード例 #1
0
ファイル: logon.cs プロジェクト: ZoRoronoa/BankSystemByCSharp
        private void buttonLogonOver_Click(object sender, EventArgs e)
        {
            string this_user_name         = this.textBoxLogonName.Text;
            string this_user_psw          = this.textBoxLogonPassword.Text;
            string this_user_id_card      = this.textBoxLogonIdentity.Text;
            string this_user_phone_number = this.textBoxLogonPhoneNumber.Text;
            //string this_user_gender = this.textBoxLogonSex.Text;
            string this_user_gender = this.comboBox1.SelectedItem.ToString();

            if (this_user_name == "" || this_user_psw == "" || this_user_gender == "")
            {
                MessageBox.Show("请完善信息!");
                return;
            }
            if (!is_right(this_user_id_card))
            {
                MessageBox.Show("身份证不合法,请检查并重新输入!");
                return;
            }
            if (this_user_phone_number.Length != 11)
            {
                MessageBox.Show("手机号码不合法,请重新输入!");
                return;
            }

            try
            {
                int res = Bank.Register(this_user_name, this_user_psw, this_user_id_card, this_user_phone_number, this_user_gender);
                if (res == 1)
                {
                    MessageBox.Show("账户已经存在,请重试!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            anotherForm = new login();
            anotherForm.Show(); //ShowDialog();
            this.Close();       //Application.ExitThread();
        }