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 (txt_jianzu.Text != "" && txt_dizhi.Text != "") { switch (Form_Type) { case 0: SqlDataReader dr = SQLClass.getcom("select id from fangchan where jianzu = '" + txt_jianzu.Text.ToString().Trim() + "'"); bool ifcom = dr.Read(); if (ifcom) { MessageBox.Show("该楼房已存在,不能重复添加!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SQLClass.getsqlcom("insert into fangchan values ('" + txt_jianzu.Text.ToString().Trim() + "','" + txt_dizhi.Text.ToString().Trim() + "','" + zhuangtai.KaifashangName(combox_kfs.SelectedItem.ToString(), false) + "','" + datetime_riqi.Text + "','" + txt_beizhu.Text.ToString().Trim() + "')"); Form_OK = 1; //操作完成 break; case 1: SQLClass.getsqlcom("update fangchan set jianzu = '" + txt_jianzu.Text.ToString().Trim() + "', dizhi = '" + txt_dizhi.Text.ToString().Trim() + "', kaifashangid = '" + zhuangtai.KaifashangName(combox_kfs.SelectedItem.ToString(), false) + "', shijian = '" + datetime_riqi.Text.ToString() + "', beizhu = '" + txt_beizhu.Text.ToString().Trim() + "' where id = '" + fcid + "'"); Form_OK = 1; break; case 2: Form_OK = 0; break; } SQLClass.con_close(); this.Close(); } else { lab_messgae.Text = "操作失败,请检查你的输入是否正确!"; } }
private void btn_ok_Click(object sender, EventArgs e) { if (txt_shixiang.Tag.ToString() == "1" && txt_yuangong.Tag.ToString() == "1") { switch (Form_Type) { case 0: SQLClass.getcom("insert into richang values ('" + txt_shixiang.Text.Trim() + "', '" + date_shijian.Text.ToString() + "', '0', '" + txt_yuangong.Text.Trim() + "', '" + txt_beizhu.Text.Trim() + "')"); Form_OK = 1; break; case 1: SQLClass.getcom("update richang set shixiang = '" + txt_shixiang.Text.Trim() + "',shijian = '" + date_shijian.ToString() + "', yuangongid = '" + txt_yuangong.Text.Trim() + ", beizhu = '" + txt_beizhu.Text.Trim() + "' where id = '" + rcid + "'"); Form_OK = 1; break; case 2: break; } SQLClass.con_close(); this.Close(); } }
private void txt_gangwei_Leave(object sender, EventArgs e) { txt_gangwei.Tag = 0; if (txt_gangwei.Text == "") { lab_m_gangwei.Text = "岗位不能为空!"; lab_m_gangwei.ForeColor = Color.Red; } else { SqlDataReader dr = SQLClass.getcom("select * from gangwei where gangwei = '" + txt_gangwei.Text + "'"); bool ifcom = dr.Read(); if (ifcom) { lab_m_gangwei.Text = "你输入的岗位名称已存在"; lab_m_gangwei.ForeColor = Color.Red; } else { lab_m_gangwei.Text = ""; txt_gangwei.Tag = 1; } } }
private void txt_username_Leave(object sender, EventArgs e) { if (!Input_Regex.IsNumAndEnCh(txt_username.Text) || txt_username.Text == "") { lab_m_username.Text = "请输入正确的登陆用户名!"; lab_m_username.ForeColor = Color.Red; } else { SQL_Class SQLClass = new SQL_Class(); SqlDataReader dr = SQLClass.getcom("select * from yezhu where username = '******'"); bool ifcom = dr.Read(); if (ifcom) { lab_m_username.Text = "登陆用户名已存在!"; lab_m_username.ForeColor = Color.Red; } else { lab_m_username.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); } } }