/// <summary> /// 保存预订信息 /// </summary> /// <param name="context"></param> public void SaveReserveInfo(HttpContext context) { var data = JSON.Decode(context.Request["data"]); Hashtable i = (Hashtable)data; ReserveInfo reserveInfo = new ReserveInfo(); string status = null; reserveInfo.ReserveNo = (string)i["ReserveNo"]; reserveInfo.ReserveName = (string)i["ReserveName"]; reserveInfo.ReservePerson = (string)i["ReservePerson"]; reserveInfo.ReservePhone = (string)i["ReservePhone"]; //reserveInfo.ReserveNum = Convert.ToInt32(i["RoomCost"]);. //reserveInfo.ReserveCost = Convert.ToInt32(i["RoomSurplus"]); reserveInfo.StartTime = (DateTime)i["StartTime"]; reserveInfo.EndTime = (DateTime)i["EndTime"]; TimeSpan sp = reserveInfo.EndTime.Subtract(reserveInfo.StartTime); reserveInfo.ReserveNum = sp.Days; reserveInfo.ReserveCost = roomInfoBLL.GetReserveCostByReserveName(reserveInfo.ReserveName) * reserveInfo.ReserveNum; status = (string)i["Status"]; bool r = reserveInfoBLL.SaveReserveInfo(reserveInfo, status); if (r) { String json = JSON.Encode("保存成功!"); context.Response.Write(json); } else { String json = JSON.Encode("保存失败!"); context.Response.Write(json); } }
/// <summary> /// 保存客房信息 /// </summary> /// <param name="context"></param> public void SaveTableInfo(HttpContext context) { var data = JSON.Decode(context.Request["data"]); if (data is Hashtable) { Hashtable i = (Hashtable)data; RoomInfo roomInfo = new RoomInfo(); string status = null; roomInfo.RoomId = (string)i["RoomId"]; roomInfo.RoomName = (string)i["RoomName"]; roomInfo.RoomRecommend = Convert.ToInt32(i["RoomRecommend"]); roomInfo.RoomType = Convert.ToInt32(i["RoomType"]) - 1; roomInfo.RoomCost = Convert.ToInt32(i["RoomCost"]); roomInfo.RoomCount = Convert.ToInt32(i["RoomCount"]); roomInfo.RoomSurplus = 0; status = (string)i["Status"]; bool r = roomInfoBLL.SaveRoomInfo(roomInfo, status); if (r) { String json = JSON.Encode("保存成功!"); context.Response.Write(json); } else { String json = JSON.Encode("保存失败!"); context.Response.Write(json); } } else if (data is ArrayList) { ArrayList arryayList = (ArrayList)data; RoomInfo roomInfo = new RoomInfo(); string status = null; foreach (var item in arryayList) { Hashtable hs = (Hashtable)item; roomInfo.RoomId = (string)hs["RoomId"]; roomInfo.RoomName = (string)hs["RoomName"]; roomInfo.RoomRecommend = Convert.ToInt32(hs["RoomRecommend"]); roomInfo.RoomType = Convert.ToInt32(hs["RoomType"]); roomInfo.RoomCost = Convert.ToInt32(hs["RoomCost"]); roomInfo.RoomCount = Convert.ToInt32(hs["RoomCount"]); roomInfo.RoomSurplus = Convert.ToInt32(hs["RoomSurplus"]); status = (string)hs["Status"]; } bool r = roomInfoBLL.SaveRoomInfo(roomInfo, status); if (r) { String json = JSON.Encode("保存成功!"); context.Response.Write(json); } else { String json = JSON.Encode("保存失败!"); context.Response.Write(json); } } }