/// <summary> /// Gets the auto complete roleType data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of roleType.</returns> public virtual string[] GetRoleTypeAutoComplete(string prefixText, Int32 numberToReturn) { int i = 0; var query = Select. SelectIQueryableItems(r => SqlQueryMethods.Like(r.RoleTypeName, (prefixText + "%"))). Select(r => new { RoleTypeName = (string)r.RoleTypeName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.RoleTypeName; } return(ret); }
/// <summary> /// Gets the auto complete application data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of applications.</returns> public virtual string[] GetApplicationAutoComplete(string prefixText, Int32 numberToReturn) { int i = 0; var query = Select. SelectIQueryableItems(u => (SqlQueryMethods.Like(u.ApplicationName, (prefixText + "%")))). Select(a => new { ApplicationName = (string)a.ApplicationName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.ApplicationName; } return(ret); }
/// <summary> /// Gets the auto complete state data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of state.</returns> public virtual string[] GetStateAutoComplete(string prefixText, Int32 numberToReturn) { int i = 0; var query = Select. SelectIQueryableItems(s => (SqlQueryMethods.Like(s.StateLongName, (prefixText + "%")) || SqlQueryMethods.Like(s.StateShortName, (prefixText + "%")))). Select(s => new { StateName = (string)s.StateLongName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.StateName; } return(ret); }
/// <summary> /// Gets the auto complete country data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of country.</returns> public virtual string[] GetCountryAutoComplete(string prefixText, Int32 numberToReturn) { int i = 0; var query = Select. SelectIQueryableItems(c => (SqlQueryMethods.Like(c.CountryName, (prefixText + "%"))) || (SqlQueryMethods.Like(c.CountryCode, (prefixText + "%")))). Select(c => new { CountryName = (string)c.CountryName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.CountryName; } return(ret); }
/// <summary> /// Gets the auto complete user data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of user.</returns> public virtual string[] GetUserAutoComplete(string prefixText, Int32 numberToReturn) { int i = 0; var query = Select. SelectIQueryableItems(u => (SqlQueryMethods.Like(u.FirstName, (prefixText + "%"))) || (SqlQueryMethods.Like(u.LastName, (prefixText + "%")))). Select(u => new { UserName = (string)u.FirstName + " " + (string)u.LastName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.UserName; } return(ret); }
/// <summary> /// Gets the auto complete department data. /// </summary> /// <param name="prefixText">The prefix data to search for.</param> /// <param name="numberToReturn">The number of results to return.</param> /// <returns>The list of department.</returns> public static string[] GetDepartmentAutoComplete(string prefixText, Int32 numberToReturn) { Department dep = new Department(); int i = 0; var query = dep.Select. SelectIQueryableItems(d => (SqlQueryMethods.Like(d.DepartmentName, (prefixText + "%")))). Select(d => new { DepartmentName = (string)d.DepartmentName }).Take(numberToReturn); string[] ret = new string[query.Count()]; foreach (var item in query) { ret[i++] = (string)item.DepartmentName; } return(ret); }