예제 #1
0
        private void tp_OK_Click(object sender, EventArgs e)
        {
            string power = string.Empty;

            if (this.cobPower.Text == "员工")
            {
                power = "0";
            }
            else if (this.cobPower.Text == "经理")
            {
                power = "1";
            }

            #region//调用触发器去更新
            if (strTemp == "Update")
            {
                float      fmoney = Convert.ToSingle(this.txtBasePay.Text.Trim().ToString());
                SqlCommand cmd    = new SqlCommand("update view_empleey set 权限='" + power + "',电话='" + this.txtPhone.Text.Trim().ToString() + "',工资='" + fmoney + "' where 姓名='" + this.txtName.Text.Trim().ToString() + "'", con.conn);
                con.conn.Open();
                cmd.ExecuteNonQuery();
                con.closeCon();
                showAll();
                MessageBox.Show("成功更改");
                strTemp = string.Empty;
            }
            else if (strTemp == string.Empty)
            {
                MessageBox.Show("没有选取要对谁操作");
            }
            #endregion
        }
예제 #2
0
 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("密码有误请重新输入!!!");
         }
     }
 }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //查看是否有这个人,如果没有则说没有
            //如果存在则让用用户确认一下
            con.ConDatabase();
            SqlCommand cmd = new SqlCommand("select Max(house_id) from tb_user where user_phone='" + this.textBox1.Text.Trim().ToString() + "' and user_type='want'", con.conn);

            cmd.Connection.Open();
            string strInfo = cmd.ExecuteScalar().ToString();

            con.closeCon();
            if (strInfo == "none")
            {
                con.ConDatabase();
                SqlCommand cmdID = new SqlCommand("select Max(user_ids) from tb_user where user_phone='" + this.textBox1.Text.Trim().ToString() + "' and user_type='want'", con.conn);
                con.conn.Open();
                string IDInfo = cmdID.ExecuteScalar().ToString();
                con.closeCon();
                frmIntendInfo fiti = new frmIntendInfo();
                fiti.M_str_userID = IDInfo;
                fiti.Show();
                this.Hide();
            }
            else if (strInfo == "")
            {
                MessageBox.Show("你没有注册你的信息请先注册");
            }
            else
            {
                MessageBox.Show("你还有预订房源没有处理呢所以不能使用这个功能");
            }
        }
예제 #4
0
        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();
                }
            }
        }
예제 #5
0
 private void showEmp()
 {
     try
     {
         SqlDataAdapter da = new SqlDataAdapter("select employee_name,employee_ID from tb_employee", con.conn);
         DataTable      dt = new DataTable();
         con.closeCon();
         con.conn.Open();
         da.Fill(dt);
         this.comboBox1.DataSource    = dt.DefaultView;
         this.comboBox1.DisplayMember = "employee_name";
         this.comboBox1.ValueMember   = "employee_ID";
     }
     catch { }
 }
예제 #6
0
 private void ShowInfo(string strNode)
 {
     if (strNode != "民族设定")
     {
         SqlCommand cmd = new SqlCommand("select * from tb_gov where gov_name='" + strNode + "'", con.conn);
         cmd.Connection.Open();
         SqlDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             this.textBox1.Text     = dr[0].ToString();
             this.textBox2.Text     = dr[1].ToString();
             this.richTextBox1.Text = dr[2].ToString();
         }
         dr.Close();
         con.closeCon();
     }
 }
예제 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (M_str_info[3] != null)//任意拿出一个元素看是否有值
            {
                cmai.EID   = this.comboBox1.SelectedValue.ToString();
                cmai.EName = this.comboBox1.Text.ToString();
                cmai.Pday  = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                cmai.PM    = Convert.ToSingle(this.textBox2.Text.Trim().ToString());
                cmai.Mark  = this.richTextBox1.Text.ToString();

                cmai.LID    = M_str_info[0];
                cmai.LName  = M_str_info[1];
                cmai.LPhone = M_str_info[2];
                cmai.WID    = M_str_info[3];
                cmai.WName  = M_str_info[4];
                cmai.Wphone = M_str_info[5];
                cmai.HID    = M_str_info[6];

                clsMoneyAndInfoMethod cm = new clsMoneyAndInfoMethod();
                if (cm.insert_table(cmai))
                {
                    try
                    {
                        SqlCommand cmd = new SqlCommand("update tb_house set house_state='success' where house_id='" + cmai.HID + "'", con.conn);
                        con.conn.Open();
                        cmd.ExecuteNonQuery();
                        con.closeCon();
                        MessageBox.Show("提交成功!!!");
                        this.Close();
                    }
                    catch
                    {
                        con.closeCon();
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("这是为选定房源后交费而用的\n你的操作可能有问题", "提示");
            }
        }
예제 #8
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Trim().ToString() == "")
            {
                this.epInfo.SetError(this.textBox1, "请输入你的手机号");
            }
            else
            {
                SqlCommand cmdUS = new SqlCommand("select Max(house_id) from tb_user  where user_phone='" + this.textBox1.Text.Trim().ToString() + "'", con.conn);
                con.conn.Open();
                string strTempID = cmdUS.ExecuteScalar().ToString();
                con.closeCon();

                SqlCommand cmd = new SqlCommand("update tb_house set house_state='none' where house_ID='" + strTempID + "'", con.conn);
                con.conn.Open();
                cmd.ExecuteNonQuery();
                con.closeCon();



                SqlCommand cmdU = new SqlCommand("update tb_user set house_id='none' where user_phone='" + this.textBox1.Text.Trim().ToString() + "'", con.conn);
                con.conn.Open();
                cmdU.ExecuteNonQuery();
                con.closeCon();

                //用户表里记下那个用记定了那个房子


                this.epInfo.SetError(this.textBox1, "");
                ListInfo(strSql);
                MessageBox.Show("你已成功取消" + strTempID + "号房源的预订");
                this.button4.Enabled = false;
            }
        }
예제 #9
0
        private void fillTree()
        {
            this.treeView1.Nodes.Clear();
            DataTable dtResult = new DataTable();

            con.ConDatabase();
            con.closeCon();
            con.conn.Open();
            SqlDataAdapter da = new SqlDataAdapter("select * from tb_fitment", 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();
        }
예제 #10
0
        private void listView1_Click(object sender, EventArgs e)
        {
            string     strID = this.listView1.SelectedItems[0].Text.ToString();
            string     sql   = "select User_IDs,User_names,User_homePhone,User_cardID,User_phone from tb_User where user_ids='" + strID + "'";
            SqlCommand cmd   = new SqlCommand(sql, con.conn);

            con.closeCon();
            cmd.Connection.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            if (strID.Substring(0, 4) == "lend")
            {
                this.tabControl1.SelectTab(0);
                while (dr.Read())
                {
                    this.textBox1.Text = dr[0].ToString();
                    this.textBox2.Text = dr[1].ToString();
                    this.textBox3.Text = dr[2].ToString();
                    this.textBox4.Text = dr[3].ToString();
                    this.textBox5.Text = dr[4].ToString();
                }
            }
            else
            {
                this.tabControl1.SelectTab(1);
                while (dr.Read())
                {
                    this.textBox10.Text = dr[0].ToString();
                    this.textBox9.Text  = dr[1].ToString();
                    this.textBox8.Text  = dr[2].ToString();
                    this.textBox7.Text  = dr[3].ToString();
                    this.textBox6.Text  = dr[4].ToString();
                }
            }
            dr.Close();
            con.closeCon();
            tb_update.Enabled = true;
        }
예제 #11
0
        /// <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;
            }
            }
        }
예제 #12
0
        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;
                }
            }
        }