From cf56f07e2882e4bdf5b108e4a5e26455d85a2ba6 Mon Sep 17 00:00:00 2001 From: hartvig Date: Tue, 20 Jul 2010 09:47:27 +0000 Subject: [PATCH] Fixes 28012 and 28044, issues with notification emails and issue with getAllByEmail method in Users [TFS Changeset #73410] --- umbraco/businesslogic/User.cs | 20 +++++++------------ .../businesslogic/workflow/Notification.cs | 4 ++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/umbraco/businesslogic/User.cs b/umbraco/businesslogic/User.cs index 52841e0977..0bf4b04493 100644 --- a/umbraco/businesslogic/User.cs +++ b/umbraco/businesslogic/User.cs @@ -398,26 +398,20 @@ namespace umbraco.BusinessLogic /// public static User[] getAllByEmail(string email) { + List retVal = new List(); System.Collections.ArrayList tmpContainer = new System.Collections.ArrayList(); IRecordsReader dr; dr = SqlHelper.ExecuteReader( - "Select id from umbracoUser where userEmail LIKE %@email%", SqlHelper.CreateParameter("@email", email)); + "Select id from umbracoUser where userEmail LIKE @email", SqlHelper.CreateParameter("@email", String.Format("%{0}%", email))); while (dr.Read()) { - tmpContainer.Add(BusinessLogic.User.GetUser(dr.GetInt("id"))); + retVal.Add(BusinessLogic.User.GetUser(dr.GetInt("id"))); } dr.Close(); - User[] retVal = new User[tmpContainer.Count]; - int c = 0; - foreach (User u in tmpContainer) - { - retVal[c] = u; - c++; - } - return retVal; + return retVal.ToArray(); } /// @@ -436,7 +430,7 @@ namespace umbraco.BusinessLogic var users = new List(); if (partialMatch) - { + { using (var dr = SqlHelper.ExecuteReader( "Select id from umbracoUser where userLogin LIKE @login", SqlHelper.CreateParameter("@login", String.Format("%{0}%", login)))) { @@ -461,7 +455,7 @@ namespace umbraco.BusinessLogic return users; - + } /// @@ -613,7 +607,7 @@ namespace umbraco.BusinessLogic { this.LoginName = DateTime.Now.ToString("yyyyMMdd") + "_" + this.LoginName; } - + } /// diff --git a/umbraco/cms/businesslogic/workflow/Notification.cs b/umbraco/cms/businesslogic/workflow/Notification.cs index 2e0999f1f1..8d1e7c07a2 100644 --- a/umbraco/cms/businesslogic/workflow/Notification.cs +++ b/umbraco/cms/businesslogic/workflow/Notification.cs @@ -122,13 +122,13 @@ namespace umbraco.cms.businesslogic.workflow string[] subjectVars = { - HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() + SystemDirectories.Umbraco, ui.Text(Action.Alias) + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() + IOHelper.ResolveUrl(SystemDirectories.Umbraco), ui.Text(Action.Alias) , documentObject.Text }; string[] bodyVars = { mailingUser.Name, ui.Text(Action.Alias), documentObject.Text, performingUser.Name, - HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() + SystemDirectories.Umbraco, + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() +IOHelper.ResolveUrl(SystemDirectories.Umbraco), documentObject.Id.ToString(), summary.ToString(), String.Format("http://{0}/{1}", HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString(),