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