protected void Page_Load(object sender, EventArgs e) { int gid, roomType, bedType; CheckInBLL ckbll = new CheckInBLL(); ServiceOrderBLL orderBLL = new ServiceOrderBLL(); GuestRoomInfoBLL guestRoomInfoBLL = new GuestRoomInfoBLL(); if (!IsPostBack) { if (Request.QueryString["uid"] == null) { ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "login", "<script>notlogined();</script>"); return; } uid = Request.QueryString["uid"]; if (ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { gid = ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)")[0].Gid; GuestRoomInfoBLL roomInfoBLL = new GuestRoomInfoBLL(); roomType = roomInfoBLL.GetModelList("Gid = " + gid)[0].RoomType; bedType = roomInfoBLL.GetModelList("Gid = " + gid)[0].BedType; if (roomType == 0) { if (bedType == 0) { Content = "单人房-硬板床-" + gid.ToString(); } else { Content = "单人房-软榻床-" + gid.ToString(); } } else if (roomType == 1) { if (bedType == 0) { Content = "双人房-硬板床-" + gid.ToString(); } else { Content = "双人房-软榻床-" + gid.ToString(); } } else if (roomType == 2) { if (bedType == 1) { Content = "总统套房-软榻床-" + gid.ToString(); } else { Content = "总统套房-大圆床-" + gid.ToString(); } } } } if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "checkout") { uid = Request.QueryString["uid"]; bool hasOrder2Cancel = ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count == 0 ? false : true; if (!hasOrder2Cancel) { Response.Write(-1); Response.End(); } bool hasOutTime = ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = -2 or CheckinStatus = 1 or CheckinStatus = 2)").Count == 0 ? false : true; if (!hasOrder2Cancel) { Response.Write(-1); Response.End(); } // 客房状态改为4-需要保洁 GuestRoomInfo guestRoom = guestRoomInfoBLL.GetModelList("Gid = " + ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)")[0].Gid)[0]; guestRoom.GStatus = 4; guestRoomInfoBLL.Update(guestRoom); // 修改住房信息订单状态码为-3(用户取消) CheckIn ck = ckbll.GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)")[0]; ck.CheckinStatus = -3; ckbll.Update(ck); // 修改额外服务订单状态码 ServiceOrder svorder = orderBLL.GetModelList("Uid = " + uid + " and (esOrderStatus = 0 or esOrderStatus = 1 or esOrderStatus = 2)")[0]; // 如果额外服务还没有提供,那么退房的时候应该取消放货,状态码置为-3 if (svorder.esOrderStatus == 0 || svorder.esOrderStatus == 1) { string orderContent = svorder.esOrderContent; if (orderContent != "") { ExServiceBLL esbll = new ExServiceBLL(); foreach (string tmp in orderContent.Split(',')) { ExService es = esbll.GetModelList("GoodsName = '" + tmp.Split('*')[0] + "'")[0]; es.GoodsStock += int.Parse(tmp.Split('*')[1]); esbll.Update(es); } } svorder.esOrderStatus = -3; orderBLL.Update(svorder); } Response.Write(1); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { gsCount = esbll.GetModelList("").Count; if (gsCount % 5 == 0) { gsMaxPage = gsCount / 5; } else { gsMaxPage = gsCount / 5 + 1; } } // 页面加载时获取Goods信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "load") { string sqlStrByPage = "select * from (" + " select ROW_NUMBER() over(order by GoodsID ASC) AS Row, * from ExService) T" + " where T.Row between 1 and 5"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // Ajax分页获取Goods信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "gsByPage") { gsNowPage = int.Parse(Request["gsNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by GoodsID ASC) AS Row, * from ExService) T" + " where T.Row between {0} and {1}", (gsNowPage - 1) * 5 + 1, gsNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 修改Goods信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "update") { int gsid = int.Parse(Request["gsid"]); string gsname = Request["gsname"]; float gsprice = float.Parse(Request["gsprice"]); int gsstock = int.Parse(Request["gsstock"]); ExService es = esbll.GetModel(gsid); es.GoodsName = gsname; es.GoodsPrice = decimal.Parse(gsprice.ToString()); es.GoodsStock = gsstock; esbll.Update(es); Response.Write(1); Response.End(); } } // 上架或下架Goods信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "lowershelf") { int gsid = int.Parse(Request["gsid"]); int gsstock = int.Parse(Request["gsstock"]); int tag = int.Parse(Request["tag"]); ExService es = esbll.GetModel(gsid); if (tag == 1) { es.GoodsStock = gsstock; } es.GoodsStatus = es.GoodsStatus == 0 ? 1 : 0; esbll.Update(es); Response.Write(1); Response.End(); } } }