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

📄 changeform.aspx.cs

📁 一个关于宾馆酒店管理系统的源代码
💻 CS
字号:
//文件名:ChangeForm.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_ChangeForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string MyForbidString = Session["MyForbid"].ToString();
        if (MyForbidString.IndexOf("A2") > 1)
        {
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
        }
        this.Page.Title = "当前位置:客房管理->旅客换房登记";
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//换房
        int My住宿人数 = Convert.ToInt16(this.GridView1.SelectedRow.Cells[4].Text.ToString());
        int My未住人数=Convert.ToInt16(this.GridView2.SelectedRow.Cells[5].Text.ToString())-Convert.ToInt16(this.GridView2.SelectedRow.Cells[6].Text.ToString());
        if (My住宿人数 > My未住人数)
        {
            return;
        }
        string My入住编号 = this.GridView1.SelectedRow.Cells[1].Text.ToString();
        string My原房号 = this.GridView1.SelectedRow.Cells[2].Text.ToString();
        string My新房号 = this.GridView2.SelectedRow.Cells[1].Text.ToString();
        String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHotelDBConnectionString"].ConnectionString;
        SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
        MyConnection.Open();
        SqlCommand MyCommand = MyConnection.CreateCommand();
        string MySQL = "Update 酒店房间 Set 已住人数=已住人数+" + My住宿人数 + " WHERE 房号='" + My新房号 + "';";
        MySQL += "Update 酒店房间 Set 已住人数=已住人数-" + My住宿人数 + " WHERE 房号='" + My原房号 + "';";
        MySQL += "Update 客房入住单 Set 入住房号='" + My新房号 + "' WHERE 入住编号='" + My入住编号 + "';";
        MyCommand.CommandText = MySQL;
        MyCommand.ExecuteNonQuery();
        if (MyConnection.State == ConnectionState.Open)
        {
            MyConnection.Close();
        }
        this.GridView1.DataBind();
        this.GridView2.DataBind();
    }
}

⌨️ 快捷键说明

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