public List <T> RunSp <T>(ConnectionNameEnum connectionNameEnum, string storeProcureName,
                                  int recordCount, int pageNumber, out int allRecordCount)
        {
            var param = Parameters.Clone(); //.ToDictionary(x => x.Key, x => x.Value);

            Parameters.Clear();
            List <T> list;
            var      com = new GeneralMethods().MakeSqlCommand(connectionNameEnum, storeProcureName, param, ConnectionTimeout);
            var      dt  = new DataTable();

            try
            {
                using (var result = com.ExecuteReader())
                {
                    var schemaTable = result.GetSchemaTable();
                    if (schemaTable != null && schemaTable.Select("ColumnName='ErrorCode'").Length > 0)
                    {
                        var sqlSpException = new DataException();
                        //sqlSpException.Add((int)result["ErrorCode"], result["ErrorMessage"].ToString());
                        while (result.Read())
                        {
                            sqlSpException.Add((int)result["ErrorCode"], result["ErrorMessage"].ToString());
                        }
                        throw sqlSpException;
                    }


                    if (typeof(T).IsValueType || "".GetType() == typeof(T))
                    {
                        list = new List <T>();
                        Parallel.ForEach(SimpleParallelDataReader <T>(result), (data) =>
                        {
                            list.Add(data);
                        });
                        allRecordCount = list.Count;
                        return(list);
                    }

                    return(new GeneralMethods().ToViewModel <T>(result, recordCount, pageNumber, out allRecordCount));
                    //dt.Load(result);
                    ////var tempTable = dt.n
                    ////for(int i = 0; i <= )


                    //var l = dt.AsEnumerable(); //.Select();
                    //allRecordCount = l.Count();
                    //var newList = l.Skip((pageNumber - 1)*recordCount).Take(recordCount);
                    //list = new GeneralMethods().ToViewModel<T>(newList);
                }
            }
            catch (DataException)
            {
                Parameters.Clear();
                throw;
            }
            finally
            {
                ConnectionManager.ReleaseConnection(com.Connection);
            }
        }
        /// <summary>
        /// Runs the sp returned table.
        /// </summary>
        /// <param name="connectionNameEnum">The connection name enum.</param>
        /// <param name="storeProcureName">Name of the store procure.</param>
        /// <returns></returns>
        public DataTable RunSpReturnedTable(ConnectionNameEnum connectionNameEnum, string storeProcureName)
        {
            var param = Parameters.Clone(); //.ToDictionary(x => x.Key, x => x.Value);

            Parameters.Clear();
            var command = new GeneralMethods().MakeSqlCommand(connectionNameEnum, storeProcureName, param, ConnectionTimeout);

            try
            {
                var dr = command.ExecuteReader();
                var dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Columns.Contains("ErrorCode"))
                    {
                        var sqlSpException = new DataException();
                        for (var i = 0; i < dt.Rows.Count; i++)
                        {
                            sqlSpException.Add((int)dt.Rows[i]["ErrorCode"], dt.Rows[i]["ErrorMessage"].ToString());
                        }
                        ConnectionManager.ReleaseConnection(command.Connection);
                        Parameters.Clear();
                        throw sqlSpException;
                    }

                    return(dt);
                }
            }
            finally
            {
                ConnectionManager.ReleaseConnection(command.Connection);
                Parameters.Clear();
            }


            return(null);
        }