protected void Page_Load(object sender, EventArgs e) { //判断用户点击的房间信息 进行跳转到相应的页面 int roomid = int.Parse(Request.QueryString["roomid"].ToString()); DataTable dt = BLL_Hotel.Cha_One(roomid); if (dt.Rows[0]["stateid"].ToString() == "1") //如果房间状态为已预定 { Response.Redirect("ReserveDetail.aspx?roomid=" + roomid); } else if (dt.Rows[0]["stateid"].ToString() == "2") //如果房间状态为 已入住 { Response.Redirect("roomdetail.aspx?roomid=" + roomid); } else if (dt.Rows[0]["stateid"].ToString() == "3") //如果房间状态为 未入住 { Response.Redirect("Guestinfo.aspx?roomid=" + roomid); } else if (dt.Rows[0]["stateid"].ToString() == "6") //如果房间 状态为"未开通" { Response.Redirect("CreRoom.aspx?roomid=" + roomid); } else //如果房间状态为维修中或者打扫中 { BLL_Hotel.Gai_roomstate(roomid, 3); Response.Write("<script>alert('房间状态已更新为未入住!');location.href='right.aspx';</script>"); } }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); int gid = Convert.ToInt32(Request.QueryString["gid"]); DataTable dt2 = BLL_Hotel.Cha_Guestinfo(gid); this.txtGid.Text = dt2.Rows[0]["Gid"].ToString(); this.txtGname.Text = dt2.Rows[0]["gname"].ToString(); this.txtMobile.Text = dt2.Rows[0]["mobile"].ToString(); this.txtTName.Text = dt2.Rows[0]["Tname"].ToString(); this.txtInTime.Text = DateTime.Now.ToString(); DataTable dt = BLL_Hotel.bind_roomtype(); this.ddlRTName.DataSource = dt; this.ddlRTName.DataTextField = "rtname"; this.ddlRTName.DataValueField = "rtid"; this.ddlRTName.DataBind(); DataTable dt1 = BLL_Hotel.bind_roominfo(1); this.ddlRoomName.DataSource = dt1; this.ddlRoomName.DataTextField = "number"; this.ddlRoomName.DataValueField = "roomid"; this.ddlRoomName.DataBind(); if (roomid != 0) //如果是直接通过欢迎页面已选好房间时,登记时自动选择相应的房间 { DataTable dt3 = BLL_Hotel.Cha_One(roomid); this.ddlRTName.SelectedValue = dt3.Rows[0]["rtid"].ToString(); DataTable dt4 = BLL_Hotel.bind_roominfo(Convert.ToInt32(dt3.Rows[0]["rtid"])); this.ddlRoomName.DataSource = dt4; this.ddlRoomName.DataTextField = "number"; this.ddlRoomName.DataValueField = "roomid"; this.ddlRoomName.DataBind(); this.ddlRoomName.SelectedValue = roomid.ToString(); } }
//根据天数计算押金金额 public void price() { if (this.txtDayNum.Text != "") { int day = Convert.ToInt32(this.txtDayNum.Text); int Roomid = Convert.ToInt32(this.ddlRoomName.SelectedValue); DataTable dt = BLL_Hotel.Cha_One(Roomid);//查询该房间每日金额以计算押金 int DP = Convert.ToInt32(dt.Rows[0]["rtprice"]); this.txtCharge.Text = ((day + 0) * DP).ToString(); DateTime inttime = Convert.ToDateTime(this.txtInTime.Text); this.txtOutTime.Text = inttime.AddDays(+day).ToString(); } }
public void price() { //根据天数计算押金金额 if (this.txtAddDay.Text != "") { int day = Convert.ToInt32(this.txtAddDay.Text); int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_One(roomid);//查询该房间每日金额以计算押金 int DP = Convert.ToInt32(dt.Rows[0]["rtprice"]); this.txtAddCharge.Text = ((day) * DP).ToString(); DateTime outtime = Convert.ToDateTime(this.txtOutTime.Text); this.txtOutTime.Text = outtime.AddDays(+day).ToString(); } }
public void price() //根据天数计算押金金额 { if (this.TextBox9.Text != "") { int day = Convert.ToInt32(this.TextBox9.Text); int Roomid = Convert.ToInt32(this.DropDownList2.SelectedValue); DataTable dt = BLL_Hotel.Cha_One(Roomid);//查询该房间每日金额以计算押金 int DP = Convert.ToInt32(dt.Rows[0]["rtprice"]); this.TextBox6.Text = ((day + 1) * DP).ToString(); DateTime inttime = Convert.ToDateTime(this.TextBox8.Text); this.TextBox4.Text = inttime.AddDays(+day).ToString(); } }
public void bind() { this.DropDownList1.DataSource = BLL_Hotel.Bind_LouCeng(); this.DropDownList1.DataTextField = "Fname"; this.DropDownList1.DataValueField = "Fid"; this.DropDownList1.DataBind(); int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_One(roomid); this.TextBox4.Text = dt.Rows[0]["RTname"].ToString(); this.TextBox1.Text = roomid.ToString(); this.TextBox1.Enabled = false; this.TextBox4.Enabled = false; }
//将房间信息查询结果绑定到控件 public void bind() { this.ddlFName.DataSource = BLL_Hotel.Bind_LouCeng();//查看楼层信息 this.ddlFName.DataTextField = "Fname"; this.ddlFName.DataValueField = "Fid"; this.ddlFName.DataBind(); int roomid = Convert.ToInt32(Request.QueryString["roomid"]); //接收要开通的房间编号 DataTable dt = BLL_Hotel.Cha_One(roomid); //根据房间ID查询房间信息 this.txtRTName.Text = dt.Rows[0]["RTname"].ToString(); this.txtRoomId.Text = roomid.ToString(); this.txtRoomId.Enabled = false; this.txtRTName.Enabled = false; }
//int inday; //double price1; //int overday; //int addmoney; public void price(ref int inday, ref double price1, ref int overday, ref int addmoney) { DateTime now = DateTime.Now; DateTime outtime = Convert.ToDateTime(this.TextBox4.Text); //获取离开时间 DateTime intime = Convert.ToDateTime(this.TextBox8.Text); //获取入住日期 //已入住天数和小时数 inday = (now - intime).Days; int inhour = (now - intime).Hours; int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid);//查询该房间每日金额以计算押金 price1 = Convert.ToDouble(dt.Rows[0]["rtprice"]) * inday; //当天入住不满6个小时按半天收费,超过6个小时按一天收费。 if (inhour <= 6) { price1 = price1 + ((Convert.ToDouble(dt.Rows[0]["rtprice"])) * 0.5); } else { price1 = price1 + ((Convert.ToDouble(dt.Rows[0]["rtprice"]))); } int newRoomid; if (this.DropDownList2.SelectedValue == "") { newRoomid = roomid; } else { newRoomid = Convert.ToInt32(this.DropDownList2.SelectedValue); }//重新选择 double overmoney = Convert.ToDouble(dt.Rows[0]["charge"]) - price1 - (Convert.ToDouble(dt.Rows[0]["rtprice"])); //计算剩余金额 overday = Convert.ToInt32(dt.Rows[0]["daynum"]) - inday - 1;//计算剩余天数 DataTable dt1 = BLL_Hotel.Cha_One(newRoomid); addmoney = Convert.ToInt32(dt1.Rows[0]["Rtprice"]) * (overday + 1); //计算换新房间的价格 //查询换房所需要的服务费 DataTable dt3 = BLL_Hotel.Cha_Transmoney(Convert.ToInt32(this.DropDownList3.SelectedValue)); int transmoney = Convert.ToInt32(dt3.Rows[0]["addmoney"]); //更换同级别客房,不计算半天的价格。 if (this.TextBox3.Text == this.DropDownList1.SelectedItem.ToString()) { this.TextBox7.Text = "您更换的房间为【" + this.DropDownList1.SelectedItem + "】,您的剩余入住天数为【" + overday + "】天,本次需缴纳差价金额【0】元。本次换房因【" + this.DropDownList3.SelectedItem + "】需缴纳额外换房服务费【" + transmoney + "】元。"; } //客房升级或降级时,不足一天时,半天的费用以高级房价格为主。 else { if (addmoney >= overmoney) { double paymoney = addmoney - overmoney; this.TextBox7.Text = "您更换的房间为【" + this.DropDownList1.SelectedItem + "】,您的剩余入住天数为【" + overday + "】天,本次需缴纳差价金额【" + paymoney + "】元。" + "本次换房因【" + this.DropDownList3.SelectedItem + "】需缴纳额外换房服务费【" + transmoney + "】元。";; } else { double paymoney = overmoney - addmoney; this.TextBox7.Text = "您更换的房间为【" + this.DropDownList1.SelectedItem + "】,您的剩余入住天数为【" + overday + "】天,本次需退还差价金额【" + paymoney + "】元。" + "本次换房因【" + this.DropDownList3.SelectedItem + "】需缴纳额外换房服务费【" + this.DropDownList3.SelectedValue + "】元。";; } } }