Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Category cats = new Category();
                cats.GetAllCats();
                uiRepeaterCats.DataSource = cats.DefaultView;
                uiRepeaterCats.DataBind();

                Room rooms = new Room();
                rooms.GetRoomsByCreatorID(Member.CurrentMemberID);
                catlink_minecount.Text = rooms.RowCount.ToString();
                rooms.GetFavoriteByMemberID(Member.CurrentMemberID);
                catlink_favcount.Text = rooms.RowCount.ToString();
            }
        }
Ejemplo n.º 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();
                }

            }
        }
Ejemplo n.º 3
0
        private void LoadRooms()
        {
            Member member = new Member();
            member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));
            Room myrooms = new Room();
            myrooms.GetRoomsByCreatorID(member.MemberID);

            uiRepeaterMyRooms.DataSource = myrooms.DefaultView;
            uiRepeaterMyRooms.DataBind();
        }
Ejemplo n.º 4
0
        private void LoadDDLs()
        {
            Category cats = new Category();
            cats.LoadAll();
            uiDropDownListADD_Category.DataSource = cats.DefaultView;
            uiDropDownListADD_Category.DataTextField = "Name";
            uiDropDownListADD_Category.DataValueField = "CategoryID";
            uiDropDownListADD_Category.DataBind();

            uiDropDownListEdit_Category.DataSource = cats.DefaultView;
            uiDropDownListEdit_Category.DataTextField = "Name";
            uiDropDownListEdit_Category.DataValueField = "CategoryID";
            uiDropDownListEdit_Category.DataBind();

            var adminTypes = Helper.EnumUtil.GetValues<Helper.Enums.RoomMemberLevel>().Where(l => (int)l > (int)Helper.Enums.RoomMemberLevel.Visitor && (int)l != (int)Helper.Enums.RoomMemberLevel.Owner).Select(r => new
            {
                AdminTypeID = (int)r,
                Name = Helper.StringEnum.GetStringValue(r)
            }).ToList();
            uiDropDownListAdminType.DataSource = adminTypes;
            uiDropDownListAdminType.DataTextField = "Name";
            uiDropDownListAdminType.DataValueField = "AdminTypeID";
            uiDropDownListAdminType.DataBind();

            BindSubCats();

            Room myrooms = new Room();
            myrooms.GetRoomsByCreatorID(Member.CurrentMemberID);
            uiDropDownListMyRooms.DataSource = myrooms.DefaultView;
            uiDropDownListMyRooms.DataTextField = "Name";
            uiDropDownListMyRooms.DataValueField = "RoomID";
            uiDropDownListMyRooms.DataBind();
            uiDropDownListMyRooms.Items.Insert(0, new ListItem("إختر غرفة. . . ."));
            if (CurrentRoom != 0)
                uiDropDownListMyRooms.SelectedValue = CurrentRoom.ToString();
        }
Ejemplo n.º 5
0
        protected void uiLinkButtonSaveRoom_Click(object sender, EventArgs e)
        {
            // check member type
            // check number of created rooms
            string querystring = "";
            if (Request.IsAuthenticated)
            {
                Member member = new Member();
                member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));
                Room room = new Room();
                if (!IsEdit)
                {
                    // check no room exists with the same name
                    room.Where.Name.Value = uiTextBoxADD_Name.Text;
                    room.Where.Name.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                    room.Query.Load();
                    if (room.RowCount > 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "error_roomnameexists", "$(document).ready(function (){ notify('error','حدث خطأ. إسم الغرفة موجود من قبل.');}); ", true);
                        return;
                    }

                    // max no of created room = 2
                    room.Where.WhereClauseReset();
                    room.Where.CreatedBy.Value = member.MemberID;
                    room.Where.CreatedBy.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                    room.Query.Load();
                    if (room.RowCount >= 2)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "error_roomnameexists", "$(document).ready(function (){ notify('error','عفواً ، تم تخطى العدد المسموح للغرف الخاصة بك.');}); ", true);
                        return;
                    }
                    room.AddNew();
                    room.Name = uiTextBoxADD_Name.Text;
                    querystring = "c=true";
                }
                else
                {
                    room.LoadByPrimaryKey(CurrentRoom);
                    querystring = "e=true";
                }

                if (!IsEdit)
                {
                    room.CreatedDate = DateTime.Now;
                    room.CreatedBy = member.MemberID;
                    if (uiDropDownListADD_Category.SelectedIndex != -1)
                        room.CategoryID = Convert.ToInt32(uiDropDownListADD_Category.SelectedValue);
                    if (uiDropDownListADD_SubCategory.SelectedIndex != 0)
                        room.SubCategoryID = Convert.ToInt32(uiDropDownListADD_SubCategory.SelectedValue);

                }
                else
                {
                    if (uiDropDownListEdit_Category.SelectedIndex != -1)
                        room.CategoryID = Convert.ToInt32(uiDropDownListEdit_Category.SelectedValue);
                    if (uiDropDownListEditSubCat.SelectedIndex != 0)
                        room.SubCategoryID = Convert.ToInt32(uiDropDownListEditSubCat.SelectedValue);

                }

                if (uiFileUploadRoomPic.HasFile)
                {
                    string path = "~/" + ConfigurationManager.AppSettings["roomspics"].ToString();
                    DirectoryInfo dir = new DirectoryInfo(Server.MapPath(path + "/" + Membership.GetUser().ProviderUserKey.ToString()));
                    if (!dir.Exists)
                        dir.Create();
                    path += "/" + Membership.GetUser().ProviderUserKey.ToString() + "/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadRoomPic.FileName;
                    uiFileUploadRoomPic.SaveAs(Server.MapPath(path));
                    room.IconPath = path;
                }

                room.RoomPassword = uiTextBoxPassword.Text;
                room.RoomAdminPassword = uiTextBoxAdminPass.Text;
                room.RoomPasswordenabled = uiCheckBoxPasswordEnable.Checked;
                room.EnableCam = true;
                room.EnableMic = true;
               /* room.EnableCam = uiCheckBoxEnableCam.Checked;
                room.EnableOneMic = uiCheckBoxEnableOneMic.Checked;
                room.EnableTwoMic = uiCheckBoxEnableTwoMic.Checked;
                room.EnableThreeMic = uiCheckBoxEnableThreeMic.Checked;*/
                room.RowStatusID = 1;
                room.Save();

                // update room count for cats & subcats
                IHubContext _Rcontext = GlobalHost.ConnectionManager.GetHubContext<ChatRoomHub>();
                Room rooms = new Room();
                rooms.GetRoomsByCreatorID(Member.CurrentMemberID);
                _Rcontext.Clients.Group(member.UserName).updateRoomCount(0, 0, rooms.RowCount, true);

                rooms.GetRoomsByCategoryID(room.CategoryID);
                _Rcontext.Clients.All.updateRoomCount(room.CategoryID, 0, rooms.RowCount, false);

                if (!room.IsColumnNull(Room.ColumnNames.SubCategoryID))
                {
                    rooms.GetRoomsBySubCategoryID(room.SubCategoryID);
                    _Rcontext.Clients.All.updateRoomCount(0, room.SubCategoryID, rooms.RowCount, false);
                }

                /* add room owner */
                RoomMember roommember = new RoomMember();
                roommember.AddNew();
                roommember.RoomID = room.RoomID;
                roommember.MemberID = room.CreatedBy;
                roommember.RoomMemberLevelID = (int)Helper.Enums.RoomMemberLevel.Owner;
                roommember.Save();

                uiPanelSuccess.Visible = true;
                uiTextBoxADD_Name.Text = "";
                uiDropDownListADD_Category.SelectedIndex = 0;
                uiDropDownListADD_SubCategory.SelectedIndex = 0;
                uiTextBoxPassword.Text = "";
                uiTextBoxAdminPass.Text = "";
                uiCheckBoxPasswordEnable.Checked = false;

                // log
                if (!IsEdit)
                {
                    BLL.MemberLog log = new BLL.MemberLog();
                    log.AddNew(BLL.Member.CurrentMemberID, new BLL.Log.CreateRoom() { RoomID = room.RoomID, RoomName = room.Name }, null, room.RoomID);
                }

               /* if (AdminsTable.Rows.Count > 0)
                {
                    RoomMember roommember = new RoomMember();
                    roommember.GetAllAdminMembersByRoomID(room.RoomID);
                    roommember.DeleteAll();
                    roommember.Save();

                    RoomMember toAdd = new RoomMember();
                    for (int i = 0; i < AdminsTable.Rows.Count; i++)
                    {
                        if (Convert.ToInt32(AdminsTable.Rows[i]["MemberID"].ToString()) == room.CreatedBy)
                            continue;
                        toAdd.AddNew();
                        toAdd.RoomID = room.RoomID;
                        toAdd.MemberID = Convert.ToInt32(AdminsTable.Rows[i]["MemberID"].ToString());
                        toAdd.RoomMemberLevelID = Convert.ToInt32(AdminsTable.Rows[i]["AdminTypeID"].ToString());
                    }

                    toAdd.Save();
                }
                else
                {
                    RoomMember roommember = new RoomMember();
                    roommember.AddNew();
                    roommember.RoomID = room.RoomID;
                    roommember.MemberID = room.CreatedBy;
                    roommember.RoomMemberLevelID = (int)Helper.Enums.RoomMemberLevel.Owner;
                    roommember.Save();
                }
                */
                CurrentRoom = room.RoomID;
                Response.Redirect("createRoom.aspx?IsEdit=true&" +querystring);

            }
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
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();
                }

            }
        }