Exemple #1
0
        public ClassName ExecuteClassQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod, Dictionary <string, object> parameters)
        {
            if (parameters == null)
            {
                parameters = new Dictionary <string, object>();
            }

            DataTable table = ExecuteDataTable(storedProcedureName, parameters);

            DoPostCommandProcessing();

            if (table.Rows.Count > 0)
            {
                return(generateMethod(table.Rows[0]));
            }

            return(default(ClassName));
        }
Exemple #2
0
        public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string countStatement, string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex, Dictionary <string, object> parameters)
        {
            if (parameters == null)
            {
                parameters = new Dictionary <string, object>();
            }

            int       virtualCount = ExecuteScalar <int>(countStatement, parameters);
            DataTable table        = ExecuteDataTable(selectStatement, parameters);

            PagedList <ClassName> result = new PagedList <ClassName> {
                VirtualCount = virtualCount
            };

            foreach (DataRow row in table.Rows)
            {
                result.Add(generateMethod(row));
            }

            DoPostCommandProcessing();

            return(result);
        }
Exemple #3
0
 public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string countStatement, string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex, params object[] parameters)
 {
     return(ExecutePagedClassListQuery(countStatement, selectStatement, generateMethod, startIndex, endIndex, GetParametersFromObjectArray(parameters)));
 }
Exemple #4
0
 public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string countStatement, string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex)
 {
     return(ExecutePagedClassListQuery(countStatement, selectStatement, generateMethod, startIndex, endIndex, (object[])null));
 }
Exemple #5
0
        public List <ClassName> ExecuteClassListQuery <ClassName>(string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod, Dictionary <string, object> parameters)
        {
            if (parameters == null)
            {
                parameters = new Dictionary <string, object>();
            }

            DataTable        table  = ExecuteDataTable(selectStatement, parameters);
            List <ClassName> result = new List <ClassName>();

            foreach (DataRow row in table.Rows)
            {
                result.Add(generateMethod(row));
            }

            DoPostCommandProcessing();

            return(result);
        }
Exemple #6
0
 public List <ClassName> ExecuteClassListQuery <ClassName>(string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod, params object[] parameters)
 {
     return(ExecuteClassListQuery(selectStatement, generateMethod, GetParametersFromObjectArray(parameters)));
 }
Exemple #7
0
 public List <ClassName> ExecuteClassListQuery <ClassName>(string selectStatement, ObjectFromDataRowHandler <ClassName> generateMethod)
 {
     return(ExecuteClassListQuery(selectStatement, generateMethod, (object[])null));
 }
Exemple #8
0
 public ClassName ExecuteClassQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod, params object[] parameters)
 {
     return(ExecuteClassQuery(storedProcedureName, generateMethod, GetParametersFromObjectArray(parameters)));
 }
Exemple #9
0
 public ClassName ExecuteClassQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod)
 {
     return(ExecuteClassQuery(storedProcedureName, generateMethod, (object[])null));
 }
Exemple #10
0
        public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex, Dictionary <string, object> parameters)
        {
            if (parameters == null)
            {
                parameters = new Dictionary <string, object>();
            }

            SqlParameter virtualCountParameter = new SqlParameter("@VirtualCount", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            };
            SqlParameter startIndexParameter = new SqlParameter("@StartIndex", startIndex == null ? DBNull.Value : (object)startIndex.Value);
            SqlParameter endIndexParameter   = new SqlParameter("@EndIndex", endIndex == null ? DBNull.Value : (object)endIndex.Value);

            SqlParameterCollection outputParameters;
            DataTable table = ExecuteDataTable(storedProcedureName, parameters, new[] { startIndexParameter, endIndexParameter, virtualCountParameter }, out outputParameters);

            PagedList <ClassName> result = new PagedList <ClassName> {
                VirtualCount = Convert.ToInt32(outputParameters["@VirtualCount"].Value)
            };

            foreach (DataRow row in table.Rows)
            {
                result.Add(generateMethod(row));
            }

            DoPostCommandProcessing();

            return(result);
        }
Exemple #11
0
 public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex, params object[] parameters)
 {
     return(ExecutePagedClassListQuery(storedProcedureName, generateMethod, startIndex, endIndex, GetParametersFromObjectArray(parameters)));
 }
Exemple #12
0
 public PagedList <ClassName> ExecutePagedClassListQuery <ClassName>(string storedProcedureName, ObjectFromDataRowHandler <ClassName> generateMethod, int?startIndex, int?endIndex)
 {
     return(ExecutePagedClassListQuery(storedProcedureName, generateMethod, startIndex, endIndex, (object[])null));
 }