Esempio n. 1
0
        /// <summary>
        /// 窗体加载时产生随机数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Registered_Load(object sender, EventArgs e)
        {
            //调用生成卡号
            string account = CreateAccountNum();

            RegistName.Text = account;
            //RegistName.Text = "621288100105810458";
            //1、验证数据库是否存在当前生成的卡号
            UserInfo userInfo = new UserInfo();

            userInfo.Card_Number = this.RegistName.Text.ToString();
            //2、调用BLL
            BankBLL bankbll = new BankBLL();
            bool    result  = bankbll.RegistNumber(userInfo.Card_Number);

            //3、如果result返回true的结果,则重新调用生成卡号
            while (result != false)
            {
                //2、重新验证卡号是否存在
                MessageBox.Show("已经存在卡号");
                account = CreateAccountNum();
                result  = bankbll.RegistNumber(userInfo.Card_Number);
            }
        }