public void GetUserTest()
        {
            string username = "******";
            User   expected = new User()
            {
                DisplayName = "Simon C. Wu",
                Email       = "*****@*****.**",
                Username    = "******"
            };
            User actual;

            actual = CfbDirectorySearcher.GetUser(username);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #2
0
        /// <summary>
        /// Sends the current notification.
        /// </summary>
        public void Send()
        {
            Candidate candidate = this.LoadCandidate != null?this.LoadCandidate(_message.CandidateID) : null;

            try
            {
                _mail.Body = string.Format(OpenReceiptBodyFormat,
                                           candidate != null ? candidate.Name : string.Format("candidate #{0}", _message.CandidateID),
                                           _message.CandidateID,
                                           _message.UniqueID,
                                           _message.ElectionCycle,
                                           CfbDirectorySearcher.GetUser(_message.Creator).DisplayName,
                                           _message.PostDate,
                                           _message.OpenDate,
                                           CPSecurity.Provider.GetDisplayName(_message.Opener),
                                           _message.Opener,
                                           _message.Title);
                _mail.Send();
            }
            catch
            {
            }
        }
Beispiel #3
0
 /// <summary>
 /// Retrieves a collection of the usernames of all users who have created messages, mapped to their respective full names.
 /// </summary>
 /// <returns>A collection of the useranmes of all users who have created messages, mapped to their respective full names.</returns>
 public Dictionary <string, string> GetCmoMessageCreators()
 {
     using (Data.CmoEntities context = new Data.CmoEntities())
     {
         return((from m in context.CmoMessages
                 where m != null
                 select m.CreatorADUserName).Distinct().ToDictionary(n => n, n => CfbDirectorySearcher.GetUser(n).DisplayName ?? n));
     }
 }
Beispiel #4
0
 /// <summary>
 /// Retrieves the best e-mail address available given a preferred e-mail address and a username.
 /// </summary>
 /// <param name="username">The network logon username of a domain user.</param>
 /// <param name="preferred">The preferred e-mail address.</param>
 /// <returns><paramref name="preferred"/> if defined; otherwise, the e-mail address for <paramref name="username"/>.</returns>
 private static string GetEmail(string username, string preferred)
 {
     return(string.IsNullOrWhiteSpace(preferred) ? CfbDirectorySearcher.GetUser(username).Email : preferred);
 }