📄 addinfo.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 BLL;
using Model;
public partial class Addinfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindToRoomType();
BindToStatic();
BindToAll();
}
}
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();
}
public void BindToAll()
{
int id = int.Parse(Request.QueryString["id"]);
RoomBLL room = new RoomBLL();
DataSet ds = room.selectwhereid(id);
this.Label1.Text = ds.Tables[0].Rows[0]["Number"].ToString();
this.TextBox1.Text = ds.Tables[0].Rows[0]["BedNumber"].ToString();
this.TextBox2.Text = ds.Tables[0].Rows[0]["GuestNumber"].ToString();
this.TextBox3.Text = ds.Tables[0].Rows[0]["Description"].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
RoomEntity room = new RoomEntity();
room.Number = this.Label1.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.update(room);
if (count != 0)
{
//Server.Transfer("Selectinfo.aspx");
Response.Redirect("Selectinfo.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -