public static List <ProductDTO> GetAllProducts(Boolean pLoadComments = false)
        {
            var query = "Select p.*, u.name uname from dbo.Products p,dbo.Users u Where p.IsActive = 1 and u.userId=p.CreatedBy;";

            using (DBHelper helper = new DBHelper())
            {
                var reader             = helper.ExecuteReader(query);
                List <ProductDTO> list = new List <ProductDTO>();

                while (reader.Read())
                {
                    var dto = FillDTO(reader, true);
                    if (dto != null)
                    {
                        list.Add(dto);
                    }
                }
                if (pLoadComments == true)
                {
                    //var commentsList = CommentDAO.GetAllComments();

                    var commentsList = CommentDAO.GetTopComments(2);

                    foreach (var prod in list)
                    {
                        List <CommentDTO> prodComments = commentsList.Where(c => c.ProductID == prod.ProductID).ToList();
                        prod.Comments = prodComments;
                    }
                }
                return(list);
            }
        }
        public static List <ProductDTO> GetAllProducts(Boolean pLoadComments = false)
        {
            var query = @"Select ProductID, p.Name AS pName, price, p.PictureName AS pPictureName, p.CreatedOn AS pCreatedOn, p.CreatedBy AS pCreatedBy, p.ModifiedOn AS pModifiedOn, p.ModifiedBy AS pModifiedBy, p.IsActive AS pIsActive, u.Name as uName 
						  from dbo.Products p, dbo.Users u 
						  Where p.CreatedBy = u.UserID 
						  AND p.IsActive = 1"                        ;

            using (DBHelper helper = new DBHelper())
            {
                var reader             = helper.ExecuteReader(query);
                List <ProductDTO> list = new List <ProductDTO>();

                while (reader.Read())
                {
                    var dto = FillDTO(reader);
                    if (dto != null)
                    {
                        list.Add(dto);
                    }
                }
                if (pLoadComments == true)
                {
                    //var commentsList = CommentDAO.GetAllComments();

                    var commentsList = CommentDAO.GetTopComments(2);

                    foreach (var prod in list)
                    {
                        List <CommentDTO> prodComments = commentsList.Where(c => c.ProductID == prod.ProductID).ToList();
                        prod.Comments = prodComments;
                    }
                }
                return(list);
            }
        }