本文整理汇总了C#中Product.setProductRating方法的典型用法代码示例。如果您正苦于以下问题:C# Product.setProductRating方法的具体用法?C# Product.setProductRating怎么用?C# Product.setProductRating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product.setProductRating方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProduct
public static Product GetProduct(int productId)
{ // get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "SELECT Product.productName,Product.productShortDesc,Product.productPrice,Product.productImagePath,Product.productQty,Country.countryName,Country.countryId,Vendor.vendorName,Vendor.vendorId,Product.productId,Product.productRating FROM dbo.Product INNER JOIN dbo.Country ON Product.productCountryId=Country.countryId INNER JOIN dbo.Vendor ON Product.vendorId=Vendor.vendorId where dbo.Product.productId='" + productId + "';";
comm.CommandType = CommandType.Text;
// execute the stored procedure and return the results
DataTable table=GenericDataAccess.ExecuteSelectCommand(comm);
DbDataReader reader = table.CreateDataReader();
Product product = new Product();
while (reader.Read())
{
product.setProductId(reader.GetInt32(9));
product.setproductName(reader.GetString(0));
product.setProductShortDesc(reader.GetString(1));
product.setProductPrice(reader.GetDouble(2));
product.setProductImagePath(reader.GetString(3));
product.setProductQuantity(reader.GetInt32(4));
product.setProductCountryId(reader.GetInt32(6));
product.setproductVendorName(reader.GetString(7));
product.setProductVendorId(reader.GetInt32(8));
product.setProductRating(reader.GetInt32(10));
}
return product;
}
示例2: GetCart
public static Product[] GetCart(int customerId)
{ // get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "SELECT ShoppingCart.customerId,ShoppingCart.productId,ShoppingCart.quantity,Product.productName,Product.productPrice,Product.productImagePath,Product.productCountryId,Product.categoryId,Product.vendorId,Product.productRating,Product.productShortDesc,Product.productLongDesc,Vendor.vendorName FROM dbo.ShoppingCart INNER JOIN dbo.Product ON ShoppingCart.productId=Product.productId INNER JOIN dbo.Vendor ON ShoppingCart.vendorId=Vendor.vendorId WHERE ShoppingCart.customerId="+customerId+";";
comm.CommandType = CommandType.Text;
// execute the stored procedure and return the results
comm.Connection.Open();
DbDataReader reader = comm.ExecuteReader();
Product[] product = new Product[20];
int i = 0;
while (reader.Read())
{
Product product1 = new Product();
product1.setProductId(reader.GetInt32(1));
product1.setproductName(reader.GetString(3));
product1.setProductShortDesc(reader.GetString(10));
product1.setProductPrice(reader.GetDouble(4));
product1.setProductImagePath(reader.GetString(5));
product1.setProductQuantity(reader.GetInt32(2));
product1.setProductCountryId(reader.GetInt32(6));
product1.setProductCategoryId(reader.GetInt32(7));
product1.setProductLongDesc(reader.GetString(11));
product1.setproductVendorName(reader.GetString(12));
product1.setProductVendorId(reader.GetInt32(8));
product1.setProductRating(reader.GetInt32(9));
product1.addProduct(product1, product);
}
return product;
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Session["user"] == null)
{
Session["prevpage"] = "ShoppingCart.aspx";
Response.Redirect("loginpage.aspx");
}
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
int customerId = (int)Session["userid"];
comm.CommandText = "SELECT ShoppingCart.customerId,ShoppingCart.productId,ShoppingCart.quantity,Product.productName,Product.productPrice,Product.productImagePath,Product.productCountryId,Product.categoryId,Product.vendorId,Product.productRating,Product.productShortDesc,Product.productLongDesc,Vendor.vendorName FROM dbo.ShoppingCart INNER JOIN dbo.Product ON ShoppingCart.productId=Product.productId INNER JOIN dbo.Vendor ON ShoppingCart.vendorId=Vendor.vendorId WHERE ShoppingCart.customerId="+customerId+";";
comm.CommandType = CommandType.Text;
DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
DbDataReader reader = table.CreateDataReader();
string rows = null;
int i = 0;
Product[] productCart = new Product[20];
while (reader.Read())
{
Product product = new Product();
product.setProductId(reader.GetInt32(1));
int custid = reader.GetInt32(0);
product.setProductQuantity(reader.GetInt32(2));
product.setproductName(reader.GetString(3));
product.setProductPrice(reader.GetDouble(4));
product.setProductImagePath(reader.GetString(5));
product.setProductCountryId(reader.GetInt32(6));
product.setProductCategoryId(reader.GetInt32(7));
product.setProductVendorId(reader.GetInt32(8));
product.setProductRating(reader.GetInt32(9));
product.setProductShortDesc(reader.GetString(10));
product.setProductLongDesc(reader.GetString(11));
product.setproductVendorName(reader.GetString(12));
product.addProduct(product, productCart);
rows += "<div class='prodtable'><input type=radio id=cart runat=server name=selproduct value=" + product.getProductId() + " /><img src=" + product.getProductImagePath() + " height=100 width=100 /><br /><b>Name: </b>" + product.getProductName() + " <br /><b>Vendor: </b>" + product.getProductVendorName() + " <br /><b>Quantity: </b>" + product.getProductQuantity() + "<br /><b>Price: </b>" + product.getProductPrice() + "<br /><br /></div>";
}
if (productCart[0] != null)
{
rows += "<p style='margin-top:50px;font-size:60px;'>Total Price= " + productCart[0].calcTotalPrice(productCart);
}
/* <table width="80%" style="border: thin solid #000000; top:20%;">
<% Product[] productCart=(Product[])Session["productCart"]; %>>
<% for (int i = 0; i < productCart.Length; i++)
{
if (productCart[i] != null)
{ %>
<tr>
<td>
<img= id="img1" height="412" width="473"
src="<%=productCart[i].getProductImagePath()%>">
</td>
<td class="style1">
<ul>
<li>Product Name: <%=productCart[i].getProductName()%></li>
<li>Quantity:<%=productCart[i].getProductQuantity()%></li>
<li>Rating:<%=productCart[i].getProductRating()%>
</li>
<li>
</li>
</ul>
</td>
</tr>
<%}
}
%>
TotalPrice= <%=productCart[0].calcTotalPrice(productCart) %>
</table> */
if (Session["productCart"] == null)
{
Session["productCart"] = productCart;
}
tableproducts.InnerHtml = rows;
}