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

📄 printform.aspx.cs

📁 一个关于宾馆酒店管理系统的源代码
💻 CS
字号:
//文件名:PrintForm.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;

public partial class RoomManage_PrintForm : System.Web.UI.Page
{
    private static string My旅客账单类型 = "旅客入住单";
    protected void Page_Load(object sender, EventArgs e)
    {
        string MyForbidString = Session["MyForbid"].ToString();
        if (MyForbidString.IndexOf("A7") > 1)
        {
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
        }
        this.Page.Title = "当前位置:客房管理->打印旅客账单";     
    }
    protected void Button1_Click(object sender, EventArgs e)
    {//查询旅客入住单/结账单信息
        My旅客账单类型 = this.DropDownList1.SelectedValue.ToString();
        string MySQL = "";
        string MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHotelDBConnectionString"].ConnectionString;
        if (My旅客账单类型 == "旅客入住单")
        {
            MySQL = "Select * From 客房入住单 WHERE  入住房号 LIKE '%" + this.TextBox1.Text + "%' OR 客人姓名 LIKE '%" + this.TextBox2.Text + "%'";
            this.SqlDataSource1.ConnectionString = MySQLConnectionString;
            this.SqlDataSource1.SelectCommand = MySQL;
            this.SqlDataSource1.DataBind();
            this.GridView1.DataBind();
            this.MultiView1.ActiveViewIndex = 0;
        }
        if (My旅客账单类型 == "旅客结账单")
        {
            MySQL = "Select *From 客房结账单 WHERE  入住房号 LIKE '%" + this.TextBox1.Text + "%' OR 客人姓名 LIKE '%" + this.TextBox2.Text + "%'";
            this.SqlDataSource2.ConnectionString = MySQLConnectionString;
            this.SqlDataSource2.SelectCommand = MySQL;
            this.SqlDataSource2.DataBind();
            this.GridView2.DataBind();
            this.MultiView1.ActiveViewIndex = 1;
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//打印旅客入住单/结账单信息        
        if (My旅客账单类型 == "旅客入住单")
        {
            HttpCookie My入住编号 = new HttpCookie("My入住编号");
            My入住编号.Value = this.GridView1.SelectedRow.Cells[1].Text.ToString();
            Response.Cookies.Add(My入住编号);
            HttpCookie My入住房号 = new HttpCookie("My入住房号");
            My入住房号.Value = this.GridView1.SelectedRow.Cells[2].Text.ToString();
            Response.Cookies.Add(My入住房号);
            HttpCookie My折扣价格 = new HttpCookie("My折扣价格");
            My折扣价格.Value = this.GridView1.SelectedRow.Cells[3].Text.ToString();
            Response.Cookies.Add(My折扣价格);
            HttpCookie My预收押金 = new HttpCookie("My预收押金");
            My预收押金.Value = this.GridView1.SelectedRow.Cells[4].Text.ToString();
            Response.Cookies.Add(My预收押金);
            HttpCookie My入住日期 = new HttpCookie("My入住日期");
            My入住日期.Value = DateTime.Parse(this.GridView1.SelectedRow.Cells[5].Text.ToString()).ToShortDateString();
            Response.Cookies.Add(My入住日期);
            HttpCookie My离开日期 = new HttpCookie("My离开日期");
            My离开日期.Value = DateTime.Parse(this.GridView1.SelectedRow.Cells[6].Text.ToString()).ToShortDateString();
            Response.Cookies.Add(My离开日期);
            HttpCookie My客人姓名 = new HttpCookie("My客人姓名");
            My客人姓名.Value = this.GridView1.SelectedRow.Cells[7].Text.ToString();
            Response.Cookies.Add(My客人姓名);
            HttpCookie My证件名称 = new HttpCookie("My证件名称");
            My证件名称.Value = this.GridView1.SelectedRow.Cells[8].Text.ToString();
            Response.Cookies.Add(My证件名称);
            HttpCookie My证件号码 = new HttpCookie("My证件号码");
            My证件号码.Value = this.GridView1.SelectedRow.Cells[9].Text.ToString();
            Response.Cookies.Add(My证件号码);
            HttpCookie My证件地址 = new HttpCookie("My证件地址");
            My证件地址.Value = this.GridView1.SelectedRow.Cells[10].Text.ToString();
            Response.Cookies.Add(My证件地址);
            HttpCookie My住宿人数 = new HttpCookie("My住宿人数");
            My住宿人数.Value = this.GridView1.SelectedRow.Cells[11].Text.ToString();
            Response.Cookies.Add(My住宿人数);
            HttpCookie My客人性别 = new HttpCookie("My客人性别");
            My客人性别.Value = this.GridView1.SelectedRow.Cells[12].Text.ToString();
            Response.Cookies.Add(My客人性别);
            HttpCookie My联系电话 = new HttpCookie("My联系电话");
            My联系电话.Value = this.GridView1.SelectedRow.Cells[13].Text.ToString();
            Response.Cookies.Add(My联系电话);
            HttpCookie My操作人员 = new HttpCookie("My操作人员");
            My操作人员.Value = this.GridView1.SelectedRow.Cells[14].Text.ToString();
            Response.Cookies.Add(My操作人员);
            HttpCookie My登记说明 = new HttpCookie("My登记说明");
            My登记说明.Value = this.GridView1.SelectedRow.Cells[15].Text.ToString();
            Response.Cookies.Add(My登记说明);
            Server.Transfer("~/RoomManage/RegisterPrint.aspx");
        }
        if (My旅客账单类型 == "旅客结账单")
        {
             Server.Transfer("~/RoomManage/PrintPrint.aspx");
        }
    }
    public String MyPrint入住编号
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[2].Text.ToString();
        }
    }
    public String MyPrint入住房号
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[4].Text.ToString();
        }
    }
    public String MyPrint客人姓名
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[5].Text.ToString();
        }
    }
    public String MyPrint店内消费
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[8].Text.ToString();
        }
    }
    public String MyPrint住宿费
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[9].Text.ToString();
        }
    }
    public String MyPrint电话费
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[10].Text.ToString();
        }
    }
    public String MyPrint用餐费
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[11].Text.ToString();
        }
    }
    public String MyPrint预收押金
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[12].Text.ToString();
        }
    }
    public String MyPrint结账金额
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[13].Text.ToString();
        }
    }
    public String MyPrint结账编号
    {//设置要传递到打印页的数据
        get
        {
            return this.GridView2.SelectedRow.Cells[3].Text.ToString(); 
        }
    }
    public String MyPrint结账日期
    {//设置要传递到打印页的数据
        get
        {
            DateTime MyDate = DateTime.Parse(this.GridView2.SelectedRow.Cells[7].Text.ToString());
            return MyDate.ToShortDateString();
        }
    }
    public String MyPrint入住日期
    {//设置要传递到打印页的数据
        get
        {
            DateTime MyDate = DateTime.Parse(this.GridView2.SelectedRow.Cells[6].Text.ToString());
            return MyDate.ToShortDateString();
        }
    }
}

⌨️ 快捷键说明

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