Exemplo n.º 1
0
        public static List <T> Filter <T>(List <string> filterList) where T : DbEntity
        {
            var tableName = UtilAnnotationTableDb <T> .GetTableName();

            string queryFilter = FilterBuilder.Build(filterList, "=", "=");

            return(SqlCommandSelectFilter <T> .Execute(tableName, queryFilter));
        }
Exemplo n.º 2
0
        public static List <T> Filter <T>(List <string> columnsAndValues) where T : DbEntity
        {
            var tableName = UtilAnnotationTableDb <T> .GetTableName();

            string queryFilter = FilterLikeBuilder.Build(columnsAndValues, "=", " LIKE ");

            return(SqlCommandSelectFilter <T> .Execute(tableName, queryFilter));
        }
Exemplo n.º 3
0
        public static List <T> PaginateSorting <T>(string pageNumber, string totalPageNumber,
                                                   List <string> sortingList) where T : DbEntity
        {
            var tableName = UtilAnnotationTableDb <T> .GetTableName();

            string sorting = sortingList != null && sortingList.Count > 0
                ? string.Join(",", sortingList.ToArray())
                : "(SELECT NULL)";

            return(SqlCommandSelectPaginationAndSorting <T>
                   .Execute(tableName, pageNumber, totalPageNumber, sorting));
        }
        public static DbEntityUser FindByUsernamePassword(string username, string password)
        {
            string tableName = UtilAnnotationTableDb <DbEntityUser> .GetTableName();

            StringBuilder userNameAndPassword = new StringBuilder();

            userNameAndPassword.Append($"Username='******' AND ");
            userNameAndPassword.Append($"Password='******'");
            var filteredList = SqlCommandSelectFilter <DbEntityUser> .Execute(
                tableName, userNameAndPassword.ToString());

            return((filteredList.Count < 1) ? null : filteredList[0]);
        }
Exemplo n.º 5
0
        public static List <T> Filter <T>(string pageNumber, string totalPageNumber,
                                          List <string> columnsAndValues, List <string> sortingList) where T : DbEntity
        {
            var tableName = UtilAnnotationTableDb <T> .GetTableName();

            string queryFilter = FilterLikeBuilder.Build(columnsAndValues, "=", " LIKE ");

            string sorting = sortingList != null && sortingList.Count > 0
                ? string.Join(",", sortingList.ToArray())
                : "(SELECT NULL)";

            return(SqlCommandSelectPaginationSortingFilter <T> .Execute(tableName, pageNumber,
                                                                        totalPageNumber, sorting, queryFilter));
        }
        public static List <T> Paginate <T>(string pageNumber, string totalPageNumber) where T : DbEntity
        {
            var tableName = UtilAnnotationTableDb <T> .GetTableName();

            return(SqlCommandSelectPagination <T> .Execute(tableName, pageNumber, totalPageNumber));
        }