Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        /// <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("");
        }