private void frmPeopleInfo_Load(object sender, EventArgs e) { con = new ClsCon(); if (strID == "lend") { this.butIHouse.Visible = true; } cbSex.Items.Add("男"); cbSex.Items.Add("女"); cbSex.SelectedIndex = 0; //生成自动编号 con.ConDatabase(); SqlCommand cmd = new SqlCommand("select Max(User_IDS) from tb_User where user_type='" + strID + "'", con.conn); con.conn.Open(); string strResult = cmd.ExecuteScalar().ToString(); if (strResult != "") { strNewID = strResult.Substring(4); } else { strNewID = "1000"; } strID = strID + Convert.ToString(int.Parse(strNewID) + 1); }
private void button1_Click(object sender, EventArgs e) { con.ConDatabase(); if (this.txtNewPwd.Text.Trim().ToString() != this.txtNewPwdTwo.Text.Trim().ToString()) { this.erInfo.SetError(this.txtNewPwdTwo, "你的新密码有误!!!"); } else { SqlCommand cmd = new SqlCommand("select Max(login_id) from tb_login where login_name='" + M_str_Name + "' and login_pwd='" + this.txtOldPwd.Text.Trim().ToString() + "'", con.conn); con.closeCon(); con.conn.Open(); string str = cmd.ExecuteScalar().ToString(); con.closeCon(); if (str != "") { SqlCommand cmdL = new SqlCommand("update tb_login set login_pwd='" + clsMD5Encrypt.GetMD5Password(this.txtNewPwdTwo.Text.Trim().ToString()) + "' where login_name='" + M_str_Name + "' ", con.conn); cmdL.Connection.Open(); cmdL.ExecuteNonQuery(); con.closeCon(); MessageBox.Show("已成功更新你的密码!!!"); } else { MessageBox.Show("密码有误请重新输入!!!"); } } }
public void Restore() { try { ofd.InitialDirectory = Application.StartupPath + "\\"; ofd.Filter = "(*.bak)|*.bak|(所有文件)|*.*"; ofd.FilterIndex = 1; ofd.RestoreDirectory = true; if (ofd.ShowDialog() == DialogResult.OK) { textBox1.Text = ofd.FileName.ToString(); #region// if (this.RestoreBase(".", "sa", "", "db_showHouse", ofd.FileName.ToString()) == true) { MessageBox.Show("还原成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ClsCon con = new ClsCon(); con.ConDatabase(); con.conn.Open(); } else { //MessageBox.Show("Error"); this.button1.PerformClick(); } #endregion } } catch (Exception ey) { MessageBox.Show(ey.Message); } }
private void frmEmploeey_Load(object sender, EventArgs e) { con.ConDatabase(); flushGov(); flushStudy(); this.cbSex.Items.Add("ÄÐ"); this.cbSex.Items.Add("Å®"); this.cbSex.SelectedIndex = 0; }
private void showAll() { con.ConDatabase(); SqlDataAdapter da = new SqlDataAdapter("select * from view_empleey", con.conn); DataTable dt = new DataTable(); da.Fill(dt); this.dataGridView1.DataSource = dt.DefaultView; }
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { try { //在用户里去找这个人把房屋的编号放入这个的信息中去 ClsCon con = new ClsCon(); con.ConDatabase(); con.closeCon(); //查要租房的人不要把要出租的人也混进去 SqlCommand cmd = new SqlCommand("select Max(user_names+'您的证件号为:'+user_cardid) from tb_User where user_phone='" + textBox1.Text.Trim().ToString() + "' and user_type<>'lend'", con.conn); con.conn.Open(); string strRe = cmd.ExecuteScalar().ToString(); con.closeCon(); if (strRe != "") { SqlCommand cmdl = new SqlCommand("select Max(house_ID) from tb_User where user_phone='" + textBox1.Text.Trim().ToString() + "'", con.conn); cmdl.Connection.Open(); string strReS = cmdl.ExecuteScalar().ToString(); con.closeCon(); if (strReS == "none") { MessageBox.Show(strRe + "你有权预订房源"); this.button3.Enabled = true; this.button4.Enabled = false; } else { this.button3.Enabled = false; this.button4.Enabled = true; } SendKeys.Send("{Tab}"); } else { MessageBox.Show("电话号吗不存在"); this.textBox1.Select(0, this.textBox1.Text.Length); } } catch (Exception ey) { MessageBox.Show(ey.Message); con.conn.Close(); } } }
private void frmUserLogin_Load(object sender, EventArgs e) { con.ConDatabase(); { try { SqlDataAdapter da = new SqlDataAdapter("select * from tb_login", con.conn); DataTable dt = new DataTable(); da.Fill(dt); this.cobName.DataSource = dt.DefaultView; cobName.DisplayMember = "login_name"; } catch (Exception ey) { MessageBox.Show(ey.Message); } } }
private void fillTree() { this.treeView1.Nodes.Clear(); DataTable dtResult = new DataTable(); con.ConDatabase(); SqlDataAdapter da = new SqlDataAdapter("select * from tb_gov", con.conn); da.Fill(dtResult); TreeNode tnMain = new TreeNode("民族设定", 0, 1); for (int iRows = 0; iRows < dtResult.Rows.Count; iRows++) { TreeNode tnChild = new TreeNode(dtResult.Rows[iRows][1].ToString(), 2, 3); tnMain.Nodes.Add(tnChild); } this.treeView1.Nodes.Add(tnMain); this.treeView1.Nodes[0].ExpandAll(); }
private void frmSelect_Load(object sender, EventArgs e) { #region//加载时列出所有房源信息 try { con.ConDatabase(); SqlDataAdapter da = new SqlDataAdapter("select * from view_house", con.conn); DataTable dt = new DataTable(); da.Fill(dt); this.dataGridView1.DataSource = dt.DefaultView; } catch { } flushFaove(); flushfitment(); flushfloor(); flushmothed(); flushseat(); flushtype(); unAble(); #endregion }
/// <summary> /// 读取菜单中的信息. /// </summary> /// <param name="treeV">TreeView控件</param> public void frm_show(int n) { switch (n)//通过标识调用各子窗体 { case 0: break; case 1: { frmPeopleInfo fp = new frmPeopleInfo(); //实例化一个frmPeopleInfo窗体 fp.strID = "want"; //设置窗体中的公共变量 fp.Text = "求租人员信息"; //设置窗体的名称 fp.ShowDialog(); //用模试对话框打开窗体 fp.Dispose(); //释放窗体的所有资原 break; } case 2: { frmPeopleInfo fp = new frmPeopleInfo(); fp.strID = "lend"; fp.Text = "出租人员信息设置"; fp.ShowDialog(); fp.Dispose(); break; } case 3: { frmPeopleList fp = new frmPeopleList(); fp.ShowDialog(); fp.Dispose(); break; } case 4: { frmSelect fs = new frmSelect(); fs.ShowDialog(); fs.Dispose(); break; } case 5: { frmStateHouse fs = new frmStateHouse(); fs.ShowDialog(); fs.Dispose(); break; } case 6: { frmIntend fi = new frmIntend(); fi.ShowDialog(); fi.Dispose(); break; } case 7: { frmEmploeey fe = new frmEmploeey(); fe.ShowDialog(); fe.Dispose(); break; } case 8: { frmEmpleeyAll fe = new frmEmpleeyAll(); fe.ShowDialog(); fe.Dispose(); break; } case 9: { frmType ft = new frmType(); ft.ShowDialog(); ft.Dispose(); break; } case 10: { frmFloor ff = new frmFloor(); ff.ShowDialog(); ff.Dispose(); break; } case 11: { frmSeat fs = new frmSeat(); fs.ShowDialog(); fs.Dispose(); break; } case 12: { frmFitment ff = new frmFitment(); ff.ShowDialog(); ff.Dispose(); break; } case 13: { frmFavor ff = new frmFavor(); ff.ShowDialog(); ff.Dispose(); break; } case 14: { frmMothed fm = new frmMothed(); fm.ShowDialog(); fm.Dispose(); break; } case 15: { frmMoney fm = new frmMoney(); fm.ShowDialog(); fm.Dispose(); break; } case 16: { frmMoneyRemark fmr = new frmMoneyRemark(); fmr.ShowDialog(); fmr.Dispose(); break; } case 17: { frmBargin fb = new frmBargin(); fb.ShowDialog(); fb.Dispose(); break; } case 21: { //打开记事本 System.Diagnostics.Process.Start("notepad.exe"); break; } case 22: { //打开计算器 System.Diagnostics.Process.Start("calc.exe"); break; } case 23: { //打开WORD文档 System.Diagnostics.Process.Start("WINWORD.EXE"); break; } case 24: { //打开EXCEL文件 System.Diagnostics.Process.Start("EXCEL.EXE"); break; } case 25: { frmChangYouSelfPwd fcy = new frmChangYouSelfPwd(); fcy.M_str_Name = this.tspname.Text.ToString(); fcy.ShowDialog(); fcy.Dispose(); break; } case 26: { if (MessageBox.Show("确认退出系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Application.Exit(); //关闭当前工程 } break; } case 27: { frmStock fs = new frmStock(); fs.ShowDialog(); fs.Dispose(); break; } case 28: { frmRestore fr = new frmRestore(); fr.ShowDialog(); fr.Dispose(); break; } case 29: { ClsCon con = new ClsCon(); //实例化一个ClsCon公共类 con.ConDatabase(); //连接数据库 //调用一个清理出租人和房源之间的垃极信息 //如当出租人来要出租房时可是没有给出他房源信息这时出租人信息就没有用了 try { SqlCommand cmd = new SqlCommand(); //实例化一个SqlCommand类 cmd.Connection = con.conn; //与数据库建立关系统 cmd.Connection.Open(); //打开数据库的连接 cmd.CommandText = "proc_clear"; //存储过程的名 cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); //执行存储过程 con.closeCon(); //关闭数据库的连接 MessageBox.Show("恭喜已清除!!!"); } catch (Exception ey) { MessageBox.Show(ey.Message); } break; } case 30: { //打开帮助对话框 MessageBox.Show("\t你可以到明日科技网站\t\n\n\t 得到你想知道的\n\t 谢谢使用!!"); break; } } }
public frmMoneyRemark() { InitializeComponent(); con.ConDatabase(); }
public frmOk() { InitializeComponent(); con.ConDatabase(); }
private void frmHouse_Load(object sender, EventArgs e) { string strHouseState = string.Empty; con.ConDatabase(); flushFaove(); flushfitment(); flushfloor(); flushmothed(); flushseat(); flushtype(); if (M_str_Show == String.Empty) { try { SqlCommand cmd = new SqlCommand("select Max(house_ID) from tb_house", con.conn); cmd.Connection.Open(); strResult = cmd.ExecuteScalar().ToString(); con.closeCon(); if (strResult == "") { strResult = "hou1001"; } else { string strTemp = strResult.Substring(3); strResult = "hou" + Convert.ToString(Int32.Parse(strTemp) + 1); } this.lblHouseID.Text = "您的房屋编号为:" + strResult; } catch (Exception ey) { con.closeCon(); MessageBox.Show(ey.Message); } } else { this.button8.Visible = false; this.butOK.Visible = false; Visable(); SqlCommand cmd = new SqlCommand("select * from tb_house where house_ID='" + M_str_Show + "' ", con.conn); con.conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { lblHouseID.Text = dr[0].ToString(); this.txtName.Text = dr[1].ToString(); this.picHouse.ImageLocation = dr[8].ToString(); txtPrice.Text = dr[9].ToString(); this.nudYear.Value = Convert.ToDecimal(dr[11].ToString()); this.txtArea.Text = dr[12].ToString(); this.ttbRemark.Text = dr[13].ToString(); strHouseState = dr[4].ToString(); this.cboXing.SelectedValue = dr[2].ToString(); this.cobDong.SelectedValue = dr[3].ToString(); this.cboFavoe.SelectedValue = dr[6].ToString(); this.cobZhuang.SelectedValue = dr[5].ToString(); this.cobUser.SelectedValue = dr[7].ToString(); this.cobFlood.SelectedValue = dr[10].ToString(); } } con.closeCon(); if (strHouseState == "none") { //什么时候出显 button1.Visible = true; button2.Visible = true; } } }
public frmIntendInfo() { InitializeComponent(); con.ConDatabase(); }
public frmPeopleList() { InitializeComponent(); con.ConDatabase(); }
private void frmStateHouse_Load(object sender, EventArgs e) { this.button1.Enabled = false; ListInfo(strSql); con.ConDatabase(); }