コード例 #1
0
        /// <summary>
        /// INVIA MAIL
        /// Intanto così, poi si aggiungerà quello che serve, ma almeno centralizzo l'invio (almeno per quel che mi serve ora...)
        /// </summary>
        /// <param name="Content">TEsto mail</param>
        /// <param name="Address">Indirizzo</param>
        /// <param name="OtherParameters">Gli altri parametri che serviranno per l'invio</param>
        /// <returns>
        /// True: mail inviata
        /// False: errori invio...
        /// </returns>
        private bool NotificationSendMail(
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage Message,
            String Address)
        {
            if (Data == null)
            {
                Message.Translation.Body    = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Body);
                Message.Translation.Subject = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Subject);
            }
            else
            {
                Message.Translation.Body    = Data.AnalyzeContent(Message.Translation.Body, Settings);
                Message.Translation.Subject = Data.AnalyzeContent(Message.Translation.Subject, Settings);
            }

            bool sentMail = ServiceTemplate.SendMail(
                this.CurrentPerson,
                Settings.SmtpConfig,
                Message.MailSettings,
                Message.Translation.Subject,
                Message.Translation.Body,
                Address);

            return(sentMail);
        }
コード例 #2
0
        /// <summary>
        /// Invio mail con password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendRecover(
            Domain.TicketUser User,
            Domain.DTO.DTO_NotificationSettings Settings,
            String NewPassword)
        {
            //Testo esempio:

            /* Le sue credenziali per l'accesso al servizio ticket sono le seguenti:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Indirizzo per l'accesso: [PlaceHoldersType.UserTokenUrl]
             */

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Settings.LangCode = User.LanguageCode;

            // = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = NewPassword,
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRecover);

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

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }
コード例 #3
0
        /// <summary>
        /// Invio mail per reset password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendPasswordChanged(Domain.TicketUser User, Domain.DTO.DTO_NotificationSettings Settings)
        {
            ////Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = "",
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalPasswordChanged);

            if (msg != null)
            {
                return(NotificationSendMail(Settings, Data, msg, Mail));
            }


            return(true);

            // Invio Mail.
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        /// <summary>
        /// Invio notifiche automatiche
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <param name="OtherParameters">Altri parametri da definire...</param>
        /// <returns></returns>
        /// <remarks>
        /// ATTENZIONE! Sarà necessario creare funzioni "ad hoc" con relativi parametri necessari.
        /// </remarks>
        public bool NotificationSend(
            ModuleTicket.MailSenderActionType ActionType,
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            String Address)
        {
            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

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

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Address));
        }
コード例 #6
0
        /// <summary>
        /// Invio Token/URL per la validazione dell'utente
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendToken(TicketUser User, Domain.DTO.DTO_NotificationSettings Settings, Token Token, String Password)
        {
            //Testo esempio:

            /* Gentile [PlaceHoldersType.UserSureName] [PlaceHoldersType.UserName]
             * Il suo account è stato registrato nel sistema.
             *
             * Dati Account:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Lingua: [PlaceHoldersType.UserLanguageCode]
             *
             * Per attivarlo è necessario accedere con le proprie credenziali al seguente indirizzo:
             * [PlaceHoldersType.UserTokenUrl]
             *
             * Oppure dalla pagine di accesso, al primo tentativo verrà richiesto il seguente codice di convalida:
             * [PlaceHoldersType.UserToken]
             *
             * La conferma dell'account può essere effettuata entro il: [PlaceHoldersType.UserTokenExpiration]
             */


            //To Do!!!
            //Domain.Enums.Notification NotificationType = Domain.Enums.Notification.ExternalRegistration;

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null, IntTicketStatus= null,
            //    SmtpConfig = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? false : true;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = Password,
                Token        = new Domain.DTO.Notification.DTO_User.DTO_Token
                {
                    Code     = Token.Code.ToString(),
                    Creation = Token.CreatedOn
                }
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

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

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }
コード例 #7
0
ファイル: WbEditPresenter.cs プロジェクト: EdutechSRL/Adevico
        /// <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);
        }
コード例 #8
0
ファイル: WbEditPresenter.cs プロジェクト: EdutechSRL/Adevico
        /// <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(
        }
コード例 #9
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);
        }