Exemplo n.º 1
0
        /// <summary>
        /// Crea la stanza vera e propria
        /// </summary>
        /// <param name="UserAudio">Attiva audio utenti selezionati</param>
        /// <param name="UserVideo">Attiva video utenti selezionati</param>
        /// <param name="UserChat">Attiva chat utenti selezionati</param>
        /// <param name="UserAdmin">Utenti selezionati saranno amministratori</param>
        /// <param name="PersonsId">ID Person selezionate</param>
        /// <returns>ID della stanza creata</returns>
        public Int64 CreateRoom(Boolean UserAudio, Boolean UserVideo, Boolean UserChat, Boolean UserHost, Boolean UserCtrl, IList <int> PersonsId, bool HasIdInName)
        {
            if (UserContext.isAnonymous)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoUser);
                View.DisplaySessionTimeout();
                return(-1);
            }
            else
            {
                if (Module.ManageRoom || Module.AddChatRoom)
                {
                    Domain.WbRoom Room = new Domain.WbRoom();

                    Room.hasIdInName = HasIdInName;

                    Room.Name = View.GenericData.Name;

                    Room.Description   = View.GenericData.Description;
                    Room.Duration      = View.GenericData.Duration;
                    Room.EndDate       = View.GenericData.EndDate;
                    Room.MaxAllowUsers = View.GenericData.MaxAllowUsers;

                    Room.Public    = View.GenericData.Public;
                    Room.StartDate = View.GenericData.StartDate;
                    Room.Type      = View.RoomType;

                    Room.Parameter = View.Parameters;

                    Room.CommunityId = this.CurrentCommunityId;

                    Int64 NewId = Service.RoomCreate(Room, HasIdInName);

                    if (NewId > 0)
                    {
                        IList <int> CurUsrIds = new List <int>();
                        CurUsrIds.Add(base.UserContext.CurrentUserID);
                        Service.UserPersonAddIds(CurUsrIds, NewId, true, true, true, true, true);

                        if (PersonsId != null || PersonsId.Count > 0)
                        {
                            Service.UserPersonAddIds(PersonsId, NewId, UserAudio, UserVideo, UserChat, UserHost, UserCtrl);
                        }

                        this.SendUserAction(Domain.ModuleWebConferencing.ActionType.RoomAdd);
                        return(NewId);
                    }
                    else
                    {
                        this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                        View.DisplayNoPermission();
                        return(-1);
                    }
                }
            }
            return(-1);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Inizializza la View (da PageLoad)
        /// </summary>
        public void InitView()
        {
            if (UserContext.isAnonymous)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoUser);
                View.DisplaySessionTimeout();
            }
            else if (!ServerStatus())
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoServer);
                View.DisplayNoServer();
            }
            else
            {
                Domain.WbRoom oRoom = Service.RoomGet(View.RoomId);

                if (oRoom == null || oRoom.CommunityId != UserContext.CurrentCommunityID)
                {
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                    View.DisplayNoPermission();
                }
                else if (Module.ManageRoom || Module.AddChatRoom)
                {
                    Boolean LockUsers = Module.AddChatRoom && !(Module.ManageRoom);

                    //SOLO per eWorks: inizializza le Drop Down List.
                    Domain.eWorks.DTO.DTOAvailableParameters eWDefParameter = null;
                    if (View.SysParameter.CurrentSystem == Domain.wBImplementedSystem.eWorks)
                    {
                        Domain.eWorks.eWSystemParameter eWSysParam = (Domain.eWorks.eWSystemParameter)View.SysParameter;
                        eWDefParameter = Domain.eWorks.eWAPIConnector.getAvailableParameters(
                            eWSysParam.BaseUrl, eWSysParam.ProxyUrl, eWSysParam.MainUserId, eWSysParam.MainUserPwd, eWSysParam.MainUserId);
                    }

                    String code = Service.RoomCodeGet(View.RoomId);

                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.RoomEdit);
                    this.View.Init(eWDefParameter, LockUsers, code, oRoom.CommunityId, oRoom.Id);

                    resetData();
                }
                else
                {
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                    View.DisplayNoPermission();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Salva TUTTI i dati presenti nella view
        /// </summary>
        /// <param name="UpdateView">
        /// Se TRUE aggiorna i dati nella view
        /// </param>
        public void Save(Boolean UpdateView)
        {
            Domain.DTO.DTO_GenericRoomData grData = View.CurrentRoomData;

            IList <Domain.DTO.DTO_AccessType> sysAccType = (from Domain.DTO.DTO_AccessType at in View.RoomAccessTypes where at.IsSystem == true select at).ToList();

            if (sysAccType != null && sysAccType.Count > 0)
            {
                foreach (Domain.DTO.DTO_AccessType at in sysAccType)
                {
                    if (at.ID == -1)
                    {
                        grData.SubCommunity = at.SelectedType;
                    }
                    else if (at.ID == -2)
                    {
                        grData.SubSystem = at.SelectedType;
                    }
                    else if (at.ID == -3)
                    {
                        grData.SubExternal = at.SelectedType;
                    }
                }
            }

            Domain.WbRoom UpdatedRoom = Service.RoomUpdateData(
                View.RoomId,
                grData,
                View.CurrentRoomParameters,
                View.SYS_HasIdInName
                );

            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.RoomUpdate);

            if (UpdateView)
            {
                resetData();
            }
        }
        public List <Core.Notification.Domain.dtoModuleNotificationMessage> GetNotificationMessages(Core.Notification.Domain.NotificationAction action, Core.Notification.Domain.NotificationChannel channel, Core.Notification.Domain.NotificationMode mode, int idSenderUser, lm.Comol.Core.Notification.Domain.WebSiteSettings webSiteSettings)
        {
            List <Core.Notification.Domain.dtoModuleNotificationMessage> messages = null;

            Domain.WbRoom room = RoomGet(action.IdObject);
            if (room != null)
            {
                List <Domain.WbUser> users = action.IdModuleUsers.Select(i => UserGet(i)).ToList().Where(u => u != null && u.Id > 0).ToList();

                // INDIVIDUO TUTTE LE POSSIBILI LINGUE DEGLI UTENTI DESTINATARI
                List <String> languageCodes = (users != null) ? users.Select(u => u.LanguageCode).Distinct().ToList() : null;

                Dictionary <String, lm.Comol.Core.Notification.Domain.dtoNotificationMessage> templates = GetTemplates(action.IdModuleAction, channel, mode, languageCodes);
                if (languageCodes.Any())
                {
                    webSiteSettings.GenerateDateTimeFormat(languageCodes);
                }
                if (templates.Any())
                {
                    messages = GetMessages(action.IdModuleAction, action.IdCommunity, room, users, templates, webSiteSettings);
                }
            }
            return(messages);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Invia invito/credenziali
        /// </summary>
        /// <param name="UserId">ID utente stanza</param>
        /// <param name="IsLock">
        /// TRUE = Blocco utente
        /// FALSE = SBLOCCO utente
        /// </param>
        /// <returns>
        /// True = mail inviata
        /// False = errore template
        /// </returns>
        /// <remarks>
        /// La mail verrà SEMPRE inviata ad utenti esterni che attendono conferma da parte dell'amministratore.
        /// </remarks>
        public Boolean SendLockUnlockUser(Int64 UserId, Boolean IsLock)
        {
            Domain.WbUser usr  = Service.UserGet(UserId);
            Domain.WbRoom room = Service.RoomGet(View.RoomId);

            //Aggiungere gestione errore
            if (usr == null || room == null)
            {
                return(true);
            }

            //int LangId = 2; // ->

            Int64 Action = (Int64)WCMod.MailSenderActionType.UnLockUser;

            if (IsLock)
            {
                Action = (Int64)WCMod.MailSenderActionType.LockUser;
            }

            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    usr.LanguageCode,
                    WCMod.UniqueCode,
                    Action);

            if (msg == null)
            {
                return(false);
            }

            //String BaseUrl = "";
            //String DateTimeFormat = "";
            //String VoidDatetime = "";
            //String PortalName = ""; //  SystemSetting.InstanceName

            Domain.DTO.DTO_MailTagSettings mts = View.GetMailTagSetting(); // 2 = Language ID!

            msg.Translation = Service.GetTemplateContentPreview(
                true,
                View.RoomId,
                UserId,
                mts.Baseurl,
                mts.WebSiteUrlNoSsl,
                msg.Translation,
                mts.DateTimeFormat,
                mts.VoidDateTime,
                mts.PortalName
                );


            bool sentMail = ServiceTemplate.SendMail(
                this.Service.CurrentUser,
                mts.SmtpConfig,
                msg.MailSettings,
                msg.Translation.Subject,
                msg.Translation.Body,
                usr.Mail);

            if (sentMail == false)
            {
                View.DisplayMailNotSended();
            }

            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Invia credenziali all'utente indicato.
        /// SE non possiede già una chiave, questa viene generata.
        /// </summary>
        /// <param name="UserId"></param>
        public void SendUserKey(Int64 UserId) //, Int64 TemplateId)
        {
            Domain.WbUser usr  = Service.UserGet(UserId);
            Domain.WbRoom room = Service.RoomGet(View.RoomId);

            //if (room.TemplateId != TemplateId)
            //{
            //    Service.RoomUpdateTemplate(View.RoomId, TemplateId);
            //    room.TemplateId = TemplateId;
            //}

            //Aggiungere gestione errore
            if (usr == null || room == null)
            {
                return;
            }

            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    usr.LanguageCode,
                    WCMod.UniqueCode,
                    (Int64)WCMod.MailSenderActionType.Credential);

            if (msg == null)
            {
                View.DisplayMailNotSended();
            }
            else
            {
                //String BaseUrl = "";
                //String DateTimeFormat = "";
                //String VoidDatetime = "";
                //String PortalName = ""; //  SystemSetting.InstanceName

                Domain.DTO.DTO_MailTagSettings mts = View.GetMailTagSetting(); // 2 = Language ID!

                msg.Translation = Service.GetTemplateContentPreview(
                    true,
                    View.RoomId,
                    UserId,
                    mts.Baseurl,
                    mts.WebSiteUrlNoSsl,
                    msg.Translation,
                    mts.DateTimeFormat,
                    mts.VoidDateTime,
                    mts.PortalName
                    );


                bool sentMail = ServiceTemplate.SendMail(
                    this.Service.CurrentUser,
                    mts.SmtpConfig,
                    msg.MailSettings,
                    msg.Translation.Subject,
                    msg.Translation.Body,
                    usr.Mail);


                if (sentMail == false)
                {
                    View.DisplayMailNotSended();
                }
            }

            //            person,				//Chi manda (admin)
            //smtp,				// da view (vedere)
            //message.MailSettings,
            //message.Translation.Subject,
            //message.Translation.Body,
            //"*****@*****.**")	//Mail destinatario (o mail, separate da ';'  )sentMail = service.SendMail(
            //person,				//Chi manda (admin)
            //smtp,				// da view (vedere)
            //message.MailSettings,
            //message.Translation.Subject,
            //message.Translation.Body,
            //"*****@*****.**")	//Mail destinatario (o mail, separate da ';'  )

            //public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation GetTemplateContentPreview(
        }
Exemplo n.º 7
0
        /// <summary>
        /// Reimposta i dati dall'ultimo salvataggio
        /// </summary>
        private void resetData()
        {
            Domain.WbRoom Room = Service.RoomGet(View.RoomId);

            if (Room != null)
            {
                Domain.DTO.DTO_GenericRoomData Data = new Domain.DTO.DTO_GenericRoomData()
                {
                    Id                     = Room.Id,
                    HasIdInName            = Room.hasIdInName,
                    Description            = Room.Description,
                    Duration               = Room.Duration,
                    EndDate                = Room.EndDate,
                    StartDate              = Room.StartDate,
                    Public                 = Room.Public,
                    Name                   = Room.Name,
                    MaxAllowUsers          = Room.MaxAllowUsers,
                    NotificationEnableUsr  = Room.NotificationEnableUsr,
                    NotificationDisableUsr = Room.NotificationDisableUsr
                };


                //TemplateId = Room.TemplateId



                String code = Service.RoomCodeGet(this.View.RoomId);


                int PageCount = 0;

                int currentPageIndex = this.View.UserPager.PageIndex;
                int currentPageSize  = this.View.UserPager.PageSize;

                IList <Domain.WbUser> Users = Service.UsersGet(this.View.RoomId, this.View.UserFilters, currentPageIndex, currentPageSize, ref PageCount);

                PagerBase pager = new PagerBase();
                pager.PageSize = currentPageSize;//Me.View.CurrentPageSize
                pager.Count    = PageCount;
                if (currentPageIndex > PageCount)
                {
                    currentPageIndex = PageCount;
                }

                pager.PageIndex = currentPageIndex;// Me.View.CurrentPageIndex
                View.UserPager  = pager;


                Boolean LockUsers = Module.AddChatRoom && !(Module.ManageRoom);

                this.View.SetParameter(Room.Id, Room.CreatedBy.Id, Data, Room.Parameter, Room.Type, Users, LockUsers, code); //, LockUsers
                View.RoomType = Room.Type;

                List <Domain.DTO.DTO_AccessType> AccessType = new List <Domain.DTO.DTO_AccessType>();

                Domain.DTO.DTO_AccessType Community = new Domain.DTO.DTO_AccessType();
                Community.ID           = -1;
                Community.IsSystem     = true;
                Community.DisplayName  = Domain.SysSubscriptionType.Community.ToString();
                Community.SelectedType = Room.SubCommunity;
                AccessType.Add(Community);

                Domain.DTO.DTO_AccessType System = new Domain.DTO.DTO_AccessType();
                System.ID           = -2;
                System.IsSystem     = true;
                System.DisplayName  = Domain.SysSubscriptionType.System.ToString();
                System.SelectedType = Room.SubSystem;
                AccessType.Add(System);

                Domain.DTO.DTO_AccessType External = new Domain.DTO.DTO_AccessType();
                External.ID           = -3;
                External.IsSystem     = true;
                External.DisplayName  = Domain.SysSubscriptionType.External.ToString();
                External.SelectedType = Room.SubExternal;
                AccessType.Add(External);

                View.RoomAccessTypes = AccessType;
            }
        }
        public List <lm.Comol.Core.Notification.Domain.GroupMessages> GetDefaultNotificationMessages(Core.Notification.Domain.NotificationAction action, int idSenderUser, lm.Comol.Core.Notification.Domain.WebSiteSettings webSiteSettings)
        {
            List <lm.Comol.Core.Notification.Domain.GroupMessages> messages = null;

            Domain.WbRoom room = RoomGet(action.IdObject);
            if (room != null)
            {
                List <Domain.WbUser> users = action.IdModuleUsers.Select(i => UserGet(i)).ToList().Where(u => u != null && u.Id > 0).ToList();

                // INDIVIDUO TUTTE LE POSSIBILI LINGUE DEGLI UTENTI DESTINATARI
                List <String> languageCodes = (users != null) ? users.Select(u => u.LanguageCode).Distinct().ToList() : null;

                Dictionary <String, lm.Comol.Core.Notification.Domain.dtoNotificationMessage> templates = GetTemplates(action.IdModuleAction, Core.Notification.Domain.NotificationChannel.Mail, Core.Notification.Domain.NotificationMode.Automatic, languageCodes);
                if (languageCodes.Any())
                {
                    webSiteSettings.GenerateDateTimeFormat(languageCodes);
                }
                if (templates.Any())
                {
                    lm.Comol.Core.DomainModel.ModuleObject owner = lm.Comol.Core.DomainModel.ModuleObject.CreateLongObject(room.Id, room, (int)WebConferencing.Domain.ModuleWebConferencing.ObjectType.Room, room.CommunityId, WebConferencing.Domain.ModuleWebConferencing.UniqueCode, Manager.GetModuleID(WebConferencing.Domain.ModuleWebConferencing.UniqueCode));
                    switch (action.IdModuleAction)
                    {
                    case (long)ModuleWebConferencing.MailSenderActionType.Credential:
                    case (long)ModuleWebConferencing.MailSenderActionType.LockUser:
                    case (long)ModuleWebConferencing.MailSenderActionType.UnLockUser:
                    case (long)ModuleWebConferencing.MailSenderActionType.GenericInvitation:
                        messages = new List <lm.Comol.Core.Notification.Domain.GroupMessages>();

                        // Recupero tutti i possibili messaggi con relative traduzioni
                        List <lm.Comol.Core.Notification.Domain.dtoModuleNotificationMessage> tMessages = GetMessages(action.IdModuleAction, action.IdCommunity, room, users, templates, webSiteSettings);
                        // VERIFICO che sia tutto conforme sia in termini di template, che di id versione NEL caso in cui mi serva
                        // in un servizio che mi da diversi template per diversi canali.
                        var groups = (from m in tMessages group m by new { m.IdTemplate, m.IdVersion, m.Channel } into grp select grp.First());

                        foreach (var item in groups)
                        {
                            lm.Comol.Core.Notification.Domain.GroupMessages mGroup = new Core.Notification.Domain.GroupMessages();

                            mGroup.IdCommunity               = action.IdCommunity;
                            mGroup.ObjectOwner               = owner;
                            mGroup.Settings.Save             = false;
                            mGroup.Settings.UniqueIdentifier = Guid.NewGuid();
                            mGroup.Channel       = item.Channel;
                            mGroup.Settings.Mail = item.MailSettings;
                            mGroup.Settings.Template.IdTemplate = item.IdTemplate;
                            mGroup.Settings.Template.IdVersion  = item.IdVersion;
                            // IN QUESTO CASO SI, perchè recupero direttamente da DB i ltemplate, NON sto inviando un messaggio
                            // da interfaccia web, partendo da un template, ma poi ho modificato il testo predisposto nella UI prima di inviare il messaggio
                            mGroup.Settings.Template.IsCompliant = true;
                            mGroup.Messages = tMessages.Where(t => t.IdTemplate == item.IdTemplate && t.IdVersion == item.IdVersion && t.Channel == item.Channel).Select(t =>
                                                                                                                                                                         new lm.Comol.Core.Notification.Domain.dtoModuleTranslatedMessage()
                            {
                                Recipients  = t.Recipients,
                                Translation = t.Translation
                            }).ToList();
                            messages.Add(mGroup);
                        }
                        break;
                    }
                }
            }
            return(messages);
        }
        private List <Core.Notification.Domain.dtoModuleNotificationMessage> GetMessages(long idAction, Int32 idCommunity, Domain.WbRoom room, List <Domain.WbUser> users, Dictionary <String, lm.Comol.Core.Notification.Domain.dtoNotificationMessage> templates, lm.Comol.Core.Notification.Domain.WebSiteSettings webSiteSettings)
        {
            List <Core.Notification.Domain.dtoModuleNotificationMessage> messages = null;

            if (templates.Any())
            {
                messages = new List <Core.Notification.Domain.dtoModuleNotificationMessage>();
                lm.Comol.Core.DomainModel.ModuleObject owner = lm.Comol.Core.DomainModel.ModuleObject.CreateLongObject(room.Id, room, (int)WebConferencing.Domain.ModuleWebConferencing.ObjectType.Room, room.CommunityId, WebConferencing.Domain.ModuleWebConferencing.UniqueCode, Manager.GetModuleID(WebConferencing.Domain.ModuleWebConferencing.UniqueCode));
                switch (idAction)
                {
                case (long)ModuleWebConferencing.MailSenderActionType.Credential:
                case (long)ModuleWebConferencing.MailSenderActionType.LockUser:
                case (long)ModuleWebConferencing.MailSenderActionType.UnLockUser:
                case (long)ModuleWebConferencing.MailSenderActionType.GenericInvitation:
                    messages = new List <Core.Notification.Domain.dtoModuleNotificationMessage>();
                    foreach (Domain.WbUser user in users)
                    {
                        lm.Comol.Core.Notification.Domain.dtoNotificationMessage template = templates[user.LanguageCode];
                        if (template != null)
                        {
                            lm.Comol.Core.Notification.Domain.dtoModuleNotificationMessage userMessage = new Core.Notification.Domain.dtoModuleNotificationMessage();
                            userMessage.Recipients.Add(new Core.MailCommons.Domain.Messages.Recipient()
                            {
                                Address = user.Mail, DisplayName = user.DisplayName, IdUserModule = user.Id, IdPerson = user.PersonID, IdModuleObject = room.Id, IdCommunity = room.CommunityId, IdModuleType = (int)WebConferencing.Domain.ModuleWebConferencing.ObjectType.Room, Status = Core.MailCommons.Domain.RecipientStatus.Available, LanguageCode = user.LanguageCode
                            });
                            userMessage.Channel      = template.Channel;
                            userMessage.MailSettings = template.MailSettings;
                            userMessage.ObjectOwner  = owner;
                            userMessage.Save         = false;
                            userMessage.IdTemplate   = template.IdTemplate;
                            userMessage.IdVersion    = template.IdVersion;
                            userMessage.IdCommunity  = idCommunity;

                            userMessage.LanguageCode = user.LanguageCode;
                            userMessage.Translation  = GetTemplateContentPreview(
                                true, room.Id, user.Id, webSiteSettings.Baseurl, webSiteSettings.WebSiteUrlNoSsl, template.Translation,
                                webSiteSettings.GetDateTimeFormat(user.LanguageCode), webSiteSettings.GetVoidDateTime(user.LanguageCode), webSiteSettings.GetPortalName(user.LanguageCode));
                            messages.Add(userMessage);
                        }
                    }
                    break;
                }
            }
            return(messages);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Inizializza la pagina.
        /// Se l'utente viene riconosciuto e può accedere, accede direttamente!
        /// </summary>
        public void Init()
        {
            if (!ServerStatus())
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoServer);
                View.ShowError(Domain.ErrorExtAccess.NoServer);
                View.BindSkin(Service.ServiceModuleID(), 0, 0);
                View.Show(true, false, false, false, true);
                return;
            }

            Domain.WbAccessCode Code = null;

            if (!string.IsNullOrEmpty(View.UrlCode))
            {
                Code = this.Service.RoomCodeDataGet(View.UrlCode);
            }
            else if (View.RoomId > 0)
            {
                Code = new Domain.WbAccessCode()
                {
                    RoomId = View.RoomId, UrlCode = ""
                };
            }
            else
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.BindSkin(Service.ServiceModuleID(), 0, 0);
                View.ShowError(Domain.ErrorExtAccess.UnknowRoom);
                View.Show(false, false, false, false, true);
                return;
            }

            if (Code == null || Code.RoomId <= 0)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.BindSkin(Service.ServiceModuleID(), 0, 0);
                View.ShowError(Domain.ErrorExtAccess.UnknowRoom);
                View.Show(true, false, false, false, true);
                return;
            }

            Domain.WbRoom oRoom = this.Service.RoomGet(Code.RoomId);
            if (oRoom == null)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.BindSkin(Service.ServiceModuleID(), 0, 0);
                View.ShowError(Domain.ErrorExtAccess.UnknowRoom);
                View.Show(true, false, false, false, true);
                return;
            }

            View.Room = oRoom;
            int OrgnId = 0;

            View.BindSkin(Service.ServiceModuleID(), oRoom.CommunityId, OrgnId);

            //UTENTE INTERNO
            if (UserContext != null && UserContext.CurrentUserID > 0)
            {
                //Iscritto alla stanza
                Domain.WbUser CurWBUser = Service.GetUserFromSystem(Code.RoomId, UserContext.CurrentUserID);

                if (CurWBUser == null)
                {
                    // UTENTE LOGGATO, NON ISCRITTO ALLA CONFERENZE:

                    if (Service.UserPersonIsInCommunity(Code.RoomId, UserContext.CurrentUserID))
                    {
                        // UTENTE iscritto alla comunità
                        switch (oRoom.SubCommunity)
                        {
                        case Domain.SubscriptionType.Free:
                            if (!this.Service.UserPersonAdd(UserContext.CurrentUserID, oRoom.Id, true))
                            {
                                View.ShowError(Domain.ErrorExtAccess.InternalSubScriptionError);
                                return;
                            }
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UserSubscribeSelfInternal);
                            break;

                        case Domain.SubscriptionType.Moderated:
                            if (!this.Service.UserPersonAdd(UserContext.CurrentUserID, oRoom.Id, false))
                            {
                                View.ShowError(Domain.ErrorExtAccess.InternalSubScriptionError);
                                return;
                            }
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                            View.ShowError(Domain.ErrorExtAccess.AdminConfirmRequired);
                            View.Show(true, false, false, false, true);
                            return;

                        case Domain.SubscriptionType.None:
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                            View.ShowError(Domain.ErrorExtAccess.NoPermission);
                            View.Show(true, false, false, false, true);
                            return;
                        }
                    }
                    else
                    {
                        // UTENTE NON iscritto alla comunità
                        switch (oRoom.SubSystem)
                        {
                        case Domain.SubscriptionType.Free:
                            if (!this.Service.UserPersonAdd(UserContext.CurrentUserID, oRoom.Id, true))
                            {
                                View.ShowError(Domain.ErrorExtAccess.InternalSubScriptionError);
                                return;
                            }
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UserSubscribeSelfInternal);
                            break;

                        case Domain.SubscriptionType.Moderated:
                            if (!this.Service.UserPersonAdd(UserContext.CurrentUserID, oRoom.Id, false))
                            {
                                View.ShowError(Domain.ErrorExtAccess.InternalSubScriptionError);
                                View.Show(true, false, false, false, true);
                                return;
                            }
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                            View.ShowError(Domain.ErrorExtAccess.AdminConfirmRequired);
                            View.Show(true, false, false, false, true);
                            return;

                        case Domain.SubscriptionType.None:
                            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                            View.ShowError(Domain.ErrorExtAccess.NoPermission);
                            View.Show(true, false, false, false, true);
                            return;
                        }
                    }

                    // Ora, se arriva QUI l'utente è iscritto alla stanza e lo recupero.
                    CurWBUser = Service.GetUserFromSystem(Code.RoomId, UserContext.CurrentUserID);
                }

                // QUI ho l'utente, iscritto alla stanza. Mostro la stanza ed esco dalla funzione.
                if (CurWBUser == null)
                {
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                    View.ShowError(Domain.ErrorExtAccess.NoPermission);
                    View.Show(true, false, false, false, true);
                    return;
                }

                if (CurWBUser.Enabled == true)
                {
                    String Url = this.Service.AccessUrlExternalGet(Code.RoomId, CurWBUser.Id);
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.RoomAccess);
                    this.View.ShowConference(Url);
                    View.Show(true, false, false, true, false);
                    return;
                }
                else
                {
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                    View.ShowError(Domain.ErrorExtAccess.AdminConfirmRequired);
                    View.Show(true, false, false, false, true);
                    return;
                }
            }
            else // Utente esterno o sconosciuto
            {
                // Mostro l'accesso (per utenti iscritti, interni o esterni)
                View.ShowAccess();

                Boolean ShowSubscription = true;
                if (oRoom.SubExternal == Domain.SubscriptionType.None)
                {
                    //this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoPermission);
                    ShowSubscription = false;
                }

                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UserSubscribeLogin);
                View.Show(true, true, ShowSubscription, false, false);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Accede alla stanza
        /// </summary>
        /// <param name="Key">Chiave accesso alla stanza</param>
        public void EnterRoom()
        {
            Domain.WbAccessCode wbCode = Service.RoomCodeDataGet(View.UrlCode);//WbDal.GetCode(View.UrlCode);

            if (wbCode == null)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.ShowError(Domain.ErrorExtAccess.UnknowRoom);
                View.Show(true, true, false, false, true);
                return;
            }

            Domain.WbRoom wbRoom = Service.RoomGet(wbCode.RoomId);//WbDal.GetRoom(wbCode.RoomId);

            if (wbRoom == null)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.ShowError(Domain.ErrorExtAccess.UnknowRoom);
                View.Show(true, true, false, false, true);
                return;
            }


            //  NOOOOOO - ISCRIZIONE UTENTE!!!
            Domain.WbUser User = Service.GetUserFromMail(wbCode.RoomId, View.Mail);

            if (User == null)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.ShowError(Domain.ErrorExtAccess.NoPermission);
                return;
                //int PersonId = -1;
                //Domain.UserCheck CheckUser = Service.CheckUser(View.Mail, wbCode.RoomId, ref PersonId);
                //if(CheckUser == Domain.UserCheck.UserInCommunity)
                //{
                //    //Utente iscritto alla comunità
                //    switch(wbRoom.SubCommunity)
                //    {
                //        case Domain.SubscriptionType.Moderated:
                //            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                //            Service.PersonAdd(PersonId, wbRoom.Id, false);
                //            break;
                //        case Domain.SubscriptionType.Free:
                //            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                //            Service.PersonAdd(PersonId, wbRoom.Id, true);
                //            break;
                //        case Domain.SubscriptionType.None:
                //            View.ShowError("NOT ALLOW");
                //            return;
                //    }
                //}
                //else if (CheckUser == Domain.UserCheck.UserInSystem)
                //{
                //    //Utente iscritto al sistema
                //    switch (wbRoom.SubSystem)
                //    {
                //        case Domain.SubscriptionType.Moderated:
                //            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                //            Service.PersonAdd(PersonId, wbRoom.Id, false);
                //            break;
                //        case Domain.SubscriptionType.Free:
                //            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UsersAddInternal);
                //            Service.PersonAdd(PersonId, wbRoom.Id, true);
                //            break;
                //        case Domain.SubscriptionType.None:
                //            View.ShowError("NOT ALLOW");
                //            return;
                //    }
                //}
                //else
                //{
                //    //UTENTE ESTERNO!!
                //    if (!User.MailChecked && String.IsNullOrEmpty(User.ExternalID))
                //    {
                //        switch (wbRoom.SubExternal)
                //        {
                //            case Domain.SubscriptionType.Free:
                //                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UserSubscribeSelfExternal);
                //                Service.ValidateExternalUser(User.Id);
                //                break;
                //            case Domain.SubscriptionType.Moderated:
                //                View.ShowError("NeedAdminconfirmation");
                //                return;
                //            case Domain.SubscriptionType.None:
                //                View.ShowError("NOT ALLOW!");
                //                return;
                //        }
                //    }
                //}
            }
            else if (User.UserKey != View.Key)
            {
                this.SendUserAction(Domain.ModuleWebConferencing.ActionType.NoRoom);
                View.ShowError(Domain.ErrorExtAccess.WrongUserKey);
                return;
            }

            if (User.MailChecked == false)
            {
                Service.UserEnable(User.Id, wbRoom.Id);
            }

            String Url = this.Service.AccessUrlExternalGet(wbRoom.Id, User.Id);

            this.SendUserAction(Domain.ModuleWebConferencing.ActionType.RoomAccess);
            this.View.ShowConference(Url);
        }