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(); } } }
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; } } // 点击客房收入时获取客房收入信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "grincome") { string sqlStrByPage = "select RoomType, BedType, count(*) as ckorderCount, SUM(C.cTotalPrice) as Total_gr_Income from CheckIn C, GuestRoomInfo G" + " where(CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2 or CheckinStatus = 3)" + " and C.Gid = G.Gid group by G.RoomType, G.BedType"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // 点击额外服务收入时获取额外服务收入信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "gsincome") { List <ServiceOrder> sorderList = new List <ServiceOrder>(); sorderList = new ServiceOrderBLL().GetModelList("esOrderStatus = 0 or esOrderStatus = 1 or esOrderStatus = 2 or esOrderStatus = 3"); List <esorderInfo> orderinfoList = new List <esorderInfo>(); for (int b = 0; b < sorderList.Count; b++) { if (sorderList[b].esOrderContent != "") { esorderInfo info = new esorderInfo() { ordercontent = sorderList[b].esOrderContent }; orderinfoList.Add(info); } } List <goods> goodsList = new List <goods>(); string[] goodsinfo; for (int k = 0; k < orderinfoList.Count; k++) { goodsinfo = orderinfoList[k].ordercontent.Split(','); for (int c = 0; c < goodsinfo.Length; c++) { goods singlegoods = new goods() { goodsname = goodsinfo[c].Split('*')[0], count = int.Parse(goodsinfo[c].Split('*')[1]) }; goodsList.Add(singlegoods); } } List <goods> gsInfoList = new List <goods>(); goods singlegoods2 = new goods(); bool hasSame = false; for (int m = 0; m < goodsList.Count; m++) { for (int n = 0; n < gsInfoList.Count; n++) { if (gsInfoList[n].goodsname == goodsList[m].goodsname) { gsInfoList[n].count += goodsList[m].count; hasSame = true; break; } } if (!hasSame) { singlegoods2 = new goods { goodsname = goodsList[m].goodsname, count = goodsList[m].count }; gsInfoList.Add(singlegoods2); } else { hasSame = false; } } ExServiceBLL esbll = new ExServiceBLL(); for (int r = 0; r < gsInfoList.Count; r++) { gsInfoList[r].TotalPrice = float.Parse(esbll.GetModelList("GoodsName = '" + gsInfoList[r].goodsname + "'")[0].GoodsPrice.ToString()) * gsInfoList[r].count; } JavaScriptSerializer subjson = new JavaScriptSerializer(); object serializer_obj = subjson.Serialize(gsInfoList); Response.Write(serializer_obj); Response.End(); } } }