public void addToRoom(int memberID, int roomid) { Groups.Add(Context.ConnectionId, roomid.ToString()); try { Member member = new Member(); member.LoadByPrimaryKey(memberID); bool isHidden = member.Status == (int)Helper.Enums.MemberStatus.Offline && Roles.IsUserInRole(member.Name, Helper.Enums.MemberRoles.InvisibleInRoom.ToString()); RoomMember roomMember = new RoomMember(); if (!roomMember.LoadByPrimaryKey(memberID, roomid)) { roomMember.AddNew(); roomMember.MemberID = memberID; roomMember.RoomID = roomid; } roomMember.LastJoinDate = DateTime.Now; roomMember.InRoom = !isHidden; Room room = new Room(); room.LoadByPrimaryKey(roomid); if (!room.IsColumnNull("CreatedBy")) { if (room.CreatedBy == roomMember.MemberID) roomMember.RoomMemberLevelID = (int)Helper.Enums.RoomMemberLevel.Owner; } roomMember.Save(); Helper.ChatMember chatMember = roomMember.LoadWithSettings(roomid, roomMember.MemberID, roomMember.MemberID, null).FirstOrDefault(); if (!isHidden) Clients.Group(roomid.ToString()).addNewMember(roomid.ToString(), chatMember); if (roomMember.RoomMemberLevelID > (int)Helper.Enums.RoomMemberLevel.Visitor) Groups.Add(Context.ConnectionId, GetRoomAdminGroupName(roomid)); BLL.MemberLog log = new BLL.MemberLog(); Helper.Enums.LogType lgType = Helper.Enums.LogType.EnterRoom; if (isHidden) lgType = Helper.Enums.LogType.EnterRoomHidden; log.AddNew(memberID, new BLL.Log.EnterRoom() { Type = lgType, RoomID = roomid, RoomName = room.Name }, null, roomid); RoomMember onlineroomMember = new RoomMember(); onlineroomMember.GetAllOnlineMembersByRoomID(roomid); Clients.All.updateExistingCount(roomid, onlineroomMember.RowCount); var item = ConnectedUsers.FirstOrDefault(m => m.MemberID == memberID); if (item == null) { var newMember = new Helper.SignalRUser { ConnectionId = Context.ConnectionId, MemberName = member.Name, MemberID = member.MemberID, ProfilePic = member.ProfilePic, MemberTypeSpecID = member.MemberType.MemberTypeSpecDuration.MemberTypeSpecID }; ConnectedUsers.Add(newMember); } } catch (Exception ex) { } }
public void updateRoomMemberSettings(int roomid, int memberid, bool canWrite, bool canAccessMic, bool canAccessCam, string banDays) { try { RoomMemberBanning banning = new RoomMemberBanning(); if (!banning.LoadByPrimaryKey(roomid, memberid)) { banning.AddNew(); banning.RoomID = roomid; banning.MemberID = memberid; } if (String.IsNullOrEmpty(banDays)) { banning.MarkAsDeleted(); try { if (banning.RowState() != System.Data.DataRowState.Added) { //deleted ban from member BLL.Member member = new Member(); member.LoadByPrimaryKey(memberid); BLL.MemberLog log = new BLL.MemberLog(); log.AddNew(BLL.Member.CurrentMemberID, new BLL.Log.UnBanRoomMember() { MemberName = member.Name }, member.MemberID, roomid); } } catch { } } else { int days = Convert.ToInt32(banDays); if (days == 0) { banning.SetColumnNull(RoomMemberBanning.ColumnNames.EndDate); } else { banning.EndDate = DateTime.Now.AddDays(days); } try { BLL.Member member = new Member(); member.LoadByPrimaryKey(memberid); BLL.MemberLog log = new BLL.MemberLog(); BLL.Log.BanRoomMember infoLog = new BLL.Log.BanRoomMember() { MemberName = member.Name }; if (days > 0) { infoLog.BanningDays = days; infoLog.EndDate = banning.EndDate; } log.AddNew(BLL.Member.CurrentMemberID, infoLog, member.MemberID, roomid); } catch { } } banning.Save(); //room member settings RoomMember rm = new RoomMember(); if (!rm.LoadByPrimaryKey(memberid, roomid)) { rm.AddNew(); rm.RoomID = roomid; rm.MemberID = memberid; } rm.CanAccessCam = canAccessCam; rm.CanAccessMic = canAccessMic; rm.CanWrite = canWrite; if (!String.IsNullOrEmpty(banDays)) rm.InRoom = false; rm.Save(); //update clients Clients.Group(roomid.ToString()).updateRoomMemberSettings(roomid, memberid, canWrite, canAccessMic, canAccessCam, banDays); } catch { } }
public void updateMemberLevel(int roomid, int memberid, int level) { try { RoomMember rm = new RoomMember(); if (rm.LoadByPrimaryKey(memberid, roomid)) { rm.RoomMemberLevelID = level; rm.Save(); } //add/remove member to/from signalR admins group var item = ConnectedUsers.FirstOrDefault(x => x.MemberID == memberid); if (level > (int)Helper.Enums.RoomMemberLevel.Visitor) Groups.Add(item.ConnectionId, GetRoomAdminGroupName(roomid)); else Groups.Remove(item.ConnectionId, GetRoomAdminGroupName(roomid)); //update clients Clients.Group(roomid.ToString(), Context.ConnectionId).updateMemberLevel(roomid, memberid, level); } catch { } }
/// <summary> /// Eskat or Cancel Eskat of room member /// </summary> /// <param name="rid"></param> /// <param name="isMarked"></param> /// <param name="memberid"></param> public void ToggleUserMark(int rid, bool isMarked, int memberid) { if (isMarked) Clients.Group(rid.ToString()).UserMarked(rid, memberid); else Clients.Group(rid.ToString()).UserUnMarked(rid, memberid); try { BLL.Member member = new Member(); member.LoadByPrimaryKey(memberid); BLL.MemberLog log = new BLL.MemberLog(); if (isMarked) { log.AddNew(BLL.Member.CurrentMemberID, new BLL.Log.MarkRoomMember() { MemberID = memberid, MemberName = member.Name }, memberid, rid); } else { log.AddNew(BLL.Member.CurrentMemberID, new BLL.Log.UnMarkRoomMember() { MemberID = memberid, MemberName = member.Name }, memberid, rid); } RoomMember rm = new RoomMember(); if (rm.LoadByPrimaryKey(memberid, rid)) { rm.IsMarked = isMarked; rm.CanAccessMic = !isMarked; rm.Save(); } } catch { } }
public void showMemberInRoom(int roomid, int memberid) { RoomMember rm = new RoomMember(); if (rm.LoadByPrimaryKey(memberid, roomid)) { rm.InRoom = true; rm.Save(); } Clients.Group(roomid.ToString()).showMemberInRoom(roomid, memberid); }
public void userStopMic(int rid, int memberid) { Clients.Group(rid.ToString(), Context.ConnectionId).StopListenMic(memberid, rid); RoomMember roomMember = new RoomMember(); if (roomMember.LoadByPrimaryKey(memberid, rid)) { roomMember.HasMic = false; roomMember.Save(); } }
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); } }
public void HandleClose() { Member user = new Member(); user.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString())); user.IsOnLine = false; user.Status = 4; user.Save(); RoomMember rooms = new RoomMember(); rooms.GetAllRoomsByMemberID(user.MemberID); if (rooms.RowCount > 0) { rooms.InRoom = false; if (rooms.HasCam) { rooms.HasCam = false; Room room = new Room(); room.LoadByPrimaryKey(rooms.RoomID); room.OpenCams -= 1; if (room.OpenCams < 0) room.OpenCams = 0; room.Save(); IHubContext _Rcontext = GlobalHost.ConnectionManager.GetHubContext<ChatRoomHub>(); _Rcontext.Clients.Group(rooms.RoomID.ToString()).HideCamLink(rooms.MemberID, rooms.RoomID); } rooms.Save(); } MemberFriend friends = new MemberFriend(); friends.GetAllMemberFriends(user.MemberID); for (int i = 0; i < friends.RowCount; i++) { Member temp = new Member(); temp.LoadByPrimaryKey(friends.FriendID); MembershipUser u = Membership.GetUser(temp.UserID); IHubContext _Ncontext = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>(); _Ncontext.Clients.Group(u.UserName).friendStatusChanged(user.MemberID, user.StatusMsg, "offline"); } // clear all session vars Session.Abandon(); }
public bool MarkMembers(string rid, bool CanWrite, bool mark) { Room room = new Room(); room.LoadByPrimaryKey(Convert.ToInt32(rid)); RoomMember members = new RoomMember(); members.GetAllMembersByRoomID(room.RoomID); try { for (int i = 0; i < members.RowCount; i++) { members.IsMarked = mark; members.CanWrite = CanWrite; members.Save(); Member m = new Member(); m.LoadByPrimaryKey(members.MemberID); MembershipUser u = Membership.GetUser(m.UserID); IHubContext _Rcontext = GlobalHost.ConnectionManager.GetHubContext<ChatRoomHub>(); if (mark) _Rcontext.Clients.Group(room.RoomID.ToString()).UserMarked(room.RoomID, members.MemberID, CanWrite); else _Rcontext.Clients.Group(room.RoomID.ToString()).UserUnMarked(room.RoomID, members.MemberID, CanWrite); members.MoveNext(); } } catch (Exception ex) { return false; } return true; }
public static Helper.ChatRoom GetRoomInfo(int id, bool isTemp, Room room) { Helper.ChatRoom roomObject = new Helper.ChatRoom(); roomObject.ID = id; roomObject.Type = "Room"; roomObject.IsTemp = isTemp; roomObject.Message = ""; roomObject.AdminMessage = ""; //Room info roomObject.Name = room.Name; roomObject.RoomTopic = room.RoomTopic; roomObject.fbURL = room.FbURL; roomObject.tURL = room.TURL; roomObject.utURL = room.UtURL; roomObject.OpenCams = room.OpenCams; if (!room.IsColumnNull("CreatedBy")) roomObject.CreatedBy = room.CreatedBy; RoomBot Allbots = new RoomBot(); roomObject.RoomBots = Allbots.GetByRoomID(id); if (!room.IsColumnNull("CreatedDate")) roomObject.CreatedDate = room.CreatedDate; //Room settings roomObject.Settings.EnableCam = room.EnableCam; roomObject.Settings.EnableMic = room.EnableMic; roomObject.Settings.MarkOnLoginWithoutWrite = room.MarkOnLoginWithoutWrite; roomObject.Settings.MarkOnLoginWithWrite = room.MarkOnLoginWithWrite; roomObject.Settings.EnableMicForAdminsOnly = room.EnableMicForAdminsOnly; if (room.RoomType.RoomTypeSpecDuration.RoomTypeSpecID > 1) // not a free room roomObject.Settings.CamCount = 8; else roomObject.Settings.CamCount = 4; roomObject.Settings.MaxMic = room.RoomType.RoomTypeSpecDuration.RoomTypeSpec.MicCount; roomObject.Settings.TypeID = room.RoomType.RoomTypeSpecDuration.RoomTypeSpecID; roomObject.Settings.Color = room.RoomType.RoomTypeSpecDuration.RoomTypeSpec.Color; //Room Members RoomMember roomMember = new RoomMember(); if (!roomMember.LoadByPrimaryKey(BLL.Member.CurrentMember.MemberID, id)) { roomMember.AddNew(); roomMember.MemberID = BLL.Member.CurrentMember.MemberID; roomMember.RoomID = id; } roomMember.InRoom = true; roomMember.LastJoinDate = DateTime.Now; if (BLL.Member.CurrentMember.Status == (int)Helper.Enums.MemberStatus.Offline && Helper.Admin.HasRole(Helper.Enums.MemberRoles.InvisibleInRoom.ToString())) roomMember.InRoom = false; if (!room.IsColumnNull("CreatedBy")) { if (roomMember.MemberID == room.CreatedBy) roomMember.RoomMemberLevelID = (int)Helper.Enums.RoomMemberLevel.Owner; } roomMember.Save(); roomObject.CurrentMemberID = BLL.Member.CurrentMemberID; List<int> connectedIDs = ChatRoomHub.ConnectedUsers.Select(m => m.MemberID).ToList(); roomObject.Members = roomMember.LoadWithSettings(id, roomObject.CurrentMemberID, null, connectedIDs); var currentMemberSettings = roomObject.Members.First(m => m.MemberID == roomObject.CurrentMemberID); if (currentMemberSettings != null) { if (room.MarkOnLoginWithWrite) { currentMemberSettings.IsMarked = true; currentMemberSettings.CanWrite = true; } if (room.MarkOnLoginWithoutWrite) { currentMemberSettings.IsMarked = true; currentMemberSettings.CanWrite = false; } } // load owner / admins //roomObject.Admins = roomMember.GetAdminsMembersByRoomID(id); // load cat & subcat Category cat = new Category(); if (!room.IsColumnNull("CategoryID")) { cat.LoadByPrimaryKey(room.CategoryID); roomObject.CategoryName = cat.Name; } SubCategory scat = new SubCategory(); if (!room.IsColumnNull("SubCategoryID")) { scat.LoadByPrimaryKey(room.SubCategoryID); roomObject.SubCategoryName = scat.Name; } else { roomObject.SubCategoryName = "لا يوجد"; } //member level change roomObject.MemberLevels = Helper.EnumUtil.GetValues<Helper.Enums.RoomMemberLevel>().Where(l => (int)l < currentMemberSettings.MemberLevelID).Select(l => new { ID = (int)l, Name = Helper.StringEnum.GetStringValue(l) }).ToList(); //messages //roomObject.MessageHistory = new RoomMessages().GetLatestMessags(id, 0); roomObject.MessageHistory = new List<Helper.ChatMessage>() { }; /////////////////////////// Gift allgifts = new Gift(); allgifts.LoadAll(); roomObject.Gifts = allgifts.DefaultView.Table.AsEnumerable().Select(m => new { giftid = m["GiftID"], name = m["Name"], price = m["Price_Point"], picPath = m["PicPath"], AudioPath = m["AudioPath"] }).ToList(); //bots RoomBot bllRoomBot = new BLL.RoomBot(); //welcome bot List<Info.RoomBot> bots = bllRoomBot.GetByRoomIDandBotID(id, Helper.Enums.Bot.Welcome); if (bots.Count > 0) { Info.WelcomeBot infoWelcomeBot = (Info.WelcomeBot)bots.First().Settings; roomObject.WelcomeBot = infoWelcomeBot; } return roomObject; }
public int GetQueueOrder(int memberID, int roomID) { int value = 0; RoomMember member = new RoomMember(); member.LoadByPrimaryKey(memberID, roomID); RoomMember order = new RoomMember(); order.GetMaxQueueOrderByRoomID(roomID); if (member.IsColumnNull("QueueOrder")) { member.QueueOrder = Convert.ToInt32(order.GetColumn("MaxQueueOrder")) + 1; value = member.QueueOrder; } else member.SetColumnNull("QueueOrder"); member.Save(); return value; }
public bool AddRoomToFav(string rid) { try { BLL.Member member = BLL.Member.CurrentMember; RoomMember rm = new RoomMember(); if (!rm.LoadByPrimaryKey(member.MemberID, Convert.ToInt32(rid))) { rm.AddNew(); rm.MemberID = member.MemberID; rm.RoomID = Convert.ToInt32(rid); } rm.IsFavorite = true; rm.Save(); return true; } catch (Exception ex) { return false; } }
public bool UpdateRoomMemberSetting(int rid, int mid, string setting, bool newValue) { try { RoomMember rSetting = new RoomMember(); if (!rSetting.LoadByPrimaryKey(mid, rid)) { rSetting.AddNew(); rSetting.RoomID = rid; rSetting.MemberID = mid; } rSetting.SetColumn(setting, newValue); rSetting.Save(); } catch (Exception ex) { return false; } return true; }
protected void uiLinkButton_Click(object sender, EventArgs e) { Helper.Enums.RoomMemberLevel currentType = Helper.EnumUtil.ParseEnum<Helper.Enums.RoomMemberLevel>(Convert.ToInt32(uiDropDownListAdminType.SelectedValue)); /*Member currentMember = new Member(); currentMember.LoadByPrimaryKey(Convert.ToInt32(uiHiddenFieldAdminID.Value)); for (int i = 0; i < AdminsTable.Rows.Count; i++) { if (Convert.ToInt32(AdminsTable.Rows[i]["MemberID"].ToString()) == currentMember.MemberID) { ClientScript.RegisterStartupScript(this.GetType(), "viewalert", "viewAdminError();", true); return; } } AdminsTable.Rows.Add(currentMember.MemberID, currentMember.Name, (int)currentType, Helper.StringEnum.GetStringValue(currentType)); AdminsTable.AcceptChanges(); */ RoomMember member = new RoomMember(); if (member.LoadByPrimaryKey(Convert.ToInt32(uiHiddenFieldAdminID.Value), CurrentRoom)) { if(member.RoomMemberLevelID != (int)Helper.Enums.RoomMemberLevel.Owner) // not owner member.RoomMemberLevelID = (int)currentType; member.Save(); } else { member.AddNew(); member.MemberID = Convert.ToInt32(uiHiddenFieldAdminID.Value); member.RoomID = CurrentRoom; member.RoomMemberLevelID = (int)currentType; member.Save(); } BindAdmins(); }
public void userStartCam(int rid, int memberid) { Clients.Group(rid.ToString(), Context.ConnectionId).ShowCamLink(memberid, rid); Room room = new Room(); room.LoadByPrimaryKey(rid); if (room.IsColumnNull("OpenCams")) room.OpenCams = 1; else room.OpenCams += 1; room.Save(); RoomMember roomMember = new RoomMember(); if (roomMember.LoadByPrimaryKey(memberid, rid)) { roomMember.HasCam = true; roomMember.Save(); } }
public bool RateRoom(string rid, string rate) { MembershipUser user = Membership.GetUser(); Member member = new Member(); member.GetMemberByUserId(new Guid(user.ProviderUserKey.ToString())); RoomMember Rmember = new RoomMember(); Rmember.LoadByPrimaryKey(member.MemberID, Convert.ToInt32(rid)); try { Rmember.UserRate = Convert.ToInt16(rate); Rmember.Save(); } catch (Exception ex) { return false; } return true; }
public void userStopCam(int rid, int memberid) { Clients.Group(rid.ToString(), Context.ConnectionId).HideCamLink(memberid, rid); Room room = new Room(); room.LoadByPrimaryKey(rid); if (room.IsColumnNull("OpenCams")) room.OpenCams = 0; else room.OpenCams -= 1; if (room.OpenCams < 0) room.OpenCams = 0; RoomMember roomMember = new RoomMember(); if (roomMember.LoadByPrimaryKey(memberid, rid)) { roomMember.HasCam = false; roomMember.Save(); } room.Save(); }
public void removeFromRoom(int memberID, int roomid) { // just remove member from signalr hub and update flag InRoom to false try { Clients.Group(roomid.ToString()).removeMember(memberID, roomid); Groups.Remove(Context.ConnectionId, roomid.ToString()); RoomMember roomMember = new RoomMember(); if (roomMember.LoadByPrimaryKey(memberID, roomid)) { roomMember.InRoom = false; roomMember.HasCam = false; roomMember.HasMic = false; roomMember.SetColumnNull(RoomMember.ColumnNames.QueueOrder); roomMember.Save(); RoomMember onlineroomMember = new RoomMember(); onlineroomMember.GetAllOnlineMembersByRoomID(roomid); Clients.All.updateExistingCount(roomid, onlineroomMember.RowCount); if (roomMember.RoomMemberLevelID > (int)Helper.Enums.RoomMemberLevel.Visitor) Groups.Remove(Context.ConnectionId, GetRoomAdminGroupName(roomid)); } } catch (Exception ex) { } }
public void banMemberFromRoom(int memberid, int roomid, int banType, string adminName) { try { RoomMember member = new RoomMember(); member.LoadByPrimaryKey(memberid, roomid); member.InRoom = false; member.HasCam = false; member.HasMic = false; member.SetColumnNull(BLL.RoomMember.ColumnNames.QueueOrder); member.Save(); string banTypeName = Helper.StringEnum.GetStringValue(Helper.EnumUtil.ParseEnum<Helper.Enums.BanningType>(banType)); Clients.Group(roomid.ToString()).banMemberFromRoom(memberid, roomid, banTypeName, adminName); } catch (Exception ex) { } }
protected void uiGridViewAdmins_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteAdmin") { RoomMember mem = new RoomMember(); if (mem.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()), CurrentRoom)) { if (mem.RoomMemberLevelID != (int)Helper.Enums.RoomMemberLevel.Owner) { mem.RoomMemberLevelID = 1; //Helper.Enums.RoomMemberLevel.Visitor; mem.Save(); } } BindAdmins(); } }