示例#1
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();
                }

            }
        }
示例#2
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")
                {
                    Member member = new Member();
                    member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));

                    Room rooms = new Room();
                    rooms.GetRoomsByCreatorID(member.MemberID);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }
                else if (myparams[0] == "fav=1")
                {
                    Member member = new Member();
                    member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));

                    Room rooms = new Room();
                    rooms.GetFavoriteByMemberID(member.MemberID);
                    uiRepeaterRooms.DataSource = rooms.DefaultView;
                    uiRepeaterRooms.DataBind();
                }

            }
        }
        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);
        }