protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { grCount = grbll.GetModelList("").Count; if (grCount % 5 == 0) { grMaxPage = grCount / 5; } else { grMaxPage = grCount / 5 + 1; } } // 页面加载时获取客房信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "load") { string sqlStrByPage = "select * from (" + " select ROW_NUMBER() over(order by Gid ASC) AS Row, Gid, RoomType, BedType, HasWlan, RoomPrice from GuestRoomInfo) T" + " where T.Row between 1 and 5"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // Ajax分页获取客房信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "grByPage") { grNowPage = int.Parse(Request["grNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by Gid ASC) AS Row, Gid, RoomType, BedType, HasWlan, RoomPrice from GuestRoomInfo) T" + " where T.Row between {0} and {1}", (grNowPage - 1) * 5 + 1, grNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 修改客房信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "update") { int gid = int.Parse(Request["gid"]); int roomtype = int.Parse(Request["roomtype"]); int bedtype = int.Parse(Request["bedtype"]); int haswlan = int.Parse(Request["haswlan"]); decimal roomprice = decimal.Parse(Request["roomprice"]); GuestRoomInfo gr = grbll.GetModelList("Gid = " + gid)[0]; gr.RoomType = roomtype; gr.BedType = bedtype; gr.HasWlan = haswlan; gr.RoomPrice = roomprice; grbll.Update(gr); Response.Write(1); Response.End(); } } }
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) { gsMaxPage = GetCurrentMaxPage(0, 3); clerMaxPage = GetCurrentMaxPage(1, 3); clmsMaxPage = GetCurrentMaxPage(2, 3); } // 加载未保洁客房号信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "loadClean") { gsMaxPage = GetCurrentMaxPage(0, 3); // 此Sql语句将所有未保洁的客房号获取到,并且把处于需要保洁的状态的客房优先排在前面 string loadClean = "select * from (" + " select ROW_NUMBER() over(order by case when GStatus = 4 then 1 else 0 end DESC) AS Row, Gid, GStatus" + " from GuestRoomInfo" + " where (GStatus = 0 or GStatus = 2 or GStatus = 4)) T where T.Row between 1 and 3"; Response.Write(Get_Serialize_Data_FromSql(connectString, loadClean)); Response.End(); } } // 加载空闲中保洁员信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "cler") { clerMaxPage = GetCurrentMaxPage(1, 3); string cleaner = "select * from (" + " select ROW_NUMBER() over(order by CleanerId ASC) AS Row, CleanerId" + " from CleaningService" + " where CleanStatus = '00001') T where T.Row between 1 and 3"; Response.Write(Get_Serialize_Data_FromSql(connectString, cleaner)); Response.End(); } } // 加载保洁管理信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "loadclms") { clmsMaxPage = GetCurrentMaxPage(2, 3); string loadclms = "select * from (" + " select ROW_NUMBER() over(order by Gid ASC) AS Row, Gid, CleanerId" + " from GuestRoomInfo, CleaningService" + " where Gid = (CONVERT(int, CleanStatus) / 10)) T where T.Row between 1 and 3"; Response.Write(Get_Serialize_Data_FromSql(connectString, loadclms)); Response.End(); } } // Ajax分页查询未保洁客房信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "gsByPage") { gsNowPage = int.Parse(Request["gsNowPage"]); StringBuilder sqlPage = new StringBuilder(); // 此Sql语句将所有未保洁的客房号获取到,并且把处于需要保洁的状态的客房优先排在前面 sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by case when GStatus = 4 then 1 else 0 end DESC) AS Row, Gid, GStatus" + " from GuestRoomInfo" + " where (GStatus = 0 or GStatus = 2 or GStatus = 4)) T where T.Row between {0} and {1}", (gsNowPage - 1) * 3 + 1, gsNowPage * 3); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // Ajax分页查询空闲中保洁员信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "clerByPage") { clerNowPage = int.Parse(Request["clerNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by CleanerId ASC) AS Row, CleanerId" + " from CleaningService" + " where CleanStatus = '00001') T where T.Row between {0} and {1}", (clerNowPage - 1) * 3 + 1, clerNowPage * 3); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // Ajax分页查询正在保洁中的客房和负责人信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "clmsByPage") { clmsNowPage = int.Parse(Request["clmsNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by Gid ASC) AS Row, Gid, CleanerId" + " from GuestRoomInfo, CleaningService" + " where Gid = (CONVERT(int, CleanStatus) / 10)) T where T.Row between {0} and {1}", (clmsNowPage - 1) * 3 + 1, clmsNowPage * 3); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 给客房安排保洁服务 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "arrangeClean") { int gid = int.Parse(Request["gid"]); int clerid = int.Parse(Request["clerid"]); CleaningServiceBLL csbll = new CleaningServiceBLL(); CleaningService cs = csbll.GetModel(clerid); cs.CleanStatus = (gid * 10000 + 1).ToString(); csbll.Update(cs); GuestRoomInfoBLL gsbll = new GuestRoomInfoBLL(); GuestRoomInfo gs = gsbll.GetModelList("Gid = " + gid)[0]; gs.GStatus = 5; gsbll.Update(gs); Response.Write(1); Response.End(); } } // 保洁完成 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "setComplete") { int gid = int.Parse(Request["gid"]); int clerid = int.Parse(Request["clerid"]); CleaningServiceBLL csbll = new CleaningServiceBLL(); CleaningService cs = csbll.GetModel(clerid); cs.CleanStatus = "00001"; csbll.Update(cs); GuestRoomInfoBLL gsbll = new GuestRoomInfoBLL(); GuestRoomInfo gs = gsbll.GetModelList("Gid = " + gid)[0]; gs.GStatus = 0; gsbll.Update(gs); Response.Write(1); Response.End(); } } // updateClms if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "updateClms") { clmsNowPage = int.Parse(Request["clmsNowPage"]); clmsMaxPage = GetCurrentMaxPage(2, 3); if (clmsNowPage - 1 == clmsMaxPage) { clmsNowPage = clmsMaxPage; Response.Write(clmsNowPage); Response.End(); } StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by Gid ASC) AS Row, Gid, CleanerId" + " from GuestRoomInfo, CleaningService" + " where Gid = (CONVERT(int, CleanStatus) / 10)) T where T.Row between {0} and {1}", (clmsNowPage - 1) * 3 + 1, clmsNowPage * 3); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 获取最大页数 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "getMaxPage") { gsMaxPage = GetCurrentMaxPage(0, 3); clerMaxPage = GetCurrentMaxPage(1, 3); clmsMaxPage = GetCurrentMaxPage(2, 3); Dictionary <string, object> pageList = new Dictionary <string, object>(); pageList.Add("gsMaxPage", gsMaxPage); pageList.Add("clerMaxPage", clerMaxPage); pageList.Add("clmsMaxPage", clmsMaxPage); JavaScriptSerializer subjson = new JavaScriptSerializer(); object serializer_sub_Obj = subjson.Serialize(pageList); Response.Write(serializer_sub_Obj); Response.End(); } } }