Exemplo n.º 1
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            var mergeObjects = new Dictionary <string, object>();

            mergeObjects.Add("ConfirmAccountUrl", RootPath + "ConfirmAccount");

            var personDictionaries = new List <IDictionary <string, object> >();

            PersonService personService = new PersonService();
            UserService   userService   = new UserService();

            foreach (Person person in personService.GetByEmail(tbEmail.Text))
            {
                var users = new List <IDictionary <string, object> >();
                foreach (UserLogin user in userService.GetByPersonId(person.Id))
                {
                    if (user.ServiceType == AuthenticationServiceType.Internal)
                    {
                        var userDictionary = new UserLoginDto(user).ToDictionary();
                        userDictionary.Add("ConfirmationCodeEncoded", user.ConfirmationCodeEncoded);
                        users.Add(userDictionary);
                    }
                }

                if (users.Count > 0)
                {
                    IDictionary <string, object> personDictionary = new PersonDto(person).ToDictionary();
                    personDictionary.Add("FirstName", person.FirstName);
                    personDictionary.Add("Users", users.ToArray());
                    personDictionaries.Add(personDictionary);
                }
            }

            if (personDictionaries.Count > 0)
            {
                mergeObjects.Add("Persons", personDictionaries.ToArray());

                var recipients = new Dictionary <string, Dictionary <string, object> >();
                recipients.Add(tbEmail.Text, mergeObjects);

                Email email = new Email(Rock.SystemGuid.EmailTemplate.SECURITY_FORGOT_USERNAME);
                email.Send(recipients);

                pnlEntry.Visible   = false;
                pnlSuccess.Visible = true;
            }
            else
            {
                pnlWarning.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void DisplaySentLogin(Direction direction)
        {
            using (new Rock.Data.UnitOfWorkScope())
            {
                PersonService personService = new PersonService();
                Person        person        = personService.Get(Int32.Parse(hfSendPersonId.Value));
                if (person != null)
                {
                    var mergeObjects = new Dictionary <string, object>();
                    mergeObjects.Add("ConfirmAccountUrl", RootPath + "ConfirmAccount");

                    var personDictionaries = new List <IDictionary <string, object> >();

                    var         users       = new List <IDictionary <string, object> >();
                    UserService userService = new UserService();
                    foreach (UserLogin user in userService.GetByPersonId(person.Id))
                    {
                        if (user.ServiceType == AuthenticationServiceType.Internal)
                        {
                            var userDictionary = new UserLoginDto(user).ToDictionary();
                            userDictionary.Add("ConfirmationCodeEncoded", user.ConfirmationCodeEncoded);
                            users.Add(userDictionary);
                        }
                    }

                    if (users.Count > 0)
                    {
                        IDictionary <string, object> personDictionary = new PersonDto(person).ToDictionary();
                        personDictionary.Add("FirstName", person.FirstName);
                        personDictionary.Add("Users", users.ToArray());
                        personDictionaries.Add(personDictionary);
                    }

                    mergeObjects.Add("Persons", personDictionaries.ToArray());

                    var recipients = new Dictionary <string, Dictionary <string, object> >();
                    recipients.Add(person.Email, mergeObjects);

                    Email email = new Email(Rock.SystemGuid.EmailTemplate.SECURITY_FORGOT_USERNAME);
                    email.Send(recipients);
                }
                else
                {
                    ShowErrorMessage("Invalid Person");
                }
            }

            ShowPanel(3);
        }
Exemplo n.º 3
0
        private void DisplaySentLogin( Direction direction )
        {
            using ( new Rock.Data.UnitOfWorkScope() )
            {
                PersonService personService = new PersonService();
                Person person = personService.Get( Int32.Parse( hfSendPersonId.Value ) );
                if ( person != null )
                {
                    var mergeObjects = new Dictionary<string, object>();
                    mergeObjects.Add( "ConfirmAccountUrl", RootPath + "ConfirmAccount" );

                    var personDictionaries = new List<IDictionary<string, object>>();

                    var users = new List<IDictionary<string, object>>();
                    UserService userService = new UserService();
                    foreach ( UserLogin user in userService.GetByPersonId( person.Id ) )
                    {
                        if ( user.ServiceType == AuthenticationServiceType.Internal )
                        {
                            var userDictionary = new UserLoginDto( user ).ToDictionary();
                            userDictionary.Add( "ConfirmationCodeEncoded", user.ConfirmationCodeEncoded );
                            users.Add( userDictionary );
                        }
                    }

                    if ( users.Count > 0 )
                    {
                        IDictionary<string, object> personDictionary = new PersonDto( person ).ToDictionary();
                        personDictionary.Add( "FirstName", person.FirstName );
                        personDictionary.Add( "Users", users.ToArray() );
                        personDictionaries.Add( personDictionary );
                    }

                    mergeObjects.Add( "Persons", personDictionaries.ToArray() );

                    var recipients = new Dictionary<string, Dictionary<string, object>>();
                    recipients.Add( person.Email, mergeObjects );

                    Email email = new Email( Rock.SystemGuid.EmailTemplate.SECURITY_FORGOT_USERNAME );
                    email.Send( recipients );
                }
                else
                    ShowErrorMessage( "Invalid Person" );
            }

            ShowPanel( 3 );
        }