Ejemplo n.º 1
0
 private void txt_shenfenzheng_Leave(object sender, EventArgs e)
 {
     if (!Input_Regex.IsIdCard(txt_shenfenzheng.Text))
     {
         lab_m_shenfenzheng.Text      = "请输入正确的身份证号码!";
         lab_m_shenfenzheng.ForeColor = Color.Red;
     }
     else
     {
         lab_m_shenfenzheng.Text = "";
     }
 }
Ejemplo n.º 2
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (Form_Type == 1)
            {
                if (txt_xingming.Text != "" && (Input_Regex.IsPhoneNum(txt_lianxi.Text) && txt_lianxi.Text != "") && (Input_Regex.IsIdCard(txt_shenfenzheng.Text) && txt_shenfenzheng.Text != "") && (Convert.ToBoolean(txt_zhuzhi.Text.Count()) && txt_zhuzhi.Text != "") && (Input_Regex.IsNumAndEnCh(txt_username.Text) || txt_username.Text != ""))
                {
                    if (rdo_nv.Checked == true)
                    {
                        rdo_nan.Tag = "女";
                    }
                    else
                    {
                        rdo_nan.Tag = "男";
                    }
                    if (txt_password1.Text != "" && txt_password2.Text != "" && txt_password2.Text == txt_password1.Text)
                    {
                        SQLClass.getsqlcom("update yezhu set xingming = '" + txt_xingming.Text.ToString().Trim() + "', xingbie = '" + rdo_nan.Tag.ToString() + "', lianxi = '" + txt_lianxi.Text.ToString().Trim() + "', zhuzhi = '" + txt_zhuzhi.Text.ToString().Trim() + "', shenfenzheng = '" + txt_shenfenzheng.Text.ToString().Trim() + "', username = '******', password = '******' where id = '" + yzid + "'");
                    }
                    else
                    {
                        SQLClass.getsqlcom("update yezhu set xingming = '" + txt_xingming.Text.ToString().Trim() + "', xingbie = '" + rdo_nan.Tag.ToString() + "', lianxi = '" + txt_lianxi.Text.ToString().Trim() + "', zhuzhi = '" + txt_zhuzhi.Text.ToString().Trim() + "', shenfenzheng = '" + txt_shenfenzheng.Text.ToString().Trim() + "', username = '******' where id = '" + yzid + "'");
                    }
                    Form_OK = 1;
                    this.Close();
                }
                else
                {
                    lab_message_reg.Text = "修改失败,请检查输入是否正确!";
                }
            }
            else
            {
                SqlDataReader dr    = SQLClass.getcom("select * from yezhu where username = '******'");
                bool          ifcom = dr.Read();
                if (!ifcom)
                {
                    if (txt_xingming.Text != "" && (Input_Regex.IsPhoneNum(txt_lianxi.Text) && txt_lianxi.Text != "") && (Input_Regex.IsIdCard(txt_shenfenzheng.Text) && txt_shenfenzheng.Text != "") && (Convert.ToBoolean(txt_zhuzhi.Text.Count()) && txt_zhuzhi.Text != "") && (Input_Regex.IsNumAndEnCh(txt_username.Text) || txt_username.Text != "") && txt_password1.Text != "" && txt_password2.Text != "" && txt_password2.Text == txt_password1.Text)
                    {
                        //lab_message_reg.Text = "注册成功,请等待管理员审核!";
                        if (rdo_nv.Checked == true)
                        {
                            rdo_nan.Tag = "女";
                        }
                        else
                        {
                            rdo_nan.Tag = "男";
                        }
                        SQLClass.getsqlcom("insert into yezhu values ('" + txt_xingming.Text + "','" + rdo_nan.Tag.ToString() + "','" + txt_lianxi.Text + "','" + txt_zhuzhi.Text + "','" + txt_shenfenzheng.Text + "','0','" + txt_username.Text + "','" + txt_password1.Text + "','0')");
                        //if (Form_Type == 0)
                        //{

                        //}
                        //else
                        //{

                        //}
                        Form_OK = 1;
                        MessageBox.Show("注册成功,请等待管理员审核!", "注册成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        lab_message_reg.Text = "注册失败,请检查输入是否正确!";
                    }
                }
                else
                {
                    MessageBox.Show("注册失败,你的输入的用户名已存在!", "注册失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }