Пример #1
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(
        }
Пример #2
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);
        }
Пример #3
0
        /// <summary>
        /// Iscrive l'utente agli utenti in lista.
        /// A seconda delle ipostazioni della stanza, l'utente potrà:
        /// - Essere già attivato e ricevere una mail con il codice
        /// - Essere iscritto come disattivatto/In attesa di attivazione. La mail verrà inviata dall'amministratore
        /// </summary>
        /// <param name="UserName">Nome utente</param>
        /// <param name="UserSecondName">cognome utente</param>
        /// <param name="Mail">Indirizzo eMail</param>
        /// <param name="LangCode">Codice lingua</param>
        public void SubscribeUser(String name, String secondName, String mail, String languageCode)
        {
            //Codice stanza
            Domain.WbAccessCode Code = this.Service.RoomCodeDataGet(View.UrlCode);

            //Stato iscrizione
            Domain.ExtSubscriptionStatus Status = Domain.ExtSubscriptionStatus.NoPermission;

            //Controllo mail
            Domain.MailCheck MailCK = Service.UserMailCheck(mail, Code.RoomId);

            //In base al controllo mail:
            switch (MailCK)
            {
            case Domain.MailCheck.MailUnknow:
                Domain.WbUser user = this.Service.UserSubscribeNewExternal(View.UrlCode, name, secondName, mail, languageCode, ref Status);
                //INVIO KEY VIA MAIL E/O CONTROLLO SU BLOCCO ISCRIZIONI!
                if (user != null)
                {
                    //Invio Mail
                    Int32 idLanguage = ServiceTemplate.GetIdLanguage(languageCode);
                    lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg = null;
                    if (idLanguage > 0)
                    {
                        msg = ServiceTemplate.GetNotificationMessage(idLanguage, WCMod.UniqueCode, (Int64)WCMod.MailSenderActionType.Credential);
                    }
                    else
                    {
                        msg = ServiceTemplate.GetNotificationMessage(user.LanguageCode, WCMod.UniqueCode, (Int64)WCMod.MailSenderActionType.Credential);
                    }
                    if (msg == null)
                    {
                        View.ShowError(Domain.ErrorExtAccess.NoTemplate);
                        View.Show(true, true, false, false, true);
                        return;
                    }


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

                    msg.Translation = Service.GetTemplateContentPreview(
                        true,
                        Code.RoomId,
                        user.Id,
                        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,
                        user.Mail);


                    if (sentMail == false)
                    {
                        View.ShowError(Domain.ErrorExtAccess.MailSenderError);
                        View.Show(true, true, true, false, true);
                    }

                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.UserSubscribeSelfExternal);
                }
                else
                {
                    this.SendUserAction(Domain.ModuleWebConferencing.ActionType.GenericError);
                }
                break;

            case Domain.MailCheck.MailInRoom:
                Status = Domain.ExtSubscriptionStatus.MailInRoom;
                break;

            case Domain.MailCheck.MailInRoomdB:
                Status = Domain.ExtSubscriptionStatus.MailInRoom;
                break;

            case Domain.MailCheck.MailInSystem:
                Status = Domain.ExtSubscriptionStatus.MailInSystem;
                break;

            case Domain.MailCheck.ParameterError:
                Status = Domain.ExtSubscriptionStatus.ParametersError;
                break;
            }

            View.ShowSubStatus(Status);
        }