📄 add.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 LTP.Common;
namespace Maticsoft.Web.HotelRoomPrice
{
public partial class Add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_LoadComplete(object sender, EventArgs e)
{
(Master.FindControl("lblTitle") as Label).Text = "信息添加";
}
protected void btnAdd_Click(object sender, EventArgs e)
{
string strErr="";
if(!PageValidate.IsDecimal(txtPrice.Text))
{
strErr+="Price不是数字!\\n";
}
if(!PageValidate.IsDecimal(txtCashPrice.Text))
{
strErr+="CashPrice不是数字!\\n";
}
if(this.txtHasBreakfast.Text =="")
{
strErr+="HasBreakfast不能为空!\\n";
}
if(this.txtBedType.Text =="")
{
strErr+="BedType不能为空!\\n";
}
if(this.txtHasInternet.Text =="")
{
strErr+="HasInternet不能为空!\\n";
}
if(this.txtLocalFloor.Text =="")
{
strErr+="LocalFloor不能为空!\\n";
}
if(this.txtRoomTrait.Text =="")
{
strErr+="RoomTrait不能为空!\\n";
}
if(!PageValidate.IsDecimal(txtBreakfastPrice1.Text))
{
strErr+="BreakfastPrice1不是数字!\\n";
}
if(!PageValidate.IsDecimal(txtBreakfastPrice2.Text))
{
strErr+="BreakfastPrice2不是数字!\\n";
}
if(!PageValidate.IsDecimal(txtArea.Text))
{
strErr+="Area不是数字!\\n";
}
if(!PageValidate.IsDecimal(txtAddBedPrice.Text))
{
strErr+="AddBedPrice不是数字!\\n";
}
if(!PageValidate.IsNumber(txtRoomAmount.Text))
{
strErr+="RoomAmount不是数字!\\n";
}
if(this.txtRemark.Text =="")
{
strErr+="Remark不能为空!\\n";
}
if(strErr!="")
{
MessageBox.Show(this,strErr);
return;
}
decimal Price=decimal.Parse(this.txtPrice.Text);
decimal CashPrice=decimal.Parse(this.txtCashPrice.Text);
string HasBreakfast=this.txtHasBreakfast.Text;
string BedType=this.txtBedType.Text;
string HasInternet=this.txtHasInternet.Text;
string LocalFloor=this.txtLocalFloor.Text;
string RoomTrait=this.txtRoomTrait.Text;
decimal BreakfastPrice1=decimal.Parse(this.txtBreakfastPrice1.Text);
decimal BreakfastPrice2=decimal.Parse(this.txtBreakfastPrice2.Text);
decimal Area=decimal.Parse(this.txtArea.Text);
decimal AddBedPrice=decimal.Parse(this.txtAddBedPrice.Text);
int RoomAmount=int.Parse(this.txtRoomAmount.Text);
string Remark=this.txtRemark.Text;
Maticsoft.Model.HotelRoomPrice model=new Maticsoft.Model.HotelRoomPrice();
model.Price=Price;
model.CashPrice=CashPrice;
model.HasBreakfast=HasBreakfast;
model.BedType=BedType;
model.HasInternet=HasInternet;
model.LocalFloor=LocalFloor;
model.RoomTrait=RoomTrait;
model.BreakfastPrice1=BreakfastPrice1;
model.BreakfastPrice2=BreakfastPrice2;
model.Area=Area;
model.AddBedPrice=AddBedPrice;
model.RoomAmount=RoomAmount;
model.Remark=Remark;
Maticsoft.BLL.HotelRoomPrice bll=new Maticsoft.BLL.HotelRoomPrice();
bll.Add(model);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -