Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string uname      = txtName.Text.Trim();
            string uzhengjian = txtZhengjian.Text.Trim();
            string rnum       = txtNum.Text.Trim();
            string ugender    = comGender.Text.Trim();

            if (rnum != "" && uzhengjian != "" && uname != "" && ugender != "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [Customer] where bName=N'" + uname + "' and bGender=N'" + ugender + "' and bZhengjian =N'" + uzhengjian + "' and rNum=N'" + rnum + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource             = ds.Tables[0];
                    dataGridView1.Columns[0].HeaderText  = "ID";
                    dataGridView1.Columns[1].HeaderText  = "姓名";
                    dataGridView1.Columns[2].HeaderText  = "性别";
                    dataGridView1.Columns[3].HeaderText  = "证件号码";
                    dataGridView1.Columns[4].HeaderText  = "手机号码";
                    dataGridView1.Columns[5].HeaderText  = "入住日期";
                    dataGridView1.Columns[6].HeaderText  = "预计天数";
                    dataGridView1.Columns[7].HeaderText  = "用户备注";
                    dataGridView1.Columns[8].HeaderText  = "房间类型";
                    dataGridView1.Columns[9].HeaderText  = "房间号码";
                    dataGridView1.Columns[10].HeaderText = "价格";
                    dataGridView1.Columns[11].HeaderText = "押金";
                    dataGridView1.Columns[12].HeaderText = "房间备注";
                }
                else
                {
                    MessageBox.Show("宾客信息输入有误");
                }
            }
            else
            {
                MessageBox.Show("请输入完整的信息");
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string lname      = txtName.Text.Trim();
            string lzhengjian = txtZhengjian.Text.Trim();

            if (lname != "" && lzhengjian != "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [lishi] where bName=N'" + lname + "'  and bZhengjian =N'" + lzhengjian + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
                else
                {
                    MessageBox.Show("宾客信息输入有误");
                }
            }
            else
            {
                MessageBox.Show("请输入完整的信息");
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string rtype     = comType.Text.Trim();
            string rnum      = txtNum.Text.Trim();
            string rmoney    = txtMoney.Text.Trim();
            string rbeizhu   = txtBeizhu.Text.Trim();
            string zhuangtai = "空";

            if (rtype == "" || rnum == "" || rmoney == "")
            {
                MessageBox.Show("输入的信息不完整,无法添加");
            }
            else
            {
                DataSet ds = DBhelp.getSql("select * from [rooms] where rNum='" + rnum + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("该房间号已存在");
                }
                else
                {
                    int i = DBhelp.exeSql("insert into [rooms] values(N'" + rnum + "',N'" + rtype + "',N'" + rmoney + "',N'" + zhuangtai + "',N'" + rbeizhu + "')");
                    if (i > 0)
                    {
                        MessageBox.Show("添加成功");
                        txtMoney.Text  = "";
                        txtNum.Text    = "";
                        comType.Text   = "";
                        txtBeizhu.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
            }
        }
Beispiel #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string rnum    = txtNum.Text.Trim();
            string rtype   = comType.Text.Trim();
            string rmoney  = txtMoney.Text.Trim();
            string rbeizhu = txtBeizhu.Text.Trim();

            if (rtype == "" || rnum == "" || rmoney == "")
            {
                MessageBox.Show("请先选择要修改的信息");
            }
            else
            {
                if (rtype != type || rmoney != money || rbeizhu != beizhu)
                {
                    int i = DBhelp.exeSql("update [rooms] set rType=N'" + rtype + "',rMoney=N'" + rmoney + "',rBeizhu=N'" + rbeizhu + "'  where rNum=N'" + rnum + "'");
                    if (i > 0)
                    {
                        MessageBox.Show("修改成功");
                        txtNum.Text    = "";
                        txtMoney.Text  = "";
                        txtBeizhu.Text = "";
                        comType.Text   = "";
                        shuaxin();
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                    }
                }
                else
                {
                    MessageBox.Show("请输入修改的内容");
                }
            }
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string uname  = txtName.Text.Trim();
            string uphone = txtPhone.Text.Trim();
            string rnum   = txtNum.Text.Trim();
            string udate  = txtDate.Text.Trim();

            if (rnum != "" && uphone != "" && uname != "" && udate != "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [yuding] where yName=N'" + uname + "' and yTime=N'" + udate + "' and yPhone =N'" + uphone + "' and rNum=N'" + rnum + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource             = ds.Tables[0];
                    dataGridView1.Columns[0].HeaderText  = "编号";
                    dataGridView1.Columns[1].HeaderText  = "姓名";
                    dataGridView1.Columns[2].HeaderText  = "手机号码";
                    dataGridView1.Columns[3].HeaderText  = "入住时间";
                    dataGridView1.Columns[4].HeaderText  = "入住天数";
                    dataGridView1.Columns[5].HeaderText  = "客户备注";
                    dataGridView1.Columns[6].HeaderText  = "房间类型";
                    dataGridView1.Columns[7].HeaderText  = "房间号";
                    dataGridView1.Columns[8].HeaderText  = "单价";
                    dataGridView1.Columns[9].HeaderText  = "押金";
                    dataGridView1.Columns[10].HeaderText = "房间备注";
                }
                else
                {
                    MessageBox.Show("预定信息输入有误");
                }
            }
            else
            {
                MessageBox.Show("请输入完整的信息");
            }
        }
Beispiel #6
0
        private void chazhao_Click(object sender, EventArgs e)
        {
            string rnum       = txtNum.Text.Trim();
            string rtype      = comType.Text.Trim();
            string rzhuangtai = comZhuangtai.Text.Trim();

            if (rnum == "" && rtype != "" && rzhuangtai != "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [rooms] where rType=N'" + rtype + "' and rZhuangtai=N'" + rzhuangtai + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                    wenzi();

                    comType.Text      = "";
                    comZhuangtai.Text = "";
                }
                else
                {
                    MessageBox.Show("房间信息输入有误");
                }
            }
            else if (rnum == "" && rtype == "" && rzhuangtai == "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [rooms] ");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                    wenzi();
                }
                else
                {
                    MessageBox.Show("房间信息输入有误");
                }
            }
            else if (rnum != "" && rtype == "" && rzhuangtai == "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [rooms] where rNum=N'" + rnum + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                    wenzi();
                    txtNum.Text = "";
                }
                else
                {
                    MessageBox.Show("房间信息输入有误");
                }
            }
            else if (rnum == "" && rtype != "" && rzhuangtai == "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [rooms] where rType=N'" + rtype + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                    wenzi();
                    comType.Text = "";
                }
                else
                {
                    MessageBox.Show("房间信息输入有误");
                }
            }
            else if (rnum == "" && rtype == "" && rzhuangtai != "")
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [rooms] where rZhuangtai=N'" + rzhuangtai + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                    wenzi();
                    comZhuangtai.Text = "";
                }
                else
                {
                    MessageBox.Show("房间信息输入有误");
                }
            }
            else
            {
                MessageBox.Show("请单独输入房号,类型状态可以一起");
                comType.Text      = "";
                comZhuangtai.Text = "";
                txtNum.Text       = "";
            }
        }
Beispiel #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            string rnum   = txtNum.Text.Trim();
            string uname  = txtName.Text.Trim();
            string yajin  = txtYajin.Text.Trim();
            string ushifu = txtShifu.Text.Trim();

            if (yajin == "")
            {
                MessageBox.Show("请先查询信息");
            }
            else
            {
                if (ushifu != "")
                {
                    int i = DBhelp.exeSql("delete from [Customer] where bName=N'" + uname + "' and rNum=N'" + rnum + "'");
                    if (i > 0)
                    {
                        string ee = "空";
                        int    a  = DBhelp.exeSql("update [rooms] set rZhuangtai=N'" + ee + "' where rNum=N'" + rnum + "'");
                        if (a > 0)
                        {
                            ltdate   = DateTime.Now.ToShortDateString().ToString();
                            lxiaofei = txtShifu.Text.Trim();
                            int c = DBhelp.exeSql("insert into [lishi] values(N'" + lid + "',N'" + lname + "',N'" + lgender + "',N'" + lzhengjian + "',N'" + lphone + "',N'" + lzdate + "',N'" + ltdate + "',N'" + ltianshu + "',N'" + lxiaofei + "',N'" + ltype + "',N'" + lnum + "',N'" + lbeizhu + "')");;
                            if (c > 0)
                            {
                                MessageBox.Show("退房成功");
                                txtName.Text             = "";
                                txtNum.Text              = "";
                                txtShifu.Text            = "";
                                txtYingfu.Text           = "";
                                txtYajin.Text            = "";
                                txtZhaoling.Text         = "";
                                dataGridView1.DataSource = "";
                            }
                            else
                            {
                                MessageBox.Show("历史记录加载出错");
                            }
                        }


                        else
                        {
                            MessageBox.Show("房间状态出现故障");
                        }
                    }
                    else
                    {
                        MessageBox.Show("请输入宾客的消费");
                    }
                }


                else
                {
                    MessageBox.Show("退房失败");
                }
            }
        }
Beispiel #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            int yajin = 0;

            string rnum  = txtNum.Text.Trim();
            string uname = txtName.Text.Trim();

            if (uname == "" || rnum == "")
            {
                MessageBox.Show("输入的信息不完整,无法查询");
            }
            else
            {
                DataSet ds = new DataSet();
                ds = DBhelp.getSql("select * from [Customer] where rNum=N'" + rnum + "' and bName=N'" + uname + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];

                    lid        = ds.Tables[0].Rows[0][0].ToString();
                    lname      = ds.Tables[0].Rows[0][1].ToString();
                    lgender    = ds.Tables[0].Rows[0][2].ToString();
                    lzhengjian = ds.Tables[0].Rows[0][3].ToString();
                    lphone     = ds.Tables[0].Rows[0][4].ToString();
                    lzdate     = ds.Tables[0].Rows[0][5].ToString();
                    ltianshu   = ds.Tables[0].Rows[0][6].ToString();
                    ltype      = ds.Tables[0].Rows[0][8].ToString();
                    lnum       = ds.Tables[0].Rows[0][9].ToString();
                    lbeizhu    = ds.Tables[0].Rows[0][12].ToString();

                    dataGridView1.Columns[0].HeaderText  = "ID";
                    dataGridView1.Columns[1].HeaderText  = "姓名";
                    dataGridView1.Columns[2].HeaderText  = "性别";
                    dataGridView1.Columns[3].HeaderText  = "证件号码";
                    dataGridView1.Columns[4].HeaderText  = "手机号码";
                    dataGridView1.Columns[5].HeaderText  = "入住日期";
                    dataGridView1.Columns[6].HeaderText  = "预计天数";
                    dataGridView1.Columns[7].HeaderText  = "用户备注";
                    dataGridView1.Columns[8].HeaderText  = "房间类型";
                    dataGridView1.Columns[9].HeaderText  = "房间号码";
                    dataGridView1.Columns[10].HeaderText = "价格";
                    dataGridView1.Columns[11].HeaderText = "押金";
                    dataGridView1.Columns[12].HeaderText = "房间备注";
                    txtYingfu.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString();
                    txtYajin.Text  = dataGridView1.CurrentRow.Cells[11].Value.ToString();
                    int yingfu = Convert.ToInt32(txtYingfu.Text);
                    if (txtYajin.Text != "")
                    {
                        yajin = Convert.ToInt32(txtYajin.Text);
                    }
                    else
                    {
                        txtYajin.Text = "0";
                    }
                    txtZhaoling.Text = (yajin - yingfu).ToString();
                }
                else
                {
                    MessageBox.Show("没有这个人");
                }
            }
        }
Beispiel #9
0
        private void btnzhu_Click(object sender, EventArgs e)
        {
            string uname    = txtName.Text.Trim();
            string uphone   = txtPhone.Text.Trim();
            string ushijian = txtDate.Text.Trim();
            string utianshu = txtTianshu.Text.Trim();
            string ubeizhu  = txtBeizhu.Text.Trim();
            string uleixing = comRoom.Text.Trim();
            string ujiage   = txtMoney.Text.Trim();
            string unum     = txtNum.Text.Trim();
            string uyajin   = comYajin.Text.Trim();
            string uybeizhu = txtzhushi.Text.Trim();

            if (uname == "" || uphone == "" || ushijian == "" || utianshu == "" || uleixing == "" || ujiage == "" || unum == "")
            {
                MessageBox.Show("输入的信息不完整,无法预定");
            }
            else
            {
qian:
                string id = "";         //组合随机生成的id
                int    linshi = 0;      //接收随机生成的数字
                Random aa     = new Random();
                for (int i = 0; i < 4; i++)
                {
                    linshi = aa.Next(0, 9);
                    id     = id + linshi;
                }
                int ID = Convert.ToInt32(id);  //将id转换为 int类型

                DataSet ds = DBhelp.getSql("select * from [yuding] where ID='" + ID + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("找到了");
                    goto qian;
                }
                else
                {
                    int i = DBhelp.exeSql("insert into [yuding] values(" + ID + ",N'" + uname + "',N'" + uphone + "',N'" + ushijian + "',N'" + utianshu + "',N'" + ubeizhu + "',N'" + uleixing + "',N'" + unum + "',N'" + ujiage + "',N'" + uyajin + "',N'" + uybeizhu + "')");
                    if (i > 0)
                    {
                        string ee = "预定";
                        int    a  = DBhelp.exeSql("update [rooms] set rZhuangtai=N'" + ee + "' where rNum=N'" + unum + "'");
                        if (a > 0)
                        {
                            MessageBox.Show("预定成功");
                            shuaxin();
                            txtName.Text    = "";
                            txtPhone.Text   = "";
                            txtDate.Text    = "";
                            txtTianshu.Text = "";
                            txtBeizhu.Text  = "";
                            comRoom.Text    = "";
                            txtMoney.Text   = "";
                            txtNum.Text     = "";
                            comYajin.Text   = "";
                            txtzhushi.Text  = "";
                        }
                        else
                        {
                            MessageBox.Show("该房间无效");
                        }
                    }
                    else
                    {
                        MessageBox.Show("预定失败");
                    }
                }
            }
        }