private void txt_jine_Leave(object sender, EventArgs e) { if (Form_Type == 3) { return; } else { txt_jine.Tag = "0"; if (txt_jine.Text == "") { lab_m_jine.Text = "金额不能为空!"; lab_m_jine.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_jine.Text)) { lab_m_jine.Text = ""; txt_jine.Tag = "1"; } else { lab_m_jine.Text = "金额只能为数字!"; lab_m_jine.ForeColor = Color.Red; } } } }
private void txt_yezhu_Leave(object sender, EventArgs e) { if (Form_Type == 0 || Form_Type == 1) { txt_yezhu.Tag = "0"; if (txt_yezhu.Text == "") { lab_m_yezhu.Text = "请输入业主ID!"; lab_m_yezhu.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_yezhu.Text)) { if (zhuangtai.YezhuName(txt_yezhu.Text.Trim(), true) != "") { lab_m_yezhu.Text = "该ID业主为:" + zhuangtai.YezhuName(txt_yezhu.Text.Trim(), true); lab_m_yezhu.ForeColor = Color.Black; txt_yezhu.Tag = "1"; } else { lab_m_yezhu.Text = "业主ID不存在!"; lab_m_yezhu.ForeColor = Color.Red; } } else { lab_m_yezhu.Text = "业主ID只能为数字!"; lab_m_yezhu.ForeColor = Color.Red; } } } }
private void txt_yuangong_Leave(object sender, EventArgs e) { if (Form_Type == 2) { txt_yuangong.Tag = "0"; if (txt_yuangong.Text == "") { lab_m_yuangong.Text = "请输入员工主ID!"; lab_m_yuangong.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_yuangong.Text)) { if (zhuangtai.YuangongName(txt_yuangong.Text.Trim(), true) != "") { lab_m_yuangong.Text = "该ID员工为:" + zhuangtai.YuangongName(txt_yuangong.Text.Trim(), true); lab_m_yuangong.ForeColor = Color.Black; txt_yuangong.Tag = "1"; } else { lab_m_yuangong.Text = "员工ID不存在!"; lab_m_yuangong.ForeColor = Color.Red; } } else { lab_m_yuangong.Text = "员工ID只能为数字!"; lab_m_yuangong.ForeColor = Color.Red; } } } }
private void txt_shoufei_Leave(object sender, EventArgs e) { if (Form_Type == 3) { txt_shoufei.Tag = "0"; if (txt_shoufei.Text == "") { lab_m_shoufei.Text = "请输入收费金额的信息!"; lab_m_yezhu.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_shoufei.Text)) { lab_m_shoufei.Text = ""; txt_shoufei.Tag = "1"; } else { lab_m_shoufei.Text = "收费金额只能为数字!"; lab_m_shoufei.ForeColor = Color.Red; } } } }
private void txt_fuzeren_Leave(object sender, EventArgs e) { txt_fuzeren.Tag = 0; if (txt_fuzeren.Text == "") { lab_m_fuzeren.Text = "负责人ID不能为空!"; lab_m_fuzeren.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_fuzeren.Text)) { DataSet DSet = SQLClass.getDataSet("select xingming from yuangong where id = '" + txt_fuzeren.Text + "'", "员工信息表"); DataTable dt = DSet.Tables["员工信息表"]; if (dt.Rows.Count > 0) { lab_m_fuzeren.Text = "你输入负责人ID为:" + dt.Rows[0][0].ToString(); txt_fuzeren.Tag = 1; lab_m_fuzeren.ForeColor = Color.Black; } else { lab_m_fuzeren.Text = "该负责人ID不存在,请重新输入!"; lab_m_fuzeren.ForeColor = Color.Red; } } else { lab_m_fuzeren.Text = "负责人ID只能为数字!"; lab_m_fuzeren.ForeColor = Color.Red; } } }
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 = ""; } }
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_yuangong_Leave(object sender, EventArgs e) { if (Form_Type == 3) { txt_yuangong.Tag = "0"; if (txt_yuangong.Text == "") { lab_m_yuangong.Text = "请输入员工ID!"; lab_m_yuangong.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_yuangong.Text)) { DataSet ygDSet = SQLClass.getDataSet("select xingming from yuangong where id = '" + txt_yuangong.Text.Trim() + "'", "员工信息表"); DataTable ygdt = ygDSet.Tables["员工信息表"]; if (ygdt.Rows.Count > 0) { lab_m_yuangong.Text = "你输入的员工名称为:" + ygdt.Rows[0][0].ToString(); lab_m_yuangong.ForeColor = Color.Black; txt_yuangong.Tag = "1"; } else { lab_m_yuangong.Text = "你输入的员工ID不存在!"; lab_m_yuangong.ForeColor = Color.Red; } } else { lab_m_yuangong.Text = "员工ID只能为数字!"; lab_m_yuangong.ForeColor = Color.Red; } } } else { //lab_m_yuangong.Text = "未知错误!"; //lab_m_yuangong.ForeColor = Color.Red; } }
private void txt_username_Leave(object sender, EventArgs e) { txt_username.Tag = 0; if (txt_username.Text == "") { lab_m_username.Text = "用户名不能为空!"; lab_m_username.ForeColor = Color.Red; } else { if (Input_Regex.IsNumAndEnCh(txt_username.Text)) { DataSet DSet = SQLClass.getDataSet("select id from yuangong where username = '******'", "员工信息表"); DataTable dt = DSet.Tables["员工信息表"]; if (dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() != ygid) { lab_m_username.Text = "用户名已存在!"; lab_m_username.ForeColor = Color.Red; } else { lab_m_username.Text = ""; txt_username.Tag = 1; } } else { lab_m_username.Text = ""; txt_username.Tag = 1; } } else { lab_m_username.Text = "用户名只能为英文和数字!"; lab_m_username.ForeColor = Color.Red; } } }
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 txt_shoufei_Leave(object sender, EventArgs e) { txt_shoufei.Tag = 0; if (txt_shoufei.Text == "") { lab_m_shoufei.Text = "收费信息不能为空!"; lab_m_shoufei.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_shoufei.Text)) { lab_m_shoufei.Text = ""; txt_shoufei.Tag = 1; } else { lab_m_shoufei.Text = "费用信息只能为数字!"; lab_m_shoufei.ForeColor = Color.Red; } } }
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 txt_yezhu_Leave(object sender, EventArgs e) { if (Form_Type == 0 || Form_Type == 1 || Form_Type == 2) { return; } txt_yezhu.Tag = "0"; if (txt_yezhu.Text != "") { if (Input_Regex.IsNum(txt_yezhu.Text.Trim())) { DataSet yzDSet = SQLClass.getDataSet("select xingming,feiyong from yezhu where id = '" + txt_yezhu.Text.ToString().Trim() + "'", "业主信息表"); DataTable yzdt = yzDSet.Tables["业主信息表"]; if (yzdt.Rows.Count > 0) { lab_m_yezhu.Text = "该业主ID为:" + yzdt.Rows[0][0].ToString(); yzfy = Convert.ToInt32(yzdt.Rows[0][1].ToString()); txt_yezhu.Tag = 1; } else { lab_m_yezhu.Text = "该业主不存在,请返回修改!"; lab_m_yezhu.ForeColor = Color.Red; } } else { lab_m_yezhu.Text = "业主ID只能为数字,请返回修改!"; lab_m_yezhu.ForeColor = Color.Red; } } else { lab_m_yezhu.Text = "业主不能为空,请返回修改!"; lab_m_yezhu.ForeColor = Color.Red; } }
private void txt_yezhu_Leave(object sender, EventArgs e) { if (Form_Type == 0 || Form_Type == 1) { txt_yezhu.Tag = "0"; if (txt_yezhu.Text == "") { lab_m_yezhu.Text = "请输入业主ID!"; lab_m_yezhu.ForeColor = Color.Red; } else { if (Input_Regex.IsNum(txt_yezhu.Text)) { DataSet yzDSet = SQLClass.getDataSet("select xingming from yezhu where id = '" + txt_yezhu.Text + "'", "业主信息表"); DataTable yzdt = yzDSet.Tables["业主信息表"]; if (yzdt.Rows.Count > 0) { lab_m_yezhu.Text = "你输入的业主名称为:" + yzdt.Rows[0][0].ToString(); lab_m_yezhu.ForeColor = Color.Black; txt_yezhu.Tag = "1"; } else { lab_m_yezhu.Text = "你输入的业主ID不存在!"; lab_m_yezhu.ForeColor = Color.Red; } } else { lab_m_yezhu.Text = "业主ID只能为数字!"; lab_m_yezhu.ForeColor = Color.Red; } } } }
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 (Input_Regex.IsNumAndEnCh(txt_username.Text) && txt_username.Text != "请输入用户名") { if (txt_password.Text != "请输入密码") { if (txt_username.Text != null && txt_password.Text != null) { lab_message.Text = "正在尝试登陆,请稍后......"; if (picbox_header.Tag.ToString() == "yuangong") { DataSet ygDSet = SQLClass.getDataSet("select * from yuangong where username = '******' and password = '******'", "员工信息表"); DataTable ygdt = ygDSet.Tables["员工信息表"]; if (ygdt.Rows.Count > 0) { if (ygdt.Rows[0][6].ToString() == "0") { lab_message.Text = "你不是管理员不能够登录该系统!"; return; } else if (ygdt.Rows[0][6].ToString() == "1" || ygdt.Rows[0][6].ToString() == "2") { this.Visible = false; Main_Yuangong_Form mainForm = new Main_Yuangong_Form(); DataSet gwDSet = SQLClass.getDataSet("select * from gangwei where id = '" + ygdt.Rows[0][3].ToString() + "'", "岗位信息表"); DataTable gwdt = gwDSet.Tables["岗位信息表"]; mainForm.glyid = Convert.ToInt32(ygdt.Rows[0][0].ToString()); mainForm.glyxm = ygdt.Rows[0][1].ToString(); mainForm.glyxb = ygdt.Rows[0][2].ToString(); mainForm.glybm = gwdt.Rows[0][1].ToString(); mainForm.glygw = gwdt.Rows[0][2].ToString(); mainForm.glylx = ygdt.Rows[0][4].ToString(); mainForm.glydz = ygdt.Rows[0][5].ToString(); mainForm.glyqx = Convert.ToInt32(ygdt.Rows[0][6].ToString()); mainForm.glyyhm = ygdt.Rows[0][7].ToString(); mainForm.ShowDialog(); //显示主窗体 if (mainForm.changeuser) { txt_username.Text = "请输入用户名"; txt_password.Text = "请输入密码"; lab_message.Text = ""; txt_password.PasswordChar = Convert.ToChar(0); txt_username.ForeColor = Color.Gray; txt_password.ForeColor = Color.Gray; btn_ok.Focus(); this.Visible = true; } else { Application.Exit(); } } } else { lab_message.Text = "登录失败,请检查你的用户名或密码是否正确!"; return; } } else if (picbox_header.Tag.ToString() == "yezhu") { DataSet yzDSet = SQLClass.getDataSet("select * from yezhu where username = '******' and password = '******'", "业主信息表"); DataTable yzdt = yzDSet.Tables["业主信息表"]; if (yzdt.Rows.Count > 0) { if (yzdt.Rows[0][6].ToString() == "0") { lab_message.Text = "你的账号尚未通过管理员的审核,暂时不能登录!"; return; } else if (yzdt.Rows[0][6].ToString() == "1") { this.Visible = false; Main_Yezhu_Form mainForm = new Main_Yezhu_Form(); mainForm.yzid = Convert.ToInt32(yzdt.Rows[0][0].ToString()); mainForm.yzxm = yzdt.Rows[0][1].ToString(); mainForm.yzxb = yzdt.Rows[0][2].ToString(); mainForm.yzlx = yzdt.Rows[0][3].ToString(); mainForm.yzzz = yzdt.Rows[0][4].ToString(); mainForm.yzsfz = yzdt.Rows[0][5].ToString(); mainForm.yzqx = Convert.ToInt32(yzdt.Rows[0][6].ToString()); mainForm.yzyhm = yzdt.Rows[0][7].ToString(); mainForm.yzfy = Convert.ToInt32(yzdt.Rows[0][9].ToString()); mainForm.ShowDialog(); if (mainForm.changeuser) { txt_username.Text = "请输入用户名"; txt_password.Text = "请输入密码"; lab_message.Text = ""; txt_password.PasswordChar = Convert.ToChar(0); txt_username.ForeColor = Color.Gray; txt_password.ForeColor = Color.Gray; btn_ok.Focus(); this.Visible = true; } else { Application.Exit(); } } else if (yzdt.Rows[0][6].ToString() == "2") { lab_message.Text = "你的账号处于禁用状态,不能登录!"; return; } } else { lab_message.Text = "登录失败,请检查你的用户名或密码是否正确!"; return; } } } else { lab_message.Text = "请检查您的用户名是否正确。"; } } else { lab_message.Text = "请输入正确的密码。"; } } 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); } } }