本文整理汇总了C#中Category.getCategoryProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Category.getCategoryProperties方法的具体用法?C# Category.getCategoryProperties怎么用?C# Category.getCategoryProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.getCategoryProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnAddProduct_Click
/// <summary>
/// adding a new product
/// </summary>
protected void btnAddProduct_Click(object sender, EventArgs e)
{
try
{
int counter = 1;
Category c = new Category();
properties = c.getCategoryProperties(categories[categoriesNamesDDL.SelectedValue.ToString()]);
propertiesOfCategory = new Dictionary<int, string>();
foreach (KeyValuePair<string, int> pair in properties)//getting the propery id and its description
{
TextBox tb = Page.FindControl("txProperty" + counter) as TextBox;
if (tb != null)
{
string property = tb.Text;
ProductProperty productProp = new ProductProperty();
productProp.Description = property;
Property pr = new Property();
pr.Name = pair.Key;
propertiesOfCategory.Add(properties[pr.Name], productProp.Description);
}
counter++;
}
Product product = new Product();
product.Id = Convert.ToInt32(productIdTB.Text);
product.Name = productNameTB.Text;
product.Description = productDescriptionTB.Text;
DateTime currentTime = DateTime.Now;
product.DateModified = currentTime;
InsertPictureToDirectory();
product.ImageUrl = ProductpicPath;
product.Price = Convert.ToDouble(ProductPriceTB.Text);
if (discountTB.Text == "") { }
else
product.Discount = discountTB.Text;
int numOfRows = product.insertNewProduct(product, categories[categoriesNamesDDL.SelectedValue.ToString()], propertiesOfCategory, "Email");
if (numOfRows > 0)//מוציא הודעה האם המוצר הוכנס כמו שצריך
{
ProductInsertedName.InnerHtml = product.Name;
Session.Add("numOfRows", numOfRows);
Session.Add("product", product);
Response.Redirect("CatalogManager.aspx");
}
}
catch (Exception)
{
}
}
示例2: editCategoryCategoriesDDL_SelectedIndexChanged
/// <summary>
/// insert the updateCategory properties to the table
/// </summary>
protected void editCategoryCategoriesDDL_SelectedIndexChanged(object sender, EventArgs e)
{
EditCategoryPropTable.Controls.Clear();
Category c = new Category();
properties = new Dictionary<string, int>();
if (editCategoryCategoriesDDL.SelectedValue.ToString() != "בחר")
{
properties = c.getCategoryProperties(categories[editCategoryCategoriesDDL.SelectedValue.ToString()]);
foreach (KeyValuePair<string, int> pair in properties)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tc = new HtmlTableCell();
HtmlTableCell tc1 = new HtmlTableCell();
Button btn = new Button();
Button btn1 = new Button();
btn.Text = "עריכה";
btn.OnClientClick = "updateRowInEditCategory()";
btn1.OnClientClick = "deleteRow()";
btn1.Text = "הסרה";
tc1.Controls.Add(btn);
tc1.Controls.Add(btn1);
tr.Attributes.Add("Class", "odd gradeX");
tc.InnerHtml = pair.Key;
tr.Controls.Add(tc);
tr.Controls.Add(tc1);
EditCategoryPropTable.Controls.Add(tr);
}
}
}
示例3: insertCategoryProperties
/// <summary>
/// insert the category properties to the addProduct form
/// </summary>
protected void insertCategoryProperties()
{
Category c = new Category();
properties = new Dictionary<string, int>();
if (categoriesNamesDDL.SelectedValue.ToString() != "בחר")
{
properties = c.getCategoryProperties(categories[categoriesNamesDDL.SelectedValue.ToString()]);
HtmlTable tb = new HtmlTable();
tb.Style.Add("text-align", "right");
tb.Attributes.Add("runat", "Server");
tb.ID = "propertiesTable";
int counter = 1;
foreach (KeyValuePair<string, int> pair in properties)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tc = new HtmlTableCell("th");
Label l = new Label();
l.Text = pair.Key;
HtmlTableCell tc1 = new HtmlTableCell();
TextBox tx = new TextBox();
tx.ID = "txProperty" + counter;
tx.CssClass = "text";
tc.Controls.Add(l);
tc1.Controls.Add(tx);
tr.Controls.Add(tc);
tr.Controls.Add(tc1);
tb.Controls.Add(tr);
counter++;
}
propertiesAddPH.Controls.Add(tb);
}
else
{
propertiesAddPH.Controls.Clear();
}
}