Exemplo n.º 1
0
        public List <KeyValuePair <Person, string> > ResetPasswords(List <Person> people)
        {
            var result = new List <KeyValuePair <Person, string> >();

            foreach (var person in people)
            {
                var password = _membershipService.ResetPasswordNoEmail(person.User.UserName);
                result.Add(new KeyValuePair <Person, string>(person, password));
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the string data that should be replaced into the template text
        /// to create the final letter for the students.
        /// </summary>
        /// <param name="parameter">The parameter name.</param>
        /// <returns>Value that should replace the parameter</returns>
        private string replaceParameter(string parameter, NotificationGeneratorHelper helper)
        {
            // Trim the {}
            int length = parameter.Length;

            parameter = parameter.Substring(1, length - 2);

            // replace the value
            switch (parameter.ToLower())
            {
            case "badgename":
                return(string.IsNullOrWhiteSpace(helper.BadgeName) ? helper.FirstName : helper.BadgeName);

            case "firstname":
                return(helper.FirmName);

            case "fullname":
                return(helper.FullName);

            case "seminarbegindate":
                return(helper.SeminarBegin);

            case "seminarenddate":
                return(helper.SeminarEnd);

            case "seminardeadline":
                return(helper.SeminarDeadline);

            case "title":
                return(helper.Title);

            case "firmname":
                return(helper.FirmName);

            case "username":
                return(helper.UserName);

            case "password":

                return(helper.Password ?? _membershipService.ResetPasswordNoEmail(helper.UserName));

                //var password = _membershipService.ResetPasswordNoEmail(helper.UserName);
                ///return password;
            }

            throw new ArgumentException("Invalid parameter was passed.");
        }