Example #1
0
        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();
            }
        }
Example #2
0
        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)
            {
                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)
            {
                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();
                }
            }
        }
Example #5
0
        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();
                }
            }
        }