⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookform.aspx.cs

📁 一个关于宾馆酒店管理系统的源代码
💻 CS
字号:
//文件名:BookForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient;
public partial class RoomManage_BookForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string MyForbidString = Session["MyForbid"].ToString();
        if (MyForbidString.IndexOf("A4") > 1)
        {
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
        }
        this.Page.Title = "当前位置:客房管理->旅客预订登记";
        if (Session["MyUserName"] != null)
        {//设置操作用户
            this.TextBox14.Text = Session["MyUserName"].ToString();
        }
        this.Button2.OnClientClick = "return confirm('请检查旅客预约登记信息是否正确,一旦保存就无法修改,是否继续?')";
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//保存入住旅客登记信息
        if (this.TextBox14.Text.Length > 1)
        {
            //向客房预约单数据表增加记录
            this.SqlDataSource2.Insert();
            //修改酒店房间数据表中的入住人数
            String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHotelDBConnectionString"].ConnectionString;
            string MySQL = "Update 酒店房间 Set 已住人数=已住人数+" + this.DropDownList3.SelectedValue.ToString() +
                " WHERE 房号='" + this.TextBox2.Text + "'";
            SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
            MyConnection.Open();
            SqlCommand MyCommand = MyConnection.CreateCommand();
            MyCommand.CommandText = MySQL;
            MyCommand.ExecuteNonQuery();
            if (MyConnection.State == ConnectionState.Open)
            {
                MyConnection.Close();
            }
            this.GridView1.DataBind();
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {//设置住宿人数列表项
        this.TextBox2.Text = this.GridView1.SelectedRow.Cells[1].Text.ToString();
        int My可住人数 = Convert.ToInt16(this.GridView1.SelectedRow.Cells[5].Text.ToString());
        int My已住人数 = Convert.ToInt16(this.GridView1.SelectedRow.Cells[6].Text.ToString());
        int My未住人数 = My可住人数 - My已住人数;
        this.DropDownList3.Items.Clear();
        for (int i = 1; i <= My未住人数; i++)
        {
            this.DropDownList3.Items.Add(i.ToString());
        }
        //预置入住和离开日期
        this.TextBox5.Text = DateTime.Now.Date.ToShortDateString();
        this.TextBox6.Text = DateTime.Now.Date.ToShortDateString();
    }
    public String MyPrint预约房号
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox2.Text;
        }
    }
    public String MyPrint预收押金
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox4.Text;
        }
    }
    public String MyPrint入住日期
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox5.Text;
        }
    }
    public String MyPrint离开日期
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox6.Text;
        }
    }
    public String MyPrint客人姓名
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox7.Text;
        }
    }
    public String MyPrint住宿人数
    {//设置要传递到打印页的数据
        get
        {
            return this.DropDownList3.SelectedValue.ToString();
        }
    }
    public String MyPrint客人性别
    {//设置要传递到打印页的数据
        get
        {
            return this.DropDownList4.SelectedValue.ToString();
        }
    }
    public String MyPrint联系电话
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox13.Text;
        }
    }
    public String MyPrint预约说明
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox15.Text;
        }
    }    
    protected void Button1_Click(object sender, EventArgs e)
    {//打印旅客客房预订信息
        Server.Transfer("~/RoomManage/BookPrint.aspx");
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -