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

📄 insertroom.aspx.cs

📁 酒店管理系统 用C#开发 程序简单明了 应用系统
💻 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 BLL;
using Model;

public partial class InsertRoom : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindToRoomType();
            BindToStatic();
            DIV1.Visible = false;
        }
    }
    public void BindToRoomType()
    {
        RoomTypeBLL roomtypebll = new RoomTypeBLL();
        DataSet ds = roomtypebll.Bindselect();
        this.DropDownList1.DataSource = ds;
        this.DropDownList1.DataTextField = "TypeName";
        this.DropDownList1.DataValueField = "TypeID";
        this.DropDownList1.DataBind();
    }
    public void BindToStatic()
    {
        RoomBLL roombll = new RoomBLL();
        DataSet ds = roombll.selectall();
        this.DropDownList2.DataSource = ds;
        this.DropDownList2.DataTextField = "State";
        this.DropDownList2.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        RoomEntity room = new RoomEntity();
        room.Number = this.TextBox4.Text;
        room.TypeID = int.Parse(this.DropDownList1.Text);
        room.BedNumber = int.Parse(this.TextBox1.Text);
        room.Description = this.TextBox3.Text;
        room.State = this.DropDownList2.Text;
        room.GuestNumber = int.Parse(this.TextBox2.Text);
        RoomBLL roombll = new RoomBLL();
        int count = roombll.insert(room);
        if (count != 0)
        {
            DIV1.Visible = true;
            this.Label1.Text = "插入成功!";
            this.TextBox4.Text = "";
            this.TextBox3.Text = "";
            this.TextBox1.Text = "";
            this.TextBox2.Text = "";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        DIV1.Visible = false;
    }
}

⌨️ 快捷键说明

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