private void txt_lianxi_Leave(object sender, EventArgs e) { if (!Input_Regex.IsPhoneNum(txt_lianxi.Text) || txt_lianxi.Text == "") { lab_m_lianxi.Text = "请输入正确的联系方式!"; lab_m_lianxi.ForeColor = Color.Red; } else { lab_m_lianxi.Text = ""; } }
private void txt_lianxi_Leave(object sender, EventArgs e) { txt_lianxi.Tag = 0; if (txt_lianxi.Text == "") { lab_m_lianxi.Text = "联系方式不能为空!"; lab_m_lianxi.ForeColor = Color.Red; } else { if (!Input_Regex.IsPhoneNum(txt_lianxi.Text.ToString())) { lab_m_lianxi.Text = "请检查输入的联系号码是否正确!"; lab_m_lianxi.ForeColor = Color.Red; } else { lab_m_lianxi.Text = ""; txt_lianxi.Tag = 1; } } }
private void btn_ok_Click(object sender, EventArgs e) { if (txt_gongsi.Text != "" && txt_fuzeren.Text != "" && (txt_lianxi.Text != "" && Input_Regex.IsPhoneNum(txt_lianxi.Text)) && Convert.ToBoolean(txt_dizhi.Text.Count())) { switch (Form_Type) { case 0: SqlDataReader dr = SQLClass.getcom("select id from kaifashang where gongsi = '" + txt_gongsi.Text.ToString().Trim() + "'"); bool ifcom = dr.Read(); if (ifcom) { MessageBox.Show("该开发商已存在,不能重复添加!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SQLClass.getsqlcom("insert into kaifashang values ('" + txt_gongsi.Text.ToString().Trim() + "','" + txt_dizhi.Text.ToString().Trim() + "','" + txt_lianxi.Text.ToString().Trim() + "','" + txt_fuzeren.Text.ToString().Trim() + "')"); Form_OK = 1; //操作完成 break; case 1: SQLClass.getsqlcom("update kaifashang set gongsi = '" + txt_gongsi.Text.ToString().Trim() + "', fuzeren = '" + txt_fuzeren.Text.ToString().Trim() + "', lianxi = '" + txt_lianxi.Text.ToString().Trim() + "', dizhi = '" + txt_dizhi.Text.ToString().Trim() + "' where id = '" + kfsid + "'"); Form_OK = 1; break; case 2: Form_OK = 0; //没有执行相关操作 break; } SQLClass.con_close(); this.Close(); } else { lab_message.Text = "操作失败,请检查你的输入是否正确!"; } }
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); } } }