public void GetRooms(string localParams)
        {
            string[] myparams = null;
            if (!string.IsNullOrEmpty(localParams))
            {
                myparams = localParams.Split('&');
            }
            Room rooms = new Room();
            if (myparams.Length > 0)
            {
                if (myparams[0] == "cat=1")
                {
                    int cid = Convert.ToInt32(myparams[1].Substring(2));
                    rooms.GetRoomsByCategoryID(cid);
                }
                else if (myparams[0] == "subcat=1")
                {
                    int scid = Convert.ToInt32(myparams[1].Substring(2));
                    rooms.GetRoomsBySubCategoryID(scid);
                }
                else if (myparams[0] == "vip=1")
                {
                    rooms.GetPremiumRooms();
                }
                else if (myparams[0] == "cb=1")
                {
                    rooms.GetRoomsByCreatorID(BLL.Member.CurrentMember.MemberID);
                }
                else if (myparams[0] == "fav=1")
                {
                    rooms.GetFavoriteByMemberID(BLL.Member.CurrentMember.MemberID);
                }
                else if (myparams[0] == "s=1") // search rooms
                {
                    string filterText = myparams[1].Substring(3); // st=
                    rooms.SearchRooms(filterText);
                }

            }
            var lst = rooms.DefaultView.Table.AsEnumerable().Select(m =>
                new
                {
                    ID = m[Room.ColumnNames.RoomID],
                    Name = m[Room.ColumnNames.Name],
                    TypeSpecID = m["RoomTypeSpecID"],
                    Rate = m["RoomRate"],
                    ExistingMembers = m["ExistingMembersCount"],
                    OpenCams = m["OpenCams"]
                }
                ).ToList();

            SetContentResult(lst);
        }
示例#2
0
 public void SearchRoomsForTypes(string q)
 {
     Room bllRooms = new Room();
     int? createdBy;
     if (Helper.Admin.IsAdmin() && (Helper.Admin.HasRole(Helper.Enums.AdminRoles.Admin_RoomType.ToString()) || Helper.Admin.HasRole(Helper.Enums.AdminRoles.Admin_AddVIPRoom.ToString())))
     {
         createdBy = null;
     }
     else
     {
         createdBy = BLL.Member.CurrentMemberID;
     }
     bllRooms.SearchRooms(q, createdBy);
     var rooms = bllRooms.DefaultView.Table.AsEnumerable().Select(m => new { id = m[BLL.Room.ColumnNames.RoomID], name = m[BLL.Room.ColumnNames.Name] }).ToList();
     string result = Newtonsoft.Json.JsonConvert.SerializeObject(rooms);
     HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
     HttpContext.Current.Response.Write(result);
     //return result;
 }
示例#3
0
        private void BindRooms()
        {
            string[] myparams = null;
            if (!string.IsNullOrEmpty(localParams))
            {
                myparams = localParams.Split('&');
            }

            if (myparams.Length > 0)
            {
                if (myparams[0] == "cat=1")
                {
                    int cid = Convert.ToInt32(myparams[1].Substring(2));
                    Room rooms = new Room();
                    rooms.GetRoomsByCategoryID(cid);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "subcat=1")
                {
                    int scid = Convert.ToInt32(myparams[1].Substring(2));
                    Room rooms = new Room();
                    rooms.GetRoomsBySubCategoryID(scid);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "vip=1")
                {
                    Room rooms = new Room();
                    rooms.GetPremiumRooms();
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "cb=1")
                {
                    Room rooms = new Room();
                    rooms.GetRoomsByCreatorID(BLL.Member.CurrentMember.MemberID);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "fav=1")
                {
                    Room rooms = new Room();
                    rooms.GetFavoriteByMemberID(BLL.Member.CurrentMember.MemberID);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "s=1") // search rooms
                {
                    string filterText = myparams[1].Substring(3); // st=
                    Room rooms = new Room();
                    rooms.SearchRooms(filterText);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }

            }
        }