/// <summary>
        /// 
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public List<ProductComment> GetProductComments(int count)
        {
            List<ProductComment> list = new List<ProductComment>();

            string commText = string.Empty;
            switch (count)
            {
                case 0:
                    commText = "select * from ProductComment order by ProductCommentID desc";
                    break;
                default:
                    commText = "select top " + count.ToString() + " * from ProductComment order by ProductCommentID desc";
                    break;
            }

            using (SqlConnection conn = new SqlConnection(DataHelper2.SqlConnectionString))
            {
                {
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.Connection = conn;
                        comm.CommandText = commText;
                        conn.Open();

                        using (SqlDataReader sdr = comm.ExecuteReader())
                        {
                            while (sdr.Read())
                            {
                                ProductComment productComment = new ProductComment();

                                productComment.CommentCreateTime = Convert.ToDateTime(sdr["ProductCommentCreateTime"].ToString());
                                productComment.CommentID = int.Parse(sdr["ProductCommentID"].ToString());
                                productComment.CommentText = sdr["ProductCommentText"].ToString();
                                productComment.ProductID = int.Parse(sdr["ProductID"].ToString());
                                productComment.UserAddress = sdr["UserAddress"].ToString();
                                productComment.UserID = int.Parse(sdr["UserID"].ToString());
                                productComment.UserName = sdr["UserName"].ToString();

                                list.Add(productComment);
                            }
                        }
                    }
                }
            }

            return list;
        }
        public bool ProductCommentCreateDeleteUpdate(ProductComment productComment, UserAction ua)
        {
            bool result = false;

            string commandText = string.Empty;
            switch (ua)
            {
                case UserAction.Create:
                    commandText = "insert into ProductComment(ProductCommentText,UserID,UserName,UserAddress,ProductCommentCreateTime,ProductID) values('" + productComment.CommentText + "'," + productComment.UserID.ToString() + ",'" + productComment.UserName + "','" + productComment.UserAddress + "','" + productComment.CommentCreateTime.ToString() + "'," + productComment.ProductID.ToString() + ")";
                    break;
                case UserAction.Delete:
                    commandText = "delete from ProductComment where ProductCommentID = " + productComment.CommentID.ToString();
                    break;
                case UserAction.Update:
                    commandText = "update ProductComment set ProductCommentText ='" + productComment.CommentText + "',UserID=" + productComment.UserID.ToString() + ",UserName='******',UserAddress='" + productComment.UserAddress + "',ProductCommentCreateTime='" + productComment.CommentCreateTime.ToString() + "',ProductID=" + productComment.ProductID.ToString() + " where ProductCommentID=" + productComment.CommentID.ToString();
                    break;
            }
            using (SqlConnection conn = new SqlConnection(DataHelper2.SqlConnectionString))
            {
                using (SqlCommand comm = new SqlCommand())
                {
                    comm.CommandText = commandText;
                    comm.Connection = conn;
                    conn.Open();
                    try
                    {
                        comm.ExecuteNonQuery();
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }

                }
            }

            return result;
        }
        public List<ProductComment> GetProductCommentsByUserID(int userID, int count, OrderKey ok)
        {
            List<ProductComment> list = new List<ProductComment>();

            string orderKey = " order by ";
            switch (ok)
            {
                //case OrderKey.Good:
                //    orderKey = "IsGood desc";
                //    break;
                case OrderKey.ID:
                    orderKey = "ProductID desc";
                    break;
                case OrderKey.Time:
                    orderKey = "ProductCommentCreateTime desc";
                    break;
                default:
                    orderKey = "ProductCommentID desc";
                    break;
            }
            string commText = string.Empty;
            switch (count)
            {
                case 0:
                    commText = "select * from ProductComment where UserID=" + userID.ToString() + orderKey;
                    break;
                default:
                    commText = "select top " + count.ToString() + " * from ProductComment where UserID=" + userID.ToString() + orderKey;
                    break;
            }

            using (SqlConnection conn = new SqlConnection(DataHelper2.SqlConnectionString))
            {
                {
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.Connection = conn;
                        comm.CommandText = commText;
                        conn.Open();

                        using (SqlDataReader sdr = comm.ExecuteReader())
                        {
                            while (sdr.Read())
                            {
                                ProductComment productComment = new ProductComment();

                                productComment.CommentCreateTime = Convert.ToDateTime(sdr["ProductCommentCreateTime"].ToString());
                                productComment.CommentID = int.Parse(sdr["ProductCommentID"].ToString());
                                productComment.CommentText = sdr["ProductCommentText"].ToString();
                                productComment.ProductID = int.Parse(sdr["ProductID"].ToString());
                                productComment.UserAddress = sdr["UserAddress"].ToString();
                                productComment.UserID = int.Parse(sdr["UserID"].ToString());
                                productComment.UserName = sdr["UserName"].ToString();

                                list.Add(productComment);
                            }
                        }
                    }
                }
            }

            return list;
        }