本文整理汇总了C#中Products类的典型用法代码示例。如果您正苦于以下问题:C# Products类的具体用法?C# Products怎么用?C# Products使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Products类属于命名空间,在下文中一共展示了Products类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadGridView
/// <summary>
/// Method which loads the gridview with all the Products.
/// </summary>
protected void loadGridView()
{
Products product = new Products();
GridView1.DataSource = product.getAllProducts();
GridView1.DataBind();
}
示例2: rpNews_ItemCommand
protected void rpNews_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string strCommand = e.CommandName;
int nID = ConvertData.ConvertToInt(e.CommandArgument);
Products objProduct = new Products();
switch (strCommand)
{
case "Delete":
objProduct.LoadById(nID);
Support.DeleteFile("product", objProduct.Data.Images);
Support.DeleteFolder("productimg",nID);
int nDelete = objProduct.DeleteById(nID);
BindDataToGrid(1);
break;
case "Edit":
string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_PRODUCT_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
Response.Redirect(sEdit);
break;
case "Active":
int nActive = objProduct.UpdateStatus(nID, EnumeType.INACTIVE);
BindDataToGrid(1);
break;
case "Inactive":
int nInactive = objProduct.UpdateStatus(nID, EnumeType.ACTIVE);
BindDataToGrid(1);
break;
}
}
示例3: EsDataSource1_esCreateEntity
protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e)
{
ProductsQuery p = new ProductsQuery("p");
CategoriesQuery c = new CategoriesQuery("c");
p.Select(p, c.CategoryName);
p.InnerJoin(c).On(p.CategoryID == c.CategoryID);
if (e.PrimaryKeys != null)
{
p.Where(p.ProductID == (int)e.PrimaryKeys[0]);
}
else
{
// They want to add a new one, lets do a select that brings back
// no records so that our CategoryName column (virutal) will be
// present in the underlying record format
p.Where(1 == 0);
}
Products prd = new Products();
prd.Load(p); // load the data (if any)
// Assign the Entity
e.Entity = prd;
}
示例4: GetProducts
/// <summary>
/// Gets the list of products.
/// </summary>
/// <returns>
/// Returns the list of products.
/// </returns>
public static Products GetProducts()
{
var products =
new Products(
new List<Product>()
{
new Product()
{
ProductId = 1,
Name = "ABC",
Description = "Product ABC",
Href = "/product/1",
Links =
{
new Link() { Rel = "collection", Href = "/products" },
new Link() { Rel = "template", Href = "/product/{productId}" },
}
},
new Product()
{
ProductId = 2,
Name = "XYZ",
Description = "Product XYZ",
Href = "/product/2",
Links =
{
new Link() { Rel = "collection", Href = "/products" },
new Link() { Rel = "template", Href = "/product/{productId}" },
}
},
});
return products;
}
示例5: PutProducts
public IHttpActionResult PutProducts(int id, Products products)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != products.Product_ID)
{
return BadRequest();
}
db.Entry(products).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!ProductsExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
示例6: PrintProductVSByCategory
void PrintProductVSByCategory(Remix.Category category, StringBuilder sb)
{
Products products = new Products();
int.TryParse(Request["page"], out products.CurrentPage);
products.CurrentPage = products.CurrentPage == 0 ? 1 : products.CurrentPage;
BestBuyCategoryProductsFiller.Do(products, category);
sb.Append("<div>");
sb.Append("<h2>Product VS Pair List - Total " + products.TotalPages + " Pages</h2>");
sb.Append("<ul class='better-ranked'>");
foreach (var product in products)
{
ProductPool.Cache(product, CacheType.Simple);
sb.Append(@"
<li>
<a href='/P.aspx?upc=" + product.UPC + @"&title=" + HttpUtility.UrlEncode(HttpUtility.HtmlEncode(product.Name)) + @"' title='" + product.Name + (product.BBYSalePrice > 0 ? " $" + product.BBYSalePrice : "") + @"'>
<img src='" + (string.IsNullOrEmpty(product.LargeImageUrl) ? product.ThumbnailImageUrl : product.LargeImageUrl) + @"' /><br />
" + product.Name + @"
" + (product.BBYSalePrice > 0 ? "<br /><span style='color:#000'>$" + product.BBYSalePrice + "</span>" : "") + @"
</a>
</li>
");
}
sb.Append("</ul>");
sb.Append("<div class='clear' style='width:100%;'></div>");
sb.Append("</div>");
//page
string baseUrl = "/Category.aspx?id=" + HttpUtility.UrlEncode(category.Id);
HTMLGenerator.PrintPageNav(products.CurrentPage, products.TotalPages, baseUrl, sb);
}
示例7: BuildControl
protected override void BuildControl(System.Web.Mvc.TagBuilder builder, Products.CustomFieldDefinition field, string value, object htmlAttributes, System.Web.Mvc.ViewContext viewContext)
{
builder.AddCssClass("form-list");
var itemsHtml = new StringBuilder();
var i = 0;
foreach (var item in field.SelectionItems)
{
itemsHtml.AppendLine("<li>");
var radioId = field.Name + "_" + i;
var radio = new TagBuilder("input");
radio.MergeAttribute("id", radioId);
radio.MergeAttribute("type", "radio");
radio.MergeAttribute("name", field.Name);
radio.MergeAttribute("value", item.Value);
var label = new TagBuilder("label");
label.InnerHtml = item.Text;
label.AddCssClass("inline");
label.MergeAttribute("for", radioId);
itemsHtml.AppendLine(radio.ToString(TagRenderMode.SelfClosing));
itemsHtml.AppendLine(label.ToString());
itemsHtml.AppendLine("</li>");
i++;
}
builder.InnerHtml = itemsHtml.ToString();
base.BuildControl(builder, field, value, htmlAttributes, viewContext);
}
示例8: PrintProductVSByCategory
public static void PrintProductVSByCategory(string categoryId)
{
Products products = new Products();
BestBuyCategoryProductsFiller.Do(products, new Remix.Category() { Id = categoryId });
foreach (var product in products)
{
ProductPool.Cache(product, CacheType.Simple);
}
Dictionary<string, string> VSDic = new Dictionary<string, string>();
foreach (var product in products)
{
foreach (var similarProduct in product.SimilarProducts)
{
Product filledSimilarProduct = ProductPool.GetByBestBuySKU(similarProduct.BBYSKU, CacheType.Simple);
ProductPool.Cache(filledSimilarProduct, CacheType.Simple);
if (filledSimilarProduct.BBYCategoryPath != null
&& filledSimilarProduct.BBYCategoryPath[filledSimilarProduct.BBYCategoryPath.Length - 1].Id
== product.BBYCategoryPath[product.BBYCategoryPath.Length - 1].Id)
{
VSDic[product.UPC] = filledSimilarProduct.UPC;
}
}
}
foreach (var key in VSDic.Keys)
{
Product product1 = ProductPool.GetByUPC(key, CacheType.Simple);
Product product2 = ProductPool.GetByUPC(VSDic[key], CacheType.Simple);
Console.WriteLine("{0},{1} -|- {2},{3}", product1.UPC, product1.Name, product2.UPC, product2.Name);
}
}
示例9: ProductsPresenter
public ProductsPresenter(Products view)
{
productDAO = new productDAO();
cached = new List<Product>();
this.view = view;
this.state = FormState.UPDATE_OLD;
}
示例10: Test_CK_einProduktZweiMal_InsPaket
public void Test_CK_einProduktZweiMal_InsPaket()
{
var sut = new Solution();
var products = new Products { { "Apfel", 10 } };
var success = false;
var productPackages = new ProductPackages
{
new ProductPackage(){ Price = 15, Products = { "Apfel", "Apfel" }},
};
sut.Setup(products, productPackages);
var price = 0;
sut.SendPrice += p =>
{
price = p;
Debug.WriteLine("{0},", price);
};
sut.Order("Apfel");
price.Should().Be(10);
sut.Order("Apfel");
price.Should().Be(15);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
divSuccess.Visible = false;
divError.Visible = false;
Products products = new Products();
//Validates if it has a name parameter to filter the products
string name = Request.Params.Get("name");
string type = Request.Params.Get("type");
if (name != null && name != "")
{
products._name = name;
Repeater1.DataSource = products.RetrieveProductsByName();
}
//Validates if it has a type parameter
else if (type != null && type != "")
{
products._type = type;
Repeater1.DataSource = products.RetrieveProductsByType();
}
else
{
Repeater1.DataSource = products.RetrieveAllProducts();
}
Repeater1.DataBind();
}
示例12: Upgrade
public Upgrade(UpgradeType type, Products target, string name, BigInteger price)
{
this.Type = type;
this.Target = target;
this.Name = name;
this.Price = price;
}
示例13: Details
public ActionResult Details(string id)
{
var product = new Products().FirstOrDefault(x => x.ProductNumber == id);
if (product == null)
return View("Error");
return View(product);
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Products products = new Products();
products._clientid = new Guid(Session["id"].ToString());
Repeater1.DataSource = products.RetrieveProductsBySeller();
Repeater1.DataBind();
}
示例15: UpdateTable
public void UpdateTable(Products ps, int id, string datar)
{
cn = new MySqlConnection("database=y;server=x;user id=b;password=a");
string qry = "INSERT INTO SHOPPINGCART VALUES (@IDCUSTOMER, @IDPRODUCT, @ORDERDATE, @PICKUPDATE, @TOTAL, @PAYMETHOD, @NOTES)";
foreach (Product p in ps)
{
MySqlCommand cmd = new MySqlCommand(qry, cn);
cmd.Parameters.AddWithValue("@IDCUSTOMER", id);
cmd.Parameters.AddWithValue("@IDPRODUCT", p.IdProduct);
cmd.Parameters.AddWithValue("@ORDERDATE", DateTime.Now);
cmd.Parameters.AddWithValue("@PICKUPDATE", datar);
cmd.Parameters.AddWithValue("@TOTAL", p.Price);
cmd.Parameters.AddWithValue("@PAYMETHOD", "\"" + "not defined" + "\"");
cmd.Parameters.AddWithValue("@NOTES", "\"" + "no notes" + "\"");
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
Session.Clear();
Session.RemoveAll();
Response.Redirect("index.aspx");
}