Ejemplo n.º 1
0
        private void buttonUserConfirm_Click(object sender, EventArgs e)
        {
            if (textUserName.Text.Trim() == "")
            {
                MessageBox.Show("用户名不能为空!", "注册提示");
                return;
            }
            if (textUserPwd.Text == "")
            {
                MessageBox.Show("登录密码不能为空!", "注册提示");
                return;
            }
            if (textUserPwd.Text.Length < 6)
            {
                MessageBox.Show("登录密码长度至少为6位!", "注册提示");
                return;
            }
            if (textUserPwd.Text.Length > 25)
            {
                MessageBox.Show("登录密码长度最多为25位!", "注册提示");
                return;
            }
            if (textUserCheckPwd.Text != textUserPwd.Text)
            {
                MessageBox.Show("登录密码两次输入不一致!", "注册提示");
                return;
            }
            if (textPayPwd.Text == "")
            {
                MessageBox.Show("支付密码不能为空!", "注册提示");
                return;
            }
            if (textPayPwd.Text.Length < 6)
            {
                MessageBox.Show("支付密码长度至少为6位!", "注册提示");
                return;
            }
            if (textPayPwd.Text.Length > 25)
            {
                MessageBox.Show("支付密码长度最多为25位!", "注册提示");
                return;
            }
            if (textCheckPayPwd.Text != textPayPwd.Text)
            {
                MessageBox.Show("支付密码两次输入不一致!", "注册提示");
                return;
            }
            if (textUserPhone.Text == "")
            {
                MessageBox.Show("请输入电话号码", "注册提示");
                return;
            }
            if (!CheckPhone(textUserPhone.Text))
            {
                MessageBox.Show("非有效电话号码", "注册提示");
                return;
            }
            if (textUserRealName.Text.Trim() == "")
            {
                MessageBox.Show("请输入真实姓名", "注册提示");
                return;
            }
            if (!userGenderBox.Items.Contains(userGenderBox.Text))
            {
                MessageBox.Show("非有效性别", "注册提示");
                return;
            }
            if (textUserAddress.Text.Trim() == "")
            {
                MessageBox.Show("请输入家庭住址", "注册提示");
                return;
            }
            if (textUserIdentity.Text == "")
            {
                MessageBox.Show("请输入身份证号码", "注册提示");
                return;
            }
            if (!CheckCidInfo(textUserIdentity.Text.Trim()))
            {
                MessageBox.Show("非有效身份证", "注册提示");
                return;
            }
            if (textDriLicsense.Text.Trim() == "")
            {
                MessageBox.Show("请输入驾驶证号码", "注册提示");
                return;
            }
            if (textDriLicsense.Text.Trim().Length != 12)
            {
                MessageBox.Show("无效驾驶证号码", "注册提示");
                return;
            }
            if (textDriLicsense.Text.Trim().Substring(0, 3) != textUserIdentity.Text.Trim().Substring(0, 3))
            {
                MessageBox.Show("无效驾驶证号码", "注册提示");
                return;
            }
            userInfo.UserName       = textUserName.Text.Trim();
            userInfo.UserPwd        = textUserPwd.Text;
            userInfo.UserPayPwd     = textPayPwd.Text;
            userInfo.UserRealName   = textUserRealName.Text.Trim();
            userInfo.UserPhone      = textUserPhone.Text.Trim();
            userInfo.Gender         = (UserInfo.GenderEnum)userGenderBox.SelectedIndex;
            userInfo.UserIdentity   = textUserIdentity.Text.Trim();
            userInfo.UserAddress    = textUserAddress.Text.Trim();
            userInfo.UserDriLicense = textDriLicsense.Text.Trim();
            userInfo.RemainMoney    = 0m;
            userInfo.UserPhoto      = null;
            AuditRequest auditRequest = new AuditRequest(userInfo);
            AuditDal     auditDal     = new AuditDal();

            if (auditDal.CommitRequest(auditRequest))
            {
                MessageBox.Show("已提交用户信息,等待管理员审核", "注册提示");
            }
            else
            {
                MessageBox.Show("提交用户信息失败,可能连接服务器失败", "注册提示");
            }
        }
Ejemplo n.º 2
0
        private void buttonAdminConfirm_Click(object sender, EventArgs e)
        {
            if (textAdminName.Text.Trim() == "")
            {
                MessageBox.Show("用户名不能为空!", "注册提示");
                return;
            }
            if (textAdminPwd.Text == "")
            {
                MessageBox.Show("登录密码不能为空!", "注册提示");
                return;
            }
            if (textAdminPwd.Text.Length < 6)
            {
                MessageBox.Show("登录密码长度至少为6位!", "注册提示");
                return;
            }
            if (textAdminPwd.Text.Length > 25)
            {
                MessageBox.Show("登录密码长度最多为25位!", "注册提示");
                return;
            }
            if (textAdminCheckPwd.Text != textAdminPwd.Text)
            {
                MessageBox.Show("管理密码两次输入不一致!", "注册提示");
                return;
            }
            if (textControlPwd.Text == "")
            {
                MessageBox.Show("管理密码不能为空!", "注册提示");
                return;
            }
            if (textControlPwd.Text.Length < 6)
            {
                MessageBox.Show("管理密码长度至少为6位!", "注册提示");
                return;
            }
            if (textControlPwd.Text.Length > 25)
            {
                MessageBox.Show("管理密码长度最多为25位!", "注册提示");
                return;
            }
            if (textControlCheckPwd.Text != textControlPwd.Text)
            {
                MessageBox.Show("管理密码两次输入不一致!", "注册提示");
                return;
            }
            if (textAdminPhone.Text == "")
            {
                MessageBox.Show("请输入电话号码", "注册提示");
                return;
            }
            if (!CheckPhone(textAdminPhone.Text))
            {
                MessageBox.Show("非有效电话号码", "注册提示");
                return;
            }
            if (textAdminRealName.Text.Trim() == "")
            {
                MessageBox.Show("请输入真实姓名", "注册提示");
                return;
            }
            if (!adminGenderBox.Items.Contains(adminGenderBox.Text))
            {
                MessageBox.Show("非有效性别", "注册提示");
                return;
            }
            if (textAdminAddress.Text.Trim() == "")
            {
                MessageBox.Show("请输入家庭住址", "注册提示");
                return;
            }
            if (textAdminIdentity.Text == "")
            {
                MessageBox.Show("请输入身份证号码", "注册提示");
                return;
            }
            if (!CheckCidInfo(textAdminIdentity.Text.Trim()))
            {
                MessageBox.Show("非有效身份证", "注册提示");
                return;
            }

            this.Cursor               = Cursors.WaitCursor;
            adminInfo.AdminName       = textAdminName.Text.Trim();
            adminInfo.AdminPwd        = textAdminPwd.Text;
            adminInfo.AdminControlPwd = textControlPwd.Text;
            adminInfo.AdminPhone      = textAdminPhone.Text.Trim();
            adminInfo.AdminRealName   = textAdminRealName.Text.Trim();
            //adminInfo.Gender = (AdminInfo.GenderEnum)Enum.Parse(typeof(AdminInfo.GenderEnum),adminGenderBox.Text);
            adminInfo.Gender        = (AdminInfo.GenderEnum)adminGenderBox.SelectedIndex;
            adminInfo.AdminAddress  = textAdminAddress.Text.Trim();
            adminInfo.AdminIdentity = textAdminIdentity.Text.Trim();
            // 录入管理员信息到数据库
            int adminCount = adminDal.CountAdmin();

            if (adminCount == 0)
            {
                if (adminDal.InsertAdmin(adminInfo))
                {
                    MessageBox.Show("管理员录入成功", "注册提示");
                }
                else
                {
                    MessageBox.Show("管理员录入失败", "注册提示");
                }
                //MessageBox.Show(adminDal.InsertAdmin(adminInfo), "注册提示");
            }
            else if (adminCount > 0)
            {
                // 添加审核信息到数据库
                AuditRequest auditRequest = new AuditRequest(adminInfo);
                AuditDal     auditDal     = new AuditDal();
                if (auditDal.CommitRequest(auditRequest))
                {
                    MessageBox.Show("已提交注册申请,请等待管理员审核", "注册提示");
                }
                else
                {
                    MessageBox.Show("提交注册申请失败!可能与服务器连接失败", "注册提示");
                }
            }
            else
            {
                MessageBox.Show("管理员录入失败,数据库连接失败", "注册提示");
            }
            this.Cursor = Cursors.Default;
            //b1 = userBLL.InsertUser(user);
            //bool b = new LogBLL().LogInsert(logInfo);
        }