public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.TextBox1.Text = dt.Rows[0]["gid"].ToString(); this.TextBox2.Text = dt.Rows[0]["gname"].ToString(); this.TextBox3.Text = dt.Rows[0]["tname"].ToString(); this.TextBox4.Text = dt.Rows[0]["rtname"].ToString(); this.TextBox5.Text = dt.Rows[0]["trate"].ToString() + "折"; this.TextBox6.Text = dt.Rows[0]["number"].ToString(); this.TextBox8.Text = dt.Rows[0]["charge"].ToString() + "元"; this.TextBox9.Text = dt.Rows[0]["intime"].ToString(); this.TextBox11.Text = dt.Rows[0]["outtime"].ToString(); now = DateTime.Now; DateTime intime = Convert.ToDateTime(this.TextBox9.Text); //获取入住日期 factnum = (now - intime).Days; //计算入住的实际天数 int daynum = Convert.ToInt32(dt.Rows[0]["daynum"]); this.TextBox12.Text = factnum.ToString() + "天"; this.TextBox13.Text = now.ToString(); price = Convert.ToDouble(dt.Rows[0]["rtprice"]) * factnum * Convert.ToDouble(dt.Rows[0]["trate"]); //实际收费 //当天入住不满6个小时按半天收费,超过6个小时按一天收费。 int hour = (now - intime).Hours; if (hour <= 6) { price = price + ((Convert.ToDouble(dt.Rows[0]["rtprice"])) * 0.5); } else { price = price + ((Convert.ToDouble(dt.Rows[0]["rtprice"]))); } double tui = Convert.ToDouble(dt.Rows[0]["charge"]) - price; double jiao = price - Convert.ToDouble(dt.Rows[0]["charge"]); this.TextBox10.Text = price.ToString() + "元"; if (daynum >= factnum) { this.TextBox7.Text = "用户登记入住天数为【" + daynum + "天】,实际入住天数为【" + factnum + "】天。该客户本次消费需退还押金【" + tui + "】元。"; } else { this.TextBox7.Text = "用户登记入住天数为【" + daynum + "天】,实际入住天数为【" + factnum + "】天。该客户本次消费需缴纳押金【" + jiao + "】元。"; } }
//确认换房 protected void Button1_Click(object sender, EventArgs e) { if (this.DropDownList2.Text != "") { int inday = 1; double price1 = 1; int overday = 1; int addmoney = 1; price(ref inday, ref price1, ref overday, ref addmoney); //-------先退房后添加新的入住信息---------- //修改入住信息表(先退房) int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); DateTime now = DateTime.Now; int reid = Convert.ToInt32(dt.Rows[0]["reid"]); BLL_Hotel.Gai_Record(now.ToString(), inday, price1, reid); //退房时 修改房间状 ,如果是房间损坏而换房,则修改状态为“维修中” if (this.DropDownList3.SelectedValue.ToString() == "1") { BLL_Hotel.Gai_roomstate(roomid, 4); } else { BLL_Hotel.Gai_roomstate(roomid, 5); } //客户本次消费金额更新到客户信息表里 BLL_Hotel.Gai_GuestChargeSum(Convert.ToInt32(dt.Rows[0]["gid"]), price1); //更新交易额统计表 BLL_Hotel.Gai_TradeCount(price1); //添加新的入住信息(重新开房) int gid = Convert.ToInt32(this.TextBox1.Text); int newroomid = Convert.ToInt32(this.DropDownList2.SelectedValue); DateTime outtime = Convert.ToDateTime(this.TextBox4.Text); BLL_Hotel.Add_Record(gid, newroomid, DateTime.Now, outtime, overday, addmoney); //添加新房时,修改新房的房间状态为“已入住” BLL_Hotel.Gai_roomstate(newroomid, 2); // Response.Write("<script>alert('换房成功!');location.href='Roomdetail.aspx?roomid=" + newroomid + "';</script>"); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('换房成功');location.href='Roomdetail.aspx?roomid=" + newroomid + "'", true); } else { this.Label1.Text = "请选择需要更换的房间号"; } }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.TextBox1.Text = dt.Rows[0]["Gid"].ToString(); this.TextBox2.Text = dt.Rows[0]["gname"].ToString(); this.TextBox3.Text = dt.Rows[0]["mobile"].ToString(); this.TextBox5.Text = dt.Rows[0]["Tname"].ToString(); this.TextBox8.Text = dt.Rows[0]["intime"].ToString(); this.TextBox4.Text = dt.Rows[0]["outtime"].ToString(); this.TextBox10.Text = dt.Rows[0]["rtname"].ToString(); this.TextBox11.Text = dt.Rows[0]["number"].ToString(); }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.txtGid.Text = dt.Rows[0]["Gid"].ToString(); this.txtGname.Text = dt.Rows[0]["gname"].ToString(); this.txtMobile.Text = dt.Rows[0]["mobile"].ToString(); this.txtTname.Text = dt.Rows[0]["Tname"].ToString(); this.txtInTime.Text = dt.Rows[0]["intime"].ToString(); this.txtOutTime.Text = dt.Rows[0]["outtime"].ToString(); this.txtRTName.Text = dt.Rows[0]["rtname"].ToString(); this.txtRoomNum.Text = dt.Rows[0]["number"].ToString(); }
int factnum; //实际入住天数 //退房 protected void btnSubmit_Click(object sender, EventArgs e) { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); //修改入住信息表 DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); int reid = Convert.ToInt32(dt.Rows[0]["reid"]); BLL_Hotel.Gai_Record(now.ToString(), factnum, price, reid); //退房时 修改房间状态为“未入住” BLL_Hotel.Gai_roomstate(roomid, 5); //客户本次消费金额更新到客户信息表里 BLL_Hotel.Gai_GuestChargeSum(Convert.ToInt32(dt.Rows[0]["gid"]), price); BLL_Hotel.Gai_TradeCount(price); Response.Write("<script>alert('退房成功!');location.href='Right.aspx';</script>"); }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.TextBox1.Text = dt.Rows[0]["Gid"].ToString(); this.TextBox2.Text = dt.Rows[0]["gname"].ToString(); this.TextBox3.Text = dt.Rows[0]["rtname"].ToString(); this.TextBox5.Text = dt.Rows[0]["number"].ToString(); this.TextBox8.Text = dt.Rows[0]["intime"].ToString(); this.TextBox4.Text = dt.Rows[0]["outtime"].ToString(); this.TextBox9.Text = dt.Rows[0]["daynum"].ToString(); this.TextBox6.Text = dt.Rows[0]["charge"].ToString(); this.TextBox10.Text = dt.Rows[0]["chargesum"].ToString(); this.TextBox7.Text = dt.Rows[0]["remark"].ToString(); DataTable dt2 = BLL_Hotel.bind_roomtype(); this.DropDownList1.DataSource = dt2; this.DropDownList1.DataTextField = "rtname"; this.DropDownList1.DataValueField = "rtid"; this.DropDownList1.DataBind(); DataTable dt1 = BLL_Hotel.bind_roominfo(1); this.DropDownList2.DataSource = dt1; this.DropDownList2.DataTextField = "number"; this.DropDownList2.DataValueField = "roomid"; this.DropDownList2.DataBind(); DataTable dt3 = BLL_Hotel.Cha_TranHome(); this.DropDownList3.DataSource = dt3; this.DropDownList3.DataValueField = "transid"; this.DropDownList3.DataTextField = "reason"; this.DropDownList3.DataBind(); int a = 1; double b = 1; int c = 1; int d = 1; price(ref a, ref b, ref c, ref d); }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.txtGid.Text = dt.Rows[0]["Gid"].ToString(); this.txtGname.Text = dt.Rows[0]["gname"].ToString(); this.txtRTName.Text = dt.Rows[0]["rtname"].ToString(); this.txtOldRName.Text = dt.Rows[0]["number"].ToString(); this.txtInTime.Text = dt.Rows[0]["intime"].ToString(); this.txtOutTime.Text = dt.Rows[0]["outtime"].ToString(); this.txtDayNum.Text = dt.Rows[0]["daynum"].ToString(); this.txtCharge.Text = dt.Rows[0]["charge"].ToString(); this.txtChargeSum.Text = dt.Rows[0]["chargesum"].ToString(); this.txtRemark.Text = dt.Rows[0]["remark"].ToString(); DataTable dt2 = BLL_Hotel.bind_roomtype(); this.ddlRTName.DataSource = dt2; this.ddlRTName.DataTextField = "rtname"; this.ddlRTName.DataValueField = "rtid"; this.ddlRTName.DataBind(); DataTable dt1 = BLL_Hotel.bind_roominfo(1); this.ddlNewRoomId.DataSource = dt1; this.ddlNewRoomId.DataTextField = "number"; this.ddlNewRoomId.DataValueField = "roomid"; this.ddlNewRoomId.DataBind(); DataTable dt3 = BLL_Hotel.Cha_TranHome(); this.ddlTraReason.DataSource = dt3; this.ddlTraReason.DataValueField = "transid"; this.ddlTraReason.DataTextField = "reason"; this.ddlTraReason.DataBind(); int a = 1; double b = 1; int c = 1; int d = 1; price(ref a, ref b, ref c, ref d); }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.TextBox1.Text = dt.Rows[0]["gid"].ToString(); this.TextBox2.Text = dt.Rows[0]["gname"].ToString(); this.TextBox3.Text = dt.Rows[0]["sex"].ToString(); this.TextBox4.Text = dt.Rows[0]["mobile"].ToString(); this.TextBox5.Text = dt.Rows[0]["tname"].ToString(); this.TextBox6.Text = dt.Rows[0]["pid"].ToString(); this.TextBox7.Text = dt.Rows[0]["mark"].ToString(); this.TextBox8.Text = dt.Rows[0]["fname"].ToString(); this.TextBox9.Text = dt.Rows[0]["rtname"].ToString(); this.TextBox10.Text = dt.Rows[0]["intime"].ToString(); this.TextBox11.Text = dt.Rows[0]["number"].ToString(); this.TextBox12.Text = dt.Rows[0]["outtime"].ToString(); this.TextBox13.Text = dt.Rows[0]["charge"].ToString() + "元"; this.TextBox14.Text = dt.Rows[0]["daynum"].ToString(); this.TextBox15.Text = dt.Rows[0]["chargesum"].ToString() + "元"; }
public void bind() { int roomid = Convert.ToInt32(Request.QueryString["roomid"]); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); this.txtGid.Text = dt.Rows[0]["gid"].ToString(); this.txtGname.Text = dt.Rows[0]["gname"].ToString(); this.txtSex.Text = dt.Rows[0]["sex"].ToString(); this.txtMobile.Text = dt.Rows[0]["mobile"].ToString(); this.txtTName.Text = dt.Rows[0]["tname"].ToString(); this.txtPid.Text = dt.Rows[0]["pid"].ToString(); this.txtMark.Text = dt.Rows[0]["mark"].ToString(); this.txtFName.Text = dt.Rows[0]["fname"].ToString(); this.txtRTName.Text = dt.Rows[0]["rtname"].ToString(); this.txtInTime.Text = dt.Rows[0]["intime"].ToString(); this.txtRoomName.Text = dt.Rows[0]["number"].ToString(); this.txtOutTime.Text = dt.Rows[0]["outtime"].ToString(); this.txtCharge.Text = dt.Rows[0]["charge"].ToString() + "元"; this.txtDayNum.Text = dt.Rows[0]["daynum"].ToString(); this.txtChargeSum.Text = dt.Rows[0]["chargesum"].ToString() + "元"; }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "sc") { int reid = Convert.ToInt32(e.CommandArgument); BLL_Hotel.Del_Record(reid); bind(); } if (e.CommandName == "xq") { int roomid = Convert.ToInt32(e.CommandArgument); DataTable dt = BLL_Hotel.Cha_OneRecord(roomid); if (dt.Rows.Count == 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('该客户已为离开状态,暂不提供业务处理!');", true); } else { Response.Redirect("RoomDetail.aspx?roomid=" + roomid); } } }
//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 + "】元。";; } } }