Changeset 6317 for branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Helpers
- Timestamp:
- 05/27/11 19:09:49 (14 years ago)
- Location:
- branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Helpers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Helpers/Admin.cs
r6050 r6317 7 7 8 8 namespace HLWebOKBAdminPlugin.Helpers { 9 9 public class Admin { 10 10 11 public static AdministrationServiceClient GetClientFactory() { 12 return GetClientFactory(GetSessionString("Username"), GetSessionString("Password")); 11 public static AdministrationServiceClient GetClientFactory() { 12 return GetClientFactory(GetSessionString("Username"), GetSessionString("Password")); 13 } 14 15 public static AdministrationServiceClient GetClientFactory(string username, string password) { 16 try { 17 AdministrationServiceClient adminClient = new AdministrationServiceClient(); 18 adminClient.ClientCredentials.UserName.UserName = username; 19 adminClient.ClientCredentials.UserName.Password = password; 20 adminClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; 21 return adminClient; 22 } 23 catch { 24 } 25 return null; 26 } 27 28 public static string GetSessionString(string name) { 29 if (name != null) { 30 object o = HttpContext.Current.Session[name]; 31 if (o != null) { 32 return o.ToString(); 13 33 } 14 15 public static AdministrationServiceClient GetClientFactory(string username, string password) { 16 try { 17 AdministrationServiceClient adminClient = new AdministrationServiceClient(); 18 adminClient.ClientCredentials.UserName.UserName = username; 19 adminClient.ClientCredentials.UserName.Password = password; 20 adminClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; 21 return adminClient; 22 } 23 catch { 24 } 25 return null; 26 } 27 28 public static string GetSessionString(string name) { 29 if (name != null) { 30 object o = HttpContext.Current.Session[name]; 31 if (o != null) { 32 return o.ToString(); 33 } 34 } 35 return string.Empty; 36 } 34 } 35 return string.Empty; 37 36 } 37 } 38 38 } -
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Helpers/HtmlHelpers.cs
r5186 r6317 6 6 7 7 namespace HLWebOKBAdminPlugin.Helpers { 8 8 public static class HtmlHelpers { 9 9 10 public static string Truncate(this HtmlHelper helper, string input, int length) { 11 //takes a string and adds "..." if length > max length 12 13 if (input == null) 14 return ""; 10 public static string Truncate(this HtmlHelper helper, string input, int length) { 11 //takes a string and adds "..." if length > max length 15 12 16 if (input.Length <= length) { 17 return input; 18 }//if 19 else { 20 return input.Substring(0, length) + "..."; 21 }//else 22 }//Truncate 13 if (input == null) 14 return ""; 23 15 24 }//HtmlHelpers 16 if (input.Length <= length) { 17 return input; 18 }//if 19 else { 20 return input.Substring(0, length) + "..."; 21 }//else 22 }//Truncate 23 24 }//HtmlHelpers 25 25 }
Note: See TracChangeset
for help on using the changeset viewer.