Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        /// <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);
        }