示例#1
0
        public void GetReviewsByProduct(HttpContext context)
        {
            DataSet dsReviews = null;
            RatingBiz oRatingBiz = new RatingBiz();
            StringBuilder strBuildRev = new StringBuilder();
            try
            {
                Products oProducts = new Products();
                dsReviews = new DataSet();
                oRatingBiz.Pid = Convert.ToInt32(context.Request.Form["hdnPid"]);
                dsReviews = oProducts.GetReviewsByProduct(oRatingBiz);
                foreach (DataRow dr in dsReviews.Tables[0].Rows)
                {
                    string strRating = @"
                <div class='ratethis'><span class='fl'>Rate</span>
                    <ul class='star-rating'>
                        <li id='liRating' class='current-rating' style='width:" + Convert.ToDecimal(20*Convert.ToDecimal(dr["rating"].ToString())) + @"%'></li>
                        <li><a title='Poor'>1</a></li>
                        <li><a title='OK'>2</a></li>
                        <li><a title='Good'>3</a></li>
                        <li><a title='Useful'>4</a></li>
                        <li><a title='Excellent'>5</a></li>
                    </ul>
               </div>";

                    strBuildRev.Append("<table><tr><td style='width:200px' rowspan='2'>");
                    strBuildRev.Append(strRating+"<br />" + dr["reviewdate"] + "<br />"+dr["name"].ToString()+"</td>");
                    strBuildRev.Append("<td>"+dr["title"].ToString()+"</td></tr>");
                    strBuildRev.Append("<tr><td>"+dr["reviewtext"].ToString()+"</td></tr></table>");

                }
                HttpResponse oResponse = context.Response;
                oResponse.Write(strBuildRev.ToString());

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private void ReviewSubmit(HttpContext context)
        {
            RatingBiz oRatingBiz = new RatingBiz();
            string pid = context.Request.Form["hdnPid"];
            oRatingBiz.Pid = Convert.ToInt32(pid);
            oRatingBiz.ReviewerName = context.Request.Form["Reviews1$txtName"];
            oRatingBiz.ReviewText = context.Request.Form["Reviews1$txtReviewText"];
            oRatingBiz.ReviewTitle = context.Request.Form["Reviews1$txtTitle"];
            oRatingBiz.Rating = Convert.ToDecimal(context.Request.Form["hdnRating"]);

            Products oProducts = new Products();
            bool flag = oProducts.insertProductRating(oRatingBiz);
            HttpResponse oResponse = context.Response;
            oResponse.Write(flag);
        }
示例#3
0
 public Boolean insertProductRating(RatingBiz oRatingBiz)
 {
     try
     {
         ProductData oProductData = new ProductData();
         return oProductData.insertReviews(oRatingBiz);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
        public DataSet GetReviewsByProduct(RatingBiz oRatingBiz)
        {
            ProductData oProductData = null;
            try
            {

                oProductData = new ProductData();

                return oProductData.getReviewsByProduct(oRatingBiz);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public ProductBiz getProductDetailsById(int pid)
        {
            ProductData oProductData = null;
            ProductBiz oProductBiz = null;
            try
            {
                 oProductData = new ProductData();
                 oProductBiz = new ProductBiz();
                 DataSet dsProductDetails = oProductData.getProductDetailsById(pid);
                 if (dsProductDetails.Tables.Count > 0 && dsProductDetails.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in dsProductDetails.Tables[0].Rows)
                    {

                        oProductBiz.ProductName = dr["productname"].ToString();
                        oProductBiz.ProductId = Convert.ToInt32(dr["productid"].ToString());
                        oProductBiz.ProductCode = dr["pcode"].ToString();
                        oProductBiz.BrandId = Convert.ToInt32(dr["brandid"].ToString());
                        oProductBiz.ProdShortDesc = dr["productshortdesc"].ToString();
                        oProductBiz.ProdLongDesc = dr["productlongdesc"].ToString();

                        oProductBiz.Price = Convert.ToDecimal(dr["price"].ToString());
                        oProductBiz.MarketPrice = Convert.ToDecimal(dr["price"].ToString());
                        oProductBiz.IsActive = Convert.ToBoolean(dr["isactive"].ToString());
                        oProductBiz.IsProductSale = Convert.ToBoolean(dr["isproductsale"].ToString());
                        oProductBiz.SaleType = dr["saletype"].ToString();
                        oProductBiz.Priceorpercent = Convert.ToDecimal(dr["priceorpercent"].ToString());
                        oProductBiz.IsHot = Convert.ToBoolean(dr["ishot"].ToString());
                        oProductBiz.HotText = dr["hotdealsText"].ToString();
                        oProductBiz.QtyInCart = Convert.ToInt32(dr["qtyincart"].ToString());
                        oProductBiz.QtyText = dr["qtytext"].ToString();

                    }
                    ArrayList arrCategory = new ArrayList();
                    if (dsProductDetails.Tables[1].Rows.Count > 0)
                    {
                        foreach (DataRow dr in dsProductDetails.Tables[1].Rows)
                        {
                            arrCategory.Add(Convert.ToInt32(dr["categoryid"].ToString()));
                        }
                        oProductBiz.ArrCategories = arrCategory;
                    }
                    ArrayList arrPhotos = new ArrayList();
                    if (dsProductDetails.Tables[2].Rows.Count > 0)
                    {
                        foreach (DataRow dr in dsProductDetails.Tables[2].Rows)
                        {
                            BaseBiz oBaseBiz = new BaseBiz();
                            oBaseBiz.Name = dr["photopath"].ToString();
                            arrPhotos.Add(oBaseBiz);
                        }
                        oProductBiz.ArrImages = arrPhotos;
                    }

                    if (dsProductDetails.Tables[3].Rows.Count > 0)
                    {
                        RatingBiz oRating = new RatingBiz();
                        oRating.Rating = Convert.ToDecimal(20 * Convert.ToDecimal(dsProductDetails.Tables[3].Rows[0]["rating"].ToString()));
                        oRating.TotalRating = Convert.ToInt32(dsProductDetails.Tables[3].Rows[0]["TotalRating"].ToString());
                        oProductBiz.Rating = oRating;
                    }

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return oProductBiz;
        }
示例#6
0
        public Boolean insertReviews(RatingBiz oRatingBiz)
        {
            CDL.CoreDataLayer objCoreDataLayer = new CDL.CoreDataLayer();
            Boolean flag = false;
            try
            {
                string strRetValue = string.Empty;

                strRetValue = objCoreDataLayer.ExecuteScalar("PR_INSPRODREVIEW", new object[] { oRatingBiz.ReviewTitle, oRatingBiz.Pid,oRatingBiz.ReviewText,oRatingBiz.ReviewerName,oRatingBiz.Rating }, true);

                if (strRetValue == "0")
                    flag = true;

            }
            catch (Exception ex)
            {
                throw ex;
            }

            return flag;
        }
示例#7
0
        public DataSet getReviewsByProduct(RatingBiz oRatingBiz)
        {
            DataSet dsProductReview = null;
            CDL.CoreDataLayer objCoreDataLayer = new CDL.CoreDataLayer();
            try
            {
                dsProductReview = new DataSet();
                dsProductReview = objCoreDataLayer.ExecuteDataSet("pr_getallprodreviews", new object[] { oRatingBiz.Pid});

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return dsProductReview;
        }