/// <summary> /// Abilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore, utente non abilitato /// </returns> public override bool UserEnable(long UserId, long RoomId) { bool NeedMail = true; //Intanto sempre, poi qui false ed attivo in base a configurazione stanza. WbUser User = DAL.UserGet(UserId); if (User.MailChecked == false && User.Enabled == false) { NeedMail = true; } if (User != null) { User.Enabled = true; if (String.IsNullOrEmpty(User.ExternalID)) { this.UserAddToExternalSystem(ref User); } } User.MailChecked = true; DAL.UserSaveOrUpdate(User); if (!NeedMail) { WbRoom oRoom = DAL.RoomGet(RoomId); NeedMail = oRoom.NotificationEnableUsr; } return(NeedMail); }
/// <summary> /// Disabilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore interno, utente non abilitato /// </returns> /// <remarks> /// Al momento disabilitata lato eWorks, /// finchè manca l'enable key. /// </remarks> public override bool UserDisable(int UserId, long RoomId) { String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); if (User != null) { eWAPIConnector.DisableKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, RoomKey, User.ExternalID ); User.Enabled = false; DAL.UserSaveOrUpdate(User); } WbRoom oRoom = DAL.RoomGet(RoomId); bool NeedMail = oRoom.NotificationDisableUsr; //Intanto mando SEMPRE! POI su configurazione stanza. return(NeedMail); }
/// <summary> /// Cancella una stanza /// </summary> /// <param name="RoomId">ID della stanza da cancellare</param> /// <returns>True se cancellata</returns> public override bool RoomDelete(long RoomId) { Boolean notError = true; WbRoom Room = DAL.RoomGet(RoomId); // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); long ExtRoomId = -1; try { ExtRoomId = System.Convert.ToInt64(Room.ExternalId); } catch { } if (ExtRoomId > 0) { try { RoomService.deleteRoom(SessionID, ExtRoomId); } catch { notError = false; } if (!notError) //Errore cancellazione. Controllo se la chiave esiste. In tal caso provo comunque a cancellarla da dB. { OMroomService.Rooms rm = null; try { rm = RoomService.getRoomById(SessionID, ExtRoomId); } catch { //DA TESTARE!!! } if (rm == null) { notError = true; } } } if (notError) { notError &= DAL.RoomDelete(Room); } return(notError); }
/// <summary> /// Recupera stanza con tutti i dati /// </summary> /// <param name="RoomId">Id della stanza</param> /// <returns>Oggetto WbRoom</returns> public override WbRoom RoomGet(long RoomId) { //' LOGIN DI UN ADMINISTRATOR //UserID = oUserService.loginUser(SessionID, Me.SystemSettings.OpenMeetingService.Login, Me.SystemSettings.OpenMeetingService.Password) WbRoom Room = DAL.RoomGet(RoomId); if (Room != null) { // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); oMRoomParameters roomParams = new oMRoomParameters(); long OMroomId = 0; OMroomService.Rooms omRoom = new OMroomService.Rooms(); try { OMroomId = System.Convert.ToInt64(Room.ExternalId); omRoom = RoomService.getRoomById(SessionID, OMroomId); } catch { return(null); } if (omRoom != null) { roomParams.allowUserQuestions = omRoom.allowUserQuestions ?? true; roomParams.isModeratedRoom = omRoom.isModeratedRoom ?? false; roomParams.ispublic = omRoom.ispublic ?? false; roomParams.numberOfPartizipants = omRoom.numberOfPartizipants ?? 10; roomParams.redirectURL = omRoom.redirectURL ?? ""; roomParams.validFromDate = omRoom.starttime ?? DateTime.Now; DateTime EndDate = Room.StartDate ?? roomParams.validFromDate; if (Room.EndDate == null) { EndDate = EndDate.AddMinutes(Room.Duration); } roomParams.validToDate = Room.EndDate ?? EndDate; Room.Parameter = roomParams; } } return(Room); }
/// <summary> /// Aggiorna i dati di una stanza /// </summary> /// <param name="RoomId">ID stanza</param> /// <param name="Data">Dati stanza (generici)</param> /// <param name="Parameters">Parametri stanza (dati avanzati, basati su integrazione)</param> /// <returns>La stanza con i dati aggiornati</returns> public override WbRoom RoomUpdateData(long RoomId, DTO.DTO_GenericRoomData Data, WbRoomParameter Parameters, bool HasIdInName) { if (HasIdInName) { Data.Name = string.Format("({0}) {1}", RoomId.ToString(), Data.Name); } Data.HasIdInName = HasIdInName; String ExternalId = DAL.RoomGetExternaId(RoomId); WbRoom UpdatedRoom = DAL.RoomUpdate(RoomId, Data); try { oMRoomParameters Param = (oMRoomParameters)Parameters; // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); long ExtRoomId = System.Convert.ToInt64(ExternalId); RoomService.updateRoomWithModerationAndQuestions( SessionID, ExtRoomId, UpdatedRoom.Name, OMP_Roomtypes_id, UpdatedRoom.Description, Param.numberOfPartizipants, UpdatedRoom.Public, OMP_appointment, OMP_isDemoRoom, OMP_demoTime, Param.isModeratedRoom, Param.allowUserQuestions ); } catch (Exception ex) { UpdatedRoom.Parameter = null; } return(UpdatedRoom); }
/// <summary> /// Recupera stanza con tutti i dati /// </summary> /// <param name="RoomId">Id della stanza</param> /// <returns>Oggetto WbRoom</returns> public override WbRoom RoomGet(long RoomId) { WbRoom Room = DAL.RoomGet(RoomId); if (Room != null) { Room.Parameter = eWAPIConnector.GetRoomParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId); } return(Room); }
/// <summary> /// Modifica una stanza /// </summary> /// <param name="User">L'utente per cui creare la stanza</param> /// <returns>true = updated</returns> /// <remarks> /// SE viene impostata data di inizio e fine, viene ricalcolata la Duration /// SE viene impostata data di inizio e durata, ma non la data di fine, viene calcolata la data di fine /// </remarks> public override Boolean RoomUpdate(WbRoom Room) { if (Room == null) { throw new ArgumentNullException("Room", "Cannot be null."); } if (Room.Parameter.GetType() != typeof(eWRoomParameters)) { throw new ArgumentException("Room paramter must be eWRoomParameters", "Room.Parameter"); } eWRoomParameters param = new eWRoomParameters(); try { param = (eWRoomParameters)Room.Parameter; } catch { param = null; } if (param != null) { Room.Recording = param.recording; WbRoom OldRoom = DAL.RoomUpdate(Room); try { eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, OldRoom.ExternalId, param, this.eWSysParameter.MaxUrlChars, false, this.eWSysParameter.Version); } catch (Exception ex) { OldRoom.Id = -2; } if (OldRoom.Id > 0) { return(true); } } return(false); }
/// <summary> /// Abilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: Invia MAIL di prima iscrizione /// False: Non inviare mail... /// </returns> public override bool UserEnable(Int64 UserId, long RoomId) { bool NeedMail = false; String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); //DAL.GetUserInRoomByPerson(PersonId, RoomId); if (User.MailChecked == false && User.Enabled == false) { NeedMail = true; } if (String.IsNullOrEmpty(User.ExternalID)) { UserAddToExternalSystem(ref User); } if (User.Enabled == false) { eWAPIConnector.EnableKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, RoomKey, User.ExternalID ); } User.MailChecked = true; if (User != null) { User.Enabled = true; } DAL.UserSaveOrUpdate(User); if (!NeedMail) { WbRoom oRoom = DAL.RoomGet(RoomId); NeedMail = oRoom.NotificationEnableUsr; } return(NeedMail); }
/// <summary> /// Cancella una stanza /// </summary> /// <param name="RoomId">ID della stanza da cancellare</param> /// <returns>True se cancellata</returns> public override bool RoomDelete(long RoomId) { WbRoom Room = DAL.RoomGet(RoomId); Boolean notError = true; try { eWAPIConnector.DeleteKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId, Room.ExternalId); } catch { notError = false; } if (!notError) { //Ci sono stati errori. //Potenzialmente la chiave potrebbe non esistere sul server... try { DTO.DTOKeyInfo ki = eWAPIConnector.GetKeyInfo(this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId); notError = false; } catch { //ERROR: La chiave non esiste. Verrà cancellata da dB. notError = true; } } if (notError) { notError &= DAL.RoomDelete(Room); } return(notError); }
//public void UpdateRoomRecording() //{ // IList<WbRoom> Rooms = DAL.RoomsGetAll(); // foreach (WbRoom Room in Rooms) // { // Room.Recording = false; // DAL.RoomUpdate(Room); // } // //return false; //} #endregion #region User management /// <summary> /// Aggiunge un utente /// </summary> /// <param name="Users">Dati utente</param> /// <param name="RoomId">IdStanza</param> public override void UsersAdd(IList <WbUser> Users, long RoomId) { WbRoom oRoom = DAL.RoomGet(RoomId); if (Users != null && Users.Count() > 0) { foreach (WbUser usr in Users) { if (usr.Id == 0 || String.IsNullOrEmpty(usr.ExternalID)) { usr.ExternalID = Guid.NewGuid().ToString(); } usr.RoomId = oRoom.Id; usr.ExternalRoomId = oRoom.ExternalId; DAL.UserSaveOrUpdate(usr); } } DAL.RoomUpdateUserNumber(RoomId); }
private void LoadCommunityFilters(long idRoom, dtoUsersByMessageFilter filter) { WbRoom room = Service.RoomGet(idRoom); if (room != null && room.SubCommunity != SubscriptionType.None) { filter.IdCommunity = room.CommunityId; filter.IdRole = -1; filter.IdProfileType = -1; View.LoadAvailableRoles(ProfileService.GetAvailableSubscriptionsIdRoles(room.CommunityId, new List <Int32>(), false), -1); } else if (room != null && room.SubSystem != SubscriptionType.None) { filter.IdRole = -1; filter.IdCommunity = room.CommunityId; View.LoadAvailableProfileType(ProfileService.GetAvailableProfileTypes(-1), -1); } else { View.HideCommunityFilters(); } }
/// <summary> /// Disabilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore interno, utente non abilitato /// </returns> public override bool UserDisable(int UserId, long RoomId) { WbUser User = DAL.UserGet(UserId); // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); if (User != null) { User.Enabled = false; UserService.kickUserByPublicSID(SessionID, User.ExternalID); } DAL.UserSaveOrUpdate(User); WbRoom oRoom = DAL.RoomGet(RoomId); bool NeedMail = oRoom.NotificationDisableUsr; return(NeedMail); }
/// <summary> /// Modifica una stanza /// </summary> /// <param name="User">L'utente per cui creare la stanza</param> /// <returns>true = updated</returns> public override bool RoomUpdate(WbRoom Room) { if (Room == null || Room.Parameter == null || Room.Parameter.GetType() != typeof(oMRoomParameters)) { throw new ArgumentException("Parameter must be eWRoomParameters!"); } oMRoomParameters Param = (oMRoomParameters)Room.Parameter; // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); //Param.isModeratedRoom = false; //Param. = 1; //Param.redirectURL = "www.ecosia.org"; Room.Parameter = Param; WbRoom OldRoom = DAL.RoomUpdate(Room); //OMP_Roomtypes_id //OMP_appointment = false; //OMP_isDemoRoom = false; //OMP_demoTime = 120; try { RoomService.updateRoomWithModerationAndQuestions( SessionID, Room.Id, Room.Name, OMP_Roomtypes_id, Room.Description, Param.numberOfPartizipants, Room.Public, OMP_appointment, OMP_isDemoRoom, OMP_demoTime, Param.isModeratedRoom, Param.allowUserQuestions ); } catch { return(true); } //RoomService.updateRoom( // SessionID, // Room.Id, // Room.Name, // OM_Roomtypes_id, // Room.Description, // Param.numberOfPartizipants, // Room.Public,) return(false); }
/// <summary> /// Recupera l'indirizzo per l'accesso alla stanza. /// </summary> /// <param name="RoomId">Id Stanza</param> /// <param name="UserId">Id Utente stanza</param> /// <returns> /// Stringa vuota: non è possibile accesere /// URL accesso alla stanza /// </returns> /// <remarks> /// Per alcune implementazioni è necessario generare l'url di volta in volta ad ogni accesso. /// Le "vecchie" logiche sul "pubblica" sono state eliminate. /// </remarks> public override string AccessUrlExternalGet(long RoomId, long UserId) { WbUser User = DAL.UserGet(UserId); WbRoom Room = DAL.RoomGet(RoomId); if (Room != null && (Room.Public || User != null)) { oMRoomParameters Param = null; try { Param = (oMRoomParameters)Room.Parameter; } catch { return(""); } if (User == null || User.Enabled == false) { return(""); } String URL = ""; // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); //String Name = User.DisplayName.Split(' ')[0]; //String SurName = User.DisplayName.Remove(0, Name.Length + 1); int becomModerator = 0; if (User.IsController || User.IsHost) { becomModerator = 1; } int showAudioVideoTest = 1; //0 means don't show Audio/Video Test, 1 means show Audio/Video Test Application before the user is logged into the room long ExtRoomId = 0; try { ExtRoomId = System.Convert.ToInt64(Room.ExternalId); } catch { } URL = UserService.setUserObjectAndGenerateRoomHash( SessionID, User.DisplayName, User.Name, User.SName, "xx", User.Mail, User.PersonID.ToString(), "COL", ExtRoomId, becomModerator, showAudioVideoTest); //RECUPERARE LA PRIMA PARTE DELL'INDIRIZZO DA CONFIGURAZIONE!!! return(oMSysParameter.BaseUrl + "?secureHash=" + URL + "&language=1&lzproxied=solo"); // URL; } return(""); }
//public void UpdateRoomRecording() //{ //} #endregion #region User management /// <summary> /// Aggiunge un utente /// </summary> /// <param name="Users">Dati utente</param> /// <param name="RoomId">IdStanza</param> public override void UsersAdd(IList <WbUser> Users, long RoomId) { WbRoom oRoom = DAL.RoomGet(RoomId); String MasterKey = oRoom.ExternalId; IList <DTO.DTOuser> EWusers = eWAPIConnector.RetrieveUsers( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, MasterKey ); //IList<String> CurrentKeys = (from DTO.DTOuser usr in EWusers select usr.Key).ToList(); //IList<String> NewKeys = (from WbUser usr in Users select usr.ExternalID).ToList(); foreach (WbUser usr in Users) { Boolean usrExistEW = false; Boolean error = false; Boolean usrExistdB = false; WbUser dBUser = DAL.UserGet(RoomId, usr.Mail); if (dBUser != null) { usrExistdB = true; } usr.RoomId = oRoom.Id; usr.ExternalRoomId = oRoom.ExternalId; String EWkey = (from DTO.DTOuser ewu in EWusers where ewu.UserId == usr.Mail select ewu.Key).FirstOrDefault(); if (String.IsNullOrEmpty(EWkey)) { usrExistEW = false; } else { usrExistEW = true; } // C'è sul dB, ma non in eWorks!!! // Cancello da dB!!! if (usrExistdB & !usrExistEW) { DAL.UserDelete(oRoom.Id, usr.Mail); usrExistdB = false; usrExistEW = false; } else if (!usrExistdB & usrExistEW) { eWAPIConnector.DeleteKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, oRoom.ExternalId, EWkey ); usrExistdB = false; usrExistEW = false; } if (!usrExistdB && !usrExistEW) { //Aggiungo l'utente. //Aggiungo l'utente su eWorks try { usr.ExternalID = eWAPIConnector.CreateKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, MasterKey, usr.Mail, usr.DisplayName ); //Reimposto i parametri dell'utente eWAPIConnector.SetUserParameter( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, usr.ExternalID, usr.IsHost, usr.IsController, usr.Audio, usr.Video, usr.Chat ); } catch (Exception Ex) { error = true; } if (String.IsNullOrEmpty(usr.ExternalID)) { error = true; } //} if (!error) { try { DAL.UserSaveOrUpdate(usr); } catch { error = true; } } if (error) { try { DAL.UserDelete(RoomId, usr.Mail); } catch { } } } } DAL.RoomUpdateUserNumber(RoomId); }
/// <summary> /// Aggiorna i dati di una stanza /// </summary> /// <param name="RoomId">ID stanza</param> /// <param name="Data">Dati stanza (generici)</param> /// <param name="Parameters">Parametri stanza (dati avanzati, basati su integrazione)</param> /// <returns>La stanza con i dati aggiornati</returns> public override WbRoom RoomUpdateData( long RoomId, Domain.DTO.DTO_GenericRoomData Data, WbRoomParameter Parameters, bool HasIdInName) { //this.eWSysParameter. if (HasIdInName) { Data.Name = string.Format("({0}) {1}", RoomId.ToString(), Data.Name); } Data.HasIdInName = HasIdInName; String ExternalId = DAL.RoomGetExternaId(RoomId); WbRoom UpdatedRoom = new WbRoom(); if (Parameters == null) { WbRoom OldRoom = this.RoomGet(RoomId); if (OldRoom.Parameter != null) { Parameters = OldRoom.Parameter; } else { UpdatedRoom = DAL.RoomUpdate(RoomId, Data); return(UpdatedRoom); } } try { eWRoomParameters param = (eWRoomParameters)Parameters; Data.Recording = param.recording; UpdatedRoom = DAL.RoomUpdate(RoomId, Data); param.meetingtitle = Data.Name; param.description = Data.Description; param.meetingstart = Data.StartDate; if (Data.Duration > 0) { param.meetingduration = Data.Duration; } else { if (Data.StartDate != null && Data.EndDate != null) { TimeSpan TS = (Data.EndDate ?? DateTime.Now) - (Data.StartDate ?? DateTime.Now); try { param.meetingduration = Convert.ToInt32(TS.TotalMinutes); } catch { param.meetingduration = 0; } } } eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, ExternalId, param, this.eWSysParameter.MaxUrlChars, false, this.eWSysParameter.Version); } catch (Exception ex) { UpdatedRoom.Parameter = null; } return(UpdatedRoom); }
/// <summary> /// Crea una stanza /// </summary> /// <returns>Id della nuova stanza</returns> public override long RoomCreate(WbRoom Room, bool SysHasIdInName) { if (Room == null || Room.Parameter == null || Room.Parameter.GetType() != typeof(oMRoomParameters)) { throw new ArgumentException("Parameter must be eWRoomParameters!"); } oMRoomParameters Param = (oMRoomParameters)Room.Parameter; if (Room.StartDate == null) { Room.StartDate = DateTime.Now; } if (Room.Type == RoomType.VideoChat) { Room.SubCommunity = SubscriptionType.None; } else if (Room.Public) { Room.SubCommunity = SubscriptionType.Free; } else { Room.SubCommunity = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubSystem = SubscriptionType.None; } else if (Room.Public) { Room.SubSystem = SubscriptionType.Free; } else { Room.SubSystem = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubExternal = SubscriptionType.None; } else if (Room.Public) { Room.SubExternal = SubscriptionType.Moderated; } else { Room.SubExternal = SubscriptionType.None; } // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); //Creazione stanza su OpenMeeting //Aggiornamento parametri Param.validFromDate = DateTime.Now; Param.validToDate = Param.validFromDate; Param.validToDate = Param.validToDate.AddYears(1); if (Room.StartDate != null) { Param.validFromDate = (DateTime)Room.StartDate; } if (Room.EndDate != null) { Param.validToDate = (DateTime)Room.EndDate; } else if (Room.Duration != null && Room.Duration > 0) { Param.validToDate = Param.validFromDate; Param.validToDate = Param.validToDate.AddMinutes(Room.Duration); } //Set RoomParameters //new type of room (1 = Conference, 2 = Audience, 3 = Restricted, 4 = Interview) //Effective: //1: interview //2: conference //Param.roomtypes_id = 2; Param.isModeratedRoom = false; Param.redirectURL = ""; //Param.appointment = false; //Param.isDemoRoom = false; //Param.demoTime = 120; //Param.reminderTypeId = 1; switch (Room.Type) { case RoomType.VideoChat: Param.numberOfPartizipants = 2; break; case RoomType.Meeting: Param.numberOfPartizipants = 5; break; case RoomType.Lesson: Param.numberOfPartizipants = 50; break; case RoomType.Conference: Param.numberOfPartizipants = 100; break; } long RoomId = -1; /* * ATTENZIONE!!! * nonostante le specifiche, il formato data/ora corretto è quello dichiarato ad inizio classe! * Altrimenti, va in eccezione con il seguente errore "unknow"!!! */ try { RoomId = RoomService.addRoomWithModerationAndExternalTypeAndStartEnd(SessionID, Room.Name, OMP_Roomtypes_id, Room.Description, Param.numberOfPartizipants, Room.Public, OMP_appointment, OMP_isDemoRoom, OMP_demoTime, Param.isModeratedRoom, Room.Type.ToString(), Param.validFromDate.ToString(DateFormat), Param.validFromDate.ToString(TimeFormat), Param.validToDate.ToString(DateFormat), Param.validToDate.ToString(TimeFormat), Param.isPasswordProtected, Param.password, OMP_reminderTypeId, Param.redirectURL ); } catch (Exception ex) { RoomId = -2; } if (RoomId > 0) { Room.ExternalId = RoomId.ToString(); this.DAL.RoomCreate(Room); //Genero anche il codice stanza alla creazione. this.RoomCodeGenerate(Room.Id); } if (SysHasIdInName) { RoomNameUpdateNameWithId(Room.Id); } return(Room.Id); }
/// <summary> /// Crea una stanza /// </summary> /// <returns>Id della nuova stanza</returns> public override Int64 RoomCreate(WbRoom Room, bool SysHasIdInName) { if (Room == null || Room.Parameter == null || Room.Parameter.GetType() != typeof(eWRoomParameters)) { throw new ArgumentException("Parameter must be eWRoomParameters!"); } eWRoomParameters Param = (eWRoomParameters)Room.Parameter; if (Room.StartDate == null) { Room.StartDate = DateTime.Now; } if (Room.Type == RoomType.VideoChat) { Room.SubCommunity = SubscriptionType.None; } else if (Room.Public) { Room.SubCommunity = SubscriptionType.Free; } else { Room.SubCommunity = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubSystem = SubscriptionType.None; } else if (Room.Public) { Room.SubSystem = SubscriptionType.Free; } else { Room.SubSystem = SubscriptionType.Moderated; } if (Room.Type == RoomType.VideoChat) { Room.SubExternal = SubscriptionType.None; } else if (Room.Public) { Room.SubExternal = SubscriptionType.Moderated; } else { Room.SubExternal = SubscriptionType.None; } Room.ExternalId = eWAPIConnector.CreateMasterKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, this.eWSysParameter.MainUserId, "Comol", Room.StartDate, Room.Name, Room.Duration); //Necessario! //Altrimenti il SET dei parametri "ARA" la data di partenza... Param.meetingstart = Room.StartDate; Param.meetingduration = Room.Duration; //allinea la descrizione "comol" con quella "eworks" Param.description = Room.Description; eWAPIConnector.SetParameters( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, Room.ExternalId, Param, 1500, true, this.eWSysParameter.Version); Room.Recording = Param.recording; this.DAL.RoomCreate(Room); //Genero anche il codice stanza alla creazione. this.RoomCodeGenerate(Room.Id); if (SysHasIdInName) { RoomNameUpdateNameWithId(Room.Id); } return(Room.Id); }