public FormCheckIn() { InitializeComponent(); _reservationBLL = new ReservationBLL(); _checkInBLL = new CheckInBLL(); _roomBLL = new RoomBLL(); }
public FormSearchCheckIn() { InitializeComponent(); _checkInBLL = new CheckInBLL(); _roomBLL = new RoomBLL(); _clientBLL = new ClientBLL(); checkIn = new CheckIn(); _checkInsGrid = new List <CheckInGrid>(); }
public FormRegisterSale() { InitializeComponent(); _clientBLL = new ClientBLL(); _checkinBLL = new CheckInBLL(); _checkIn = new CheckIn(); _roomBLL = new RoomBLL(); _productBLL = new ProductBLL(); _saleBLL = new SaleBLL(); _product = new Product(); _saleItems = new List <SaleItem>(); ClearNameProduct(); }
protected void btnCancel_CheckIn_Click(object sender, EventArgs e) { Customer aCustomer = new Customer(); aCustomer.Id = 0; int.TryParse(TxtID_checkIn.Text, out aCustomer.Id); CheckInBLL aCheckINBLL = new CheckInBLL(); bool Result = aCheckINBLL.cancel_CheckInDAL(aCustomer); if (Result) { System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Check-In Cancelled')</SCRIPT>"); Server.Transfer("CheckIN.aspx", false); } else { System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Error Check-In Canvelation ,check information')</SCRIPT>"); } }
protected void Page_Load(object sender, EventArgs e) { uid = Request.QueryString["uid"]; cid = Request.QueryString["cid"]; showExs = exsBll.DataTableToList(exsBll.GetListByPage("GoodsStatus = 1", "GoodsID", 1, 6).Tables[0]); gsMaxPage = GetCurrentMaxPage(6); if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "reserve") { bool noPurchase = bool.Parse(Request.Form["nopurchase"]); // 如果不是在预定房间的时候请求的页面,那么就是再次订购额外服务 if (!string.IsNullOrEmpty(Request.QueryString["firstes"])) { if (Request.QueryString["firstes"] == "_no_") { uid = Request.QueryString["uid"]; cid = new CheckInBLL().GetModelList("Uid = " + uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)")[0].Cid.ToString(); if (!noPurchase) { ReserveEs(int.Parse(uid), long.Parse(cid), Request.Form["split_goods_arr"], false); } else { Response.Write(0); Response.End(); } } } // 这里属于预定房间时候的第一次订购 else { if (!noPurchase) { uid = Request.QueryString["uid"]; cid = Request.QueryString["cid"]; ReserveEs(int.Parse(uid), long.Parse(cid), Request.Form["split_goods_arr"], true); } else { Response.Write(1); Response.End(); } } } } // 分页查询Goods信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "gsByPage") { gsMaxPage = GetCurrentMaxPage(6); gsNowPage = int.Parse(Request["gsNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by GoodsId ASC) AS Row, GoodsID, GoodsName, GoodsPrice, GoodsStock" + " from ExService" + " where GoodsStatus = 1) T where T.Row between {0} and {1}", (gsNowPage - 1) * 6 + 1, gsNowPage * 6); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 获取当前最大页数 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "updatePage") { gsMaxPage = GetCurrentMaxPage(6); Response.Write(gsMaxPage); Response.End(); } } }
public void ReserveEs(int _uid, long _cid, string GoodsStr, bool firstes) { // 从前台获取到的物品数据拼接字符串 string splitGoodsArr = GoodsStr; // 将每一组数据从数组中分割出来 string[] settleGoodsItem = splitGoodsArr.Split(';'); string[] settleGoodsItemInfo; List <settleGoods> goodsList = new List <settleGoods>(); //string[][] goodsInfo = new string[6][]; // 将每一组的每一个数据从字符串中分割出来 for (int i = 0; i < settleGoodsItem.Length; i++) { settleGoodsItemInfo = settleGoodsItem[i].Split(','); goodsList.Add(new settleGoods(int.Parse(settleGoodsItemInfo[0]), settleGoodsItemInfo[1], float.Parse(settleGoodsItemInfo[3]), int.Parse(settleGoodsItemInfo[4]))); } int goodsCount = settleGoodsItem.Length; float TotalPrice = 0.0f; for (int p = 0; p < goodsCount; p++) { TotalPrice += (goodsList[p].GoodsPrice * float.Parse(goodsList[p].PurchaseCount.ToString())); ExService es = exsBll.GetModel(goodsList[p].GoodsId); es.GoodsStock -= goodsList[p].PurchaseCount; exsBll.Update(es); } ServiceOrderBLL orderBLL = new ServiceOrderBLL(); ServiceOrder order = orderBLL.GetModel( decimal.Parse(orderBLL.GetList("Uid = " + _uid + " and (esOrderStatus = 0 or esOrderStatus = 1 or esOrderStatus = 2)").Tables[0].Rows[0][0].ToString()) ); if (firstes) { order.esOrderTotalPrice = decimal.Parse(TotalPrice.ToString()); for (int p = 0; p < goodsCount; p++) { if (p != goodsCount - 1) { order.esOrderContent += (goodsList[p].GoodsName + "*" + goodsList[p].PurchaseCount + ","); } else { order.esOrderContent += (goodsList[p].GoodsName + "*" + goodsList[p].PurchaseCount); } } } else { order.esOrderTotalPrice += decimal.Parse(TotalPrice.ToString()); string oldesOrderContent = order.esOrderContent; if (oldesOrderContent != "") { string newOrderContent = string.Empty; // 获取订单内容中已有的Goods信息 string[] oldesOrderContentItemInfos = oldesOrderContent.Split(','); int oldesOrderContentItemCount = oldesOrderContentItemInfos.Length; string[][] oldesOrderGoodsInfos = new string[oldesOrderContentItemCount][]; for (int b = 0; b < oldesOrderContentItemCount; b++) { oldesOrderGoodsInfos[b] = oldesOrderContentItemInfos[b].Split('*'); }// 此时该订单的已有订单内容已被解析出来 List <int> sameItemIndex = new List <int>(); // 获取已有订单中,相同Goods的索引 for (int n = 0; n < oldesOrderContentItemCount; n++) { for (int p = 0; p < goodsCount; p++) { // 如果该订单已有订单内容中包含新增的此Goods,那么直接将数量+1即可 if (goodsList[p].GoodsName == oldesOrderGoodsInfos[n][0]) { sameItemIndex.Add(n); break; } } } // 获取到了之前订单内容和新订单中相同Goods老订单中的索引 bool isOldSame = false; for (int p = 0; p < oldesOrderContentItemCount; p++) { for (int c = 0; c < sameItemIndex.Count; c++) { if (p == sameItemIndex[c]) { isOldSame = true; break; } } if (isOldSame) { for (int k = 0; k < goodsCount; k++) { if (oldesOrderGoodsInfos[p][0] == goodsList[k].GoodsName) { if (p == oldesOrderContentItemCount - 1) { newOrderContent += (oldesOrderGoodsInfos[p][0] + "*" + (goodsList[k].PurchaseCount + int.Parse(oldesOrderGoodsInfos[p][1]))); } else { newOrderContent += (oldesOrderGoodsInfos[p][0] + "*" + (goodsList[k].PurchaseCount + int.Parse(oldesOrderGoodsInfos[p][1])) + ","); } } } isOldSame = false; } else { if (p == oldesOrderContentItemCount - 1) { newOrderContent += (oldesOrderGoodsInfos[p][0] + "*" + oldesOrderGoodsInfos[p][1]); } else { newOrderContent += (oldesOrderGoodsInfos[p][0] + "*" + oldesOrderGoodsInfos[p][1] + ","); } } } bool hasSame = false; for (int p = 0; p < goodsCount; p++) { for (int k = 0; k < oldesOrderContentItemCount; k++) { if (goodsList[p].GoodsName == oldesOrderGoodsInfos[k][0]) { hasSame = true; break; } } if (hasSame) { hasSame = false; continue; } else { newOrderContent += ("," + goodsList[p].GoodsName + "*" + goodsList[p].PurchaseCount); } } order.esOrderContent = newOrderContent; } else // 之前就是空的订单内容 { for (int p = 0; p < goodsCount; p++) { if (p != goodsCount - 1) { order.esOrderContent += (goodsList[p].GoodsName + "*" + goodsList[p].PurchaseCount + ","); } else { order.esOrderContent += (goodsList[p].GoodsName + "*" + goodsList[p].PurchaseCount); } } } } bool res1 = orderBLL.Update(order); CheckInBLL ckBll = new CheckInBLL(); CheckIn checkin = ckBll.GetModel(_cid); checkin.cTotalPrice += decimal.Parse(TotalPrice.ToString()); bool res2 = ckBll.Update(checkin); if (res1 && res2) { Response.Write(1); Response.End(); } else { 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 btnUpdate_CheckIn_Click(object sender, EventArgs e) { string gender = drpGenderSelection_checkIn.Value; Customer aCustomer = new Customer(); aCustomer.Id = 0; int.TryParse(TxtID_checkIn.Text, out aCustomer.Id); aCustomer.Name = txtName_CheckIn.Text; aCustomer.DOB = txtDoB_checkIn.Text; aCustomer.Age = 0; int.TryParse(txtAge_CheckIn.Text, out aCustomer.Age); aCustomer.Sex = gender; aCustomer.Profession = txtProfession_checkIn.Text; aCustomer.ProfessionAddress = txtProfessionAddress_checkIn.Text; aCustomer.PermanentAddress = txtPermanentAddress_checkIn.Text; aCustomer.PresentAddress = txtPresentAddress_checkIn.Text; aCustomer.ContactNo = contactNo_checkIn.Text; aCustomer.Email = txtEmail_checkIn.Text; aCustomer.NIDorPassportNo = txtNID_checkIn.Text; Record aRecord = new Record(); aRecord.RoomID = 0; int.TryParse(txtRoomId_checkIn.Text, out aRecord.RoomID); aRecord.RoomNO = txtRoomNO_checkIn.Text; aRecord.BookingDate = txtReservationDate_checkIn.Text; aRecord.CheckInDate = txtCheckInDate_checkIn.Text; aRecord.CheckOutDate = txtCheckOutDate_checkIn.Text; aRecord.PaymentStatus = txtPayment_checkIn.Text; Cost aCost = new Cost(); aCost.TotalCost = 0; float.TryParse(txtTotalCost_checkIn.Text, out aCost.TotalCost); aCost.Due = 0; float.TryParse(txtDue_checkIn.Text, out aCost.Due); aCost.LastPayment = 0; float.TryParse(txtPayment_checkIn.Text, out aCost.LastPayment); if (aCost.Due == 0) { aRecord.PaymentStatus = " Clear "; } else if (aCost.Due > 0) { aRecord.PaymentStatus = "Due " + aCost.Due + ""; } else { aRecord.PaymentStatus = ""; } CheckInBLL aCheckINBLL = new CheckInBLL(); bool Result = aCheckINBLL.save_CheckInInformationBLL(aCustomer, aRecord, aCost); if (Result) { System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Check-In Confirmed')</SCRIPT>"); Server.Transfer("CheckIN.aspx", false); } else { System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Error Check-In Please ,check information')</SCRIPT>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { omMaxPage = GetCurrentMaxPage(); } // 页面加载时获取订单未处理订单信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "load") { CheckInBLL ckbll = new CheckInBLL(); string sqlStrByPage = "select * from (" + " select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Fname, C.Cid, C.Gid, C.CheckinTime, S.esOrderContent" + " from Users U, CheckIn C, ServiceOrder S" + " where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and C.CheckinStatus = 0) T where T.Row between 1 and 5"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // 分页获取订单信息数据 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "omByPage") { omNowPage = int.Parse(Request["omNowPage"]); omMaxPage = GetCurrentMaxPage(); if (omNowPage > omMaxPage) { Response.Write(-1); Response.End(); } StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Fname, C.Cid, C.Gid, C.CheckinTime, S.esOrderContent" + " from Users U, CheckIn C, ServiceOrder S" + " where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and C.CheckinStatus = 0) T where T.Row between {0} and {1}", (omNowPage - 1) * 5 + 1, omNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 进行订单的确认或退回操作 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "operation") { long cid = long.Parse(Request["cid"]); decimal oid = decimal.Parse(Request["oid"]); int tag = int.Parse(Request["tag"]); CheckInBLL ckbll = new CheckInBLL(); ServiceOrderBLL esbll = new ServiceOrderBLL(); CheckIn ck = ckbll.GetModel(cid); ServiceOrder esorder = esbll.GetModel(oid); if (tag == 0) { ck.CheckinStatus = 1; esorder.esOrderStatus = 1; ckbll.Update(ck); esbll.Update(esorder); Response.Write(1); Response.End(); } else { ck.CheckinStatus = -1; esorder.esOrderStatus = -1; ckbll.Update(ck); esbll.Update(esorder); Response.Write(2); Response.End(); } } } // 确认后异步更新前台数据, 重新获取最大页数 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "updatePage") { omNowPage = int.Parse(Request["omNowPage"]); omMaxPage = GetCurrentMaxPage(); if (omNowPage - 1 == omMaxPage) { omNowPage = omMaxPage; Response.Write(omNowPage); Response.End(); } StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + " select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Fname, C.Cid, C.Gid, C.CheckinTime, S.esOrderContent" + " from Users U, CheckIn C, ServiceOrder S" + " where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and C.CheckinStatus = 0) T where T.Row between {0} and {1}", (omNowPage - 1) * 5 + 1, omNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["uid"] == null) { ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "login", "<script>notlogined();</script>"); return; } uid = Request.QueryString["uid"]; //uid = Decode(Request.QueryString["uid"], "iRanania"); UsersBLL userBll = new UsersBLL(); userName = userBll.GetModel(int.Parse(uid)).Fname; if (!string.IsNullOrEmpty(Request.QueryString["res"])) { if (int.Parse(Request.QueryString["res"]) == 0) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('没有预定');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 1) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('预定成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 2) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('退房成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 3) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('密码修改成功');});</script>"); } else if (int.Parse(Request.QueryString["res"]) == 4) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "PopUp", "<script>$(function () {window.pop('您的房间已被管理员退回');});</script>"); } } } // 检测是否已经存在预定订单 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "check") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(-1); Response.End(); } else { Response.Write(1); Response.End(); } } } // 检测是否可以退房 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "checkout") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(1); Response.End(); } else { Response.Write(-1); Response.End(); } } } // 检测是否可以订购额外服务 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "eservice") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); CheckInBLL ckbll = new CheckInBLL(); if (ckbll.GetModelList("Uid = " + _uid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)").Count != 0) { Response.Write(1); Response.End(); } else { Response.Write(-1); Response.End(); } } } // 退出登录 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "logout") { string _uid = Request.QueryString["uid"]; //string _uid = Decode(Request.QueryString["uid"], "iRanania"); UsersBLL userbll = new UsersBLL(); Users user = userbll.GetModel(int.Parse(_uid)); user.LoginStatus = 0; userbll.Update(user); //HttpContext.Current.Session["uid"] = null; Response.Write(1); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { // 处理GET请求 if (!IsPostBack) { if (Request.QueryString["uid"] == null) { ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "login", "<script>notlogined();</script>"); return; } uid = Request.QueryString["uid"]; Init_gRoom(); } // 处理POST请求 // 获取房间信息 if (!string.IsNullOrEmpty(Request["postTag"])) { // 获取单人房-硬板床 if (Request["postTag"] == "sh_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) shRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); shNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(shRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取单人房-软榻床 if (Request["postTag"] == "ss_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) ssRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); ssNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(ssRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取双人房-硬板床 if (Request["postTag"] == "dh_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) dhRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); dhNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dhRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取双人房-软榻床 if (Request["postTag"] == "ds_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) dsRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); dsNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dsRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取总统套房-软榻床 if (Request["postTag"] == "ps_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) psRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); psNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(psRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } // 获取总统套房-大圆床 if (Request["postTag"] == "pc_room_bed_type") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); //and (GStatus = 0 or Gstatus = 1 or Gstatus = 4) pcRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", 1, 3).Tables[0]); pcNowPage = 1; JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(pcRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 结算界面数据获取 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "tempInfo") { Gid = int.Parse(Request["gid"]); RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); roomInfoTemp = guestRoomBll.GetModel(Gid); CheckInBLL ckbll = new CheckInBLL(); List <CheckIn> cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)"); // 返回已选时间, 天数 guestRoomInfoWithCkTime gsRoomInfo = new guestRoomInfoWithCkTime() { roomInfo = guestRoomBll.GetModel(Gid) }; for (int i = 0; i < cklist.Count; i++) { gsRoomInfo.ckDateTime.Add(cklist[i].CheckinTime.ToString()); gsRoomInfo.ckDays.Add(cklist[i].CheckinDays); } JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(gsRoomInfo); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 预定模块 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "reserve") { Gid = int.Parse(Request["gid"]); RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); string startDate = Request["startdate"]; int selectDays = int.Parse(Request["selectdays"]); uid = Request.QueryString["uid"]; string[] dateArr = startDate.Split('-'); DateTime startDateTime = new DateTime(int.Parse(dateArr[0]), int.Parse(dateArr[1]), int.Parse(dateArr[2]), 0, 0, 0); CheckInBLL ckbll = new CheckInBLL(); List <CheckIn> cklist = new List <CheckIn>(); // 如果传来的日期为默认今天,且今天被选了,则返回-1 if (startDateTime.Date == DateTime.Now.Date) { cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2) and CONVERT(varchar(10),CheckinTime,120) = (Datename(year,GetDate()) + '-' + Datename(month,GetDate()) + '-' + Datename(day,GetDate()))"); if (cklist.Count != 0) { Response.Write(-1); Response.End(); } cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2) and CONVERT(varchar(10),CheckinTime,120) < (Datename(year,GetDate()) + '-' + Datename(month,GetDate()) + '-' + Datename(day,GetDate()))"); if (cklist.Count != 0) { for (int b = 0; b < cklist.Count; b++) { if (startDateTime.Date >= DateTime.Parse(cklist[b].CheckinTime.ToString()).Date&& startDateTime.Date <= DateTime.Parse(cklist[b].CheckinTime.ToString()).AddDays(int.Parse(cklist[b].CheckinDays.ToString())).Date) { Response.Write(-1); Response.End(); } } } } cklist = ckbll.GetModelList("Gid = " + Gid + " and (CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2)"); // 如果传来的日期为在数据库中已经被选,则返回-2 DateTime selectMinDate, selectMaxDate, dbMinDate, dbMaxDate; selectMinDate = new DateTime(int.Parse(dateArr[0]), int.Parse(dateArr[1]), int.Parse(dateArr[2]), 0, 0, 0); selectMaxDate = selectMinDate.AddDays(selectDays - 1); for (int b = 0; b < cklist.Count; b++) { dbMinDate = DateTime.Parse(cklist[b].CheckinTime.ToString()); dbMaxDate = dbMinDate.AddDays(int.Parse(cklist[b].CheckinDays.ToString()) - 1); if (selectMinDate <= dbMinDate && selectMaxDate >= dbMinDate) { Response.Write(-2); Response.End(); } if (selectMinDate >= dbMinDate && selectMinDate <= dbMaxDate) { Response.Write(-2); Response.End(); } } // 可以插入了 reserveObj = guestRoomBll.GetModel(Gid); DateTime orderCreateTime = DateTime.Now; decimal oid = decimal.Parse(orderCreateTime.ToString("yyyy-MM-dd-HH-mm").Replace("-", "")) * 10000 + Gid; UsersBLL userBll = new UsersBLL(); Users user = userBll.GetModel(int.Parse(uid)); // 服务订单,用于接下来的额外服务预定 ServiceOrder serviceOrder = new ServiceOrder() { Oid = oid, Uid = user.Uid, esOrderCreateTime = DateTime.Parse(orderCreateTime.ToString("yyyy-MM-dd HH:mm:ss")), esOrderContent = "", esOrderTotalPrice = 0, esOrderStatus = 0 }; ServiceOrderBLL orderBLL = new ServiceOrderBLL(); orderBLL.Add(serviceOrder); // 插入住房信息表,如果后期前台退回订单 则会删除该条 // 住房信息订单,每个用户预定房间后都会生成一条 CheckIn checkin = new CheckIn() { Oid = oid, Gid = Gid, Uid = user.Uid, cTotalPrice = reserveObj.RoomPrice * selectDays, CheckinTime = startDateTime, CheckinDays = selectDays, CheckinStatus = 0 }; CheckInBLL ckBll = new CheckInBLL(); ckBll.Add(checkin); long cid = long.Parse(ckBll.GetList("Uid = " + uid + " and CheckinStatus = 0").Tables[0].Rows[0][0].ToString()); if (cid != 0) { Response.Write(cid); } else { Response.Write(-5); } Response.End(); } } // 单人房-硬板床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "shByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); shNowPage = int.Parse(Request["shNowPage"]); shNowPage = shNowPage < 1 ? 1 : shNowPage; shNowPage = shNowPage > shMaxPage ? shMaxPage : shNowPage; shRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (shNowPage - 1) * 3 + 1, shNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(shRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 单人房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "ssByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); ssNowPage = int.Parse(Request["ssNowPage"]); ssNowPage = ssNowPage < 1 ? 1 : ssNowPage; ssNowPage = ssNowPage > ssMaxPage ? ssMaxPage : ssNowPage; ssRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (ssNowPage - 1) * 3 + 1, ssNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(ssRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 双人房-硬板床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "dhByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); dhNowPage = int.Parse(Request["dhNowPage"]); dhNowPage = dhNowPage < 1 ? 1 : dhNowPage; dhNowPage = dhNowPage > dhMaxPage ? dhMaxPage : dhNowPage; dhRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (dhNowPage - 1) * 3 + 1, dhNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dhRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 双人房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "dsByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); dsNowPage = int.Parse(Request["dsNowPage"]); dsNowPage = dsNowPage < 1 ? 1 : dsNowPage; dsNowPage = dsNowPage > dsMaxPage ? dsMaxPage : dsNowPage; dsRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (dsNowPage - 1) * 3 + 1, dsNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(dsRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 总统套房-软榻床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "psByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); psNowPage = int.Parse(Request["psNowPage"]); psNowPage = psNowPage < 1 ? 1 : psNowPage; psNowPage = psNowPage > psMaxPage ? psMaxPage : psNowPage; psRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (psNowPage - 1) * 3 + 1, psNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(psRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } // 总统套房-大圆床Ajax分页查询 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "pcByPage") { RoomType = int.Parse(Request["roomtype"]); BedType = int.Parse(Request["bedtype"]); pcNowPage = int.Parse(Request["pcNowPage"]); pcNowPage = pcNowPage < 1 ? 1 : pcNowPage; pcNowPage = pcNowPage > pcMaxPage ? pcMaxPage : pcNowPage; pcRoomList = guestRoomBll.DataTableToList(guestRoomBll.GetListByPage(("RoomType = " + RoomType + "and BedType = " + BedType + ""), "Gid", (pcNowPage - 1) * 3 + 1, pcNowPage * 3).Tables[0]); JavaScriptSerializer subJson = new JavaScriptSerializer(); object serializer_sub_Obj = subJson.Serialize(pcRoomList); Response.Write(serializer_sub_Obj.ToString()); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sqlStrByAll = "select * from (" + "select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Uid, U.Fname, C.Cid, C.Gid, C.CheckinTime from " + "Users U, CheckIn C, ServiceOrder S " + "where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and " + " (C.CheckinStatus = 0 or C.CheckinStatus = 1 or C.CheckinStatus = 2 or C.CheckinStatus = 3)) T"; SqlConnection f_conn = new SqlConnection(connectString); SqlDataAdapter f_SqlAdapter = new SqlDataAdapter(sqlStrByAll, f_conn); try { DataTable alldata = new DataTable(); f_SqlAdapter.Fill(alldata); ckInfoCount = alldata.Rows.Count; if (ckInfoCount % 5 == 0) { ckInfoMaxPage = ckInfoCount / 5; } else { ckInfoMaxPage = ckInfoCount / 5 + 1; } } catch (SqlException sqlexcp) { Response.Write(sqlexcp.Message); } f_conn.Dispose(); f_SqlAdapter.Dispose(); } // 页面加载时获取入住信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "load") { CheckInBLL ckbll = new CheckInBLL(); string sqlStrByPage = "select * from (" + "select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Uid, U.Fname, C.Cid, C.Gid, C.CheckinTime from " + "Users U, CheckIn C, ServiceOrder S " + "where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and" + " (C.CheckinStatus = 0 or C.CheckinStatus = 1 or C.CheckinStatus = 2 or C.CheckinStatus = 3)) T where T.Row between 1 and 5"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // 分页获取入住信息数据 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "ckInfoByPage") { ckInfoNowPage = int.Parse(Request["ckInfoNowPage"]); StringBuilder sqlPage = new StringBuilder(); sqlPage.AppendFormat("select * from (" + "select ROW_NUMBER() over(order by S.Oid DESC) AS Row, S.Oid, U.Uid, U.Fname, C.Cid, C.Gid, C.CheckinTime from " + "Users U, CheckIn C, ServiceOrder S " + "where U.Uid = S.Uid and C.Uid = S.Uid and C.Oid = S.Oid and" + "(C.CheckinStatus = 0 or C.CheckinStatus = 1 or C.CheckinStatus = 2 or C.CheckinStatus = 3)) T where T.Row between {0} and {1}", (ckInfoNowPage - 1) * 5 + 1, ckInfoNowPage * 5); Response.Write(Get_Serialize_Data_FromSql(connectString, sqlPage.ToString())); Response.End(); } } // 获取个人入住信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "personalCkInfo") { decimal oid = decimal.Parse(Request["oid"]); int uid = int.Parse(Request["uid"]); long cid = long.Parse(Request["cid"]); string sqlStrPesonalInfo = "select distinct U.Fname, U.TelNumber, U.Idcard, C.CheckinTime, C.Gid, C.CheckinStatus, G.RoomType, G.BedType, S.esOrderContent, C.cTotalPrice" + " from Users U, CheckIn C, ServiceOrder S, GuestRoomInfo G, RoomTypeInfo R" + " where U.Uid = " + uid + " and C.Cid = " + cid + " and S.Oid = " + oid + " and C.Gid = G.Gid"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrPesonalInfo)); Response.End(); } } }