예제 #1
0
        public List <GroupProduct> GroupProduct_GetByTop(string Top, string Where, string Order)
        {
            List <Data.GroupProduct> list = new List <Data.GroupProduct>();

            Data.GroupProduct obj = new Data.GroupProduct();
            SqlDataReader     dr  = null;

            try
            {
                using (SqlCommand dbCmd = new SqlCommand("sp_GroupProduct_GetByTop", GetConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dbCmd.Parameters.Add(new SqlParameter("@Top", Top));
                    dbCmd.Parameters.Add(new SqlParameter("@Where", Where));
                    dbCmd.Parameters.Add(new SqlParameter("@Order", Order));
                    dr = dbCmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            list.Add(obj.GroupProductIDataReader(dr));
                        }
                        //conn.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                obj = null;
            }
            return(list);
        }
예제 #2
0
        public List <GroupProduct> GroupProduct_GetByAll()
        {
            List <Data.GroupProduct> list = new List <Data.GroupProduct>();

            Data.GroupProduct obj = new Data.GroupProduct();
            SqlDataReader     dr  = null;

            try
            {
                using (SqlCommand dbCmd = new SqlCommand("sp_GroupProduct_GetByAll", GetConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dr = dbCmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            list.Add(obj.GroupProductIDataReader(dr));
                        }
                        //conn.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                obj = null;
            }
            return(list);
        }