Ejemplo n.º 1
0
        public List <Link> SelectByStatus(int top, Link.StatusAttribute status)
        {
            List <Link> links   = new List <Link>();
            LinkDAL     dalLink = new LinkDAL();

            links = dalLink.SelectByStatus(top, status);
            return(links);
        }
Ejemplo n.º 2
0
        public List <Link> SelectByStatus(Link.StatusAttribute status)
        {
            string sqlStr = SELECT + "WHERE [Status] = @Status;";

            SqlParameter[] parameters =
            {
                new SqlParameter("@Status", status)
            };
            List <Link> links = Readers(SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sqlStr));

            return(links);
        }
Ejemplo n.º 3
0
        public int SelectCountByStatus(Link.StatusAttribute status)
        {
            string sqlStr = "SELECT COUNT('x') FROM [dbo].[Links] WHERE [Status] = @Status;";

            SqlParameter[] parameters =
            {
                new SqlParameter("@Status", status)
            };
            int count = (int)SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.Text, sqlStr, parameters);

            return(count);
        }
Ejemplo n.º 4
0
        public List <Link> SelectByStatus(int top, Link.StatusAttribute status)
        {
            string sqlStr = "SELECT TOP (@top) " + SELECT_COLUMNS + "FROM [dbo].[Links] WHERE [Status] = @Status;";

            SqlParameter[] parameters =
            {
                new SqlParameter("@top",    top),
                new SqlParameter("@Status", status)
            };
            List <Link> links = Readers(SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sqlStr, parameters));

            return(links);
        }
Ejemplo n.º 5
0
        public bool UpdateStatusByUrl(string url, Link.StatusAttribute status)
        {
            string sqlStr = "UPDATE [dbo].[Links] SET [UpdateTime] = @UpdateTime,[Status] = @Status WHERE Url =@Url";

            SqlParameter[] parameters =
            {
                new SqlParameter("@UpdateTime", DateTime.Now),
                new SqlParameter("@Status",     status),
                new SqlParameter("@Url",        url),
            };
            int row = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.Text, sqlStr, parameters);

            if (row > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }