Exemple #1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            string rnum   = txtNum.Text.Trim();
            string rtype  = comType.Text.Trim();
            string rmoney = txtMoney.Text.Trim();

            if (rtype == "" || rnum == "" || rmoney == "")
            {
                MessageBox.Show("请先选择要删除的信息");
            }
            else
            {
                int i = DBhelp.exeSql("delete from [rooms] where rNum=N'" + rnum + "'");
                if (i > 0)
                {
                    MessageBox.Show("删除成功");
                    txtNum.Text    = "";
                    txtMoney.Text  = "";
                    txtBeizhu.Text = "";
                    comType.Text   = "";
                    shuaxin();
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtYajin.Text == "" || txtNum.Text == "")
            {
                MessageBox.Show("信息不完整,无法提交");
            }
            else
            {
                string rnum   = txtNum.Text.Trim();
                int    yajin1 = Convert.ToInt32(txtByajin.Text);
                int    yajin2 = Convert.ToInt32(txtYajin.Text);


                string yajin = (yajin1 + yajin2).ToString();
                int    i     = DBhelp.exeSql("update [Customer] set rYajin=N'" + yajin + "' where rNum=N'" + rnum + "'");
                if (i > 0)
                {
                    MessageBox.Show("补交成功");
                    txtName.Text   = "";
                    txtNum.Text    = "";
                    txtNum1.Text   = "";
                    txtDate.Text   = "";
                    txtMoney.Text  = "";
                    txtYajin.Text  = "";
                    txtByajin.Text = "";
                }
                else
                {
                    MessageBox.Show("补交失败");
                }
            }
        }
Exemple #3
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            string uname = txtusername.Text.Trim();

            if (uname == "")
            {
                MessageBox.Show("请先选择要删除的信息");
            }
            else
            {
                int i = DBhelp.exeSql("delete from [users] where userName=N'" + uname + "'");
                if (i > 0)
                {
                    MessageBox.Show("删除成功");
                    txtusername.Text = "";
                    txtuserpwd.Text  = "";
                    comType.Text     = "";
                    shuaxin();
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
        }
Exemple #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string uname = txtusername.Text.Trim();
            string upwd  = txtuserpwd.Text.Trim();
            string utype = comType.Text.Trim();

            if (uname == "" || upwd == "")
            {
                MessageBox.Show("请先选择要修改的信息");
            }
            else
            {
                if (upwd != lpwd || utype != ltype)
                {
                    int i = DBhelp.exeSql("update [users] set userPwd=N'" + upwd + "',userType=N'" + utype + "' where userName=N'" + uname + "'");
                    if (i > 0)
                    {
                        MessageBox.Show("修改成功");
                        txtusername.Text = "";
                        txtuserpwd.Text  = "";
                        comType.Text     = "";
                        shuaxin();
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                    }
                }
                else
                {
                    MessageBox.Show("请输入修改的内容");
                }
            }
        }
Exemple #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string uname = txtusername.Text.Trim();
            string upwd  = txtuserpwd.Text.Trim();
            string utype = comType.Text.Trim();

            if (uname == "" || upwd == "")
            {
                MessageBox.Show("输入的数据不完整,无法添加");
            }
            else
            {
                DataSet ds = DBhelp.getSql("select * from [users] where userName='******'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("此用户已存在");
                }
                else
                {
                    int i = DBhelp.exeSql("insert into [users] values(N'" + uname + "',N'" + upwd + "',N'" + utype + "')");
                    if (i > 0)
                    {
                        MessageBox.Show("添加成功");
                        txtusername.Text = "";
                        txtuserpwd.Text  = "";
                        comType.Text     = "";
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
            }
        }
        private void btnzhu_Click(object sender, EventArgs e)
        {
            string uname = txtName.Text.Trim();
            string ufnum = txtNum.Text.Trim();

            if (uname == "" || ufnum == "")
            {
                MessageBox.Show("请先选入客户");
            }
            else
            {
                int i = DBhelp.exeSql("delete from [yuding] where yName=N'" + uname + "' and rNum=N'" + ufnum + "'");
                if (i > 0)
                {
                    string ee = "空";
                    int    a  = DBhelp.exeSql("update [rooms] set rZhuangtai=N'" + ee + "' where rNum=N'" + ufnum + "'");
                    if (a > 0)
                    {
                        MessageBox.Show("取消预定成功");
                        txtName.Text    = "";
                        txtPhone.Text   = "";
                        txtDate.Text    = "";
                        txtTianshu.Text = "";
                        txtBeizhu.Text  = "";
                        comRoom.Text    = "";
                        txtMoney.Text   = "";
                        txtNum.Text     = "";
                        comYajin.Text   = "";
                        txtzhushi.Text  = "";
                        shuaxin();
                    }
                    else
                    {
                        MessageBox.Show("房间状态出错");
                    }
                }
                else
                {
                    MessageBox.Show("取消预定失败");
                }
            }
        }
Exemple #7
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("添加失败");
                    }
                }
            }
        }
Exemple #8
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("请输入修改的内容");
                }
            }
        }
Exemple #9
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("退房失败");
                }
            }
        }
Exemple #10
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("预定失败");
                    }
                }
            }
        }