本文整理汇总了C#中Product.SearchInformation方法的典型用法代码示例。如果您正苦于以下问题:C# Product.SearchInformation方法的具体用法?C# Product.SearchInformation怎么用?C# Product.SearchInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product.SearchInformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
bool valid = false;
if (Validator.IsNumeric(textBoxCheck))
{
//calulate total quantity
if (radioButtonCheckin.Checked)
{
total = Int32.Parse(textBoxCheck.Text) + Int32.Parse(textBoxQoh.Text);
valid = true;
}
else if (radioButtonCheckout.Checked)
{
int qoh=Int32.Parse(textBoxQoh.Text);
int checkout=Int32.Parse(textBoxCheck.Text);
if (qoh>=checkout)
{
total = qoh - checkout;
valid = true;
}
else
{
MessageBox.Show("Quantity On Hand is not enough to checkout.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
if (valid)
{
//update product quantity
List<Product> listOfProduct = null;
if (comboBoxType.Text == "Book")
{
Product searchProduct = new Product("", comboBoxName.Text, 0, "", "", "");
listOfProduct = searchProduct.SearchInformation(searchProduct);
foreach (var item in listOfProduct)
{
if (item.ProductId.Substring(0, 1) == "B")
{
Product newItem = item;
newItem.Qoh = total;
newItem.UpdateInformation(item,newItem);
textBoxQoh.Text = total.ToString();
textBoxCheck.Text = "";
}
}
}
else if (comboBoxType.Text == "Software")
{
Product searchProduct = new Product("", comboBoxName.Text, 0, "", "", "");
listOfProduct = searchProduct.SearchInformation(searchProduct);
foreach (var item in listOfProduct)
{
if (item.ProductId.Substring(0, 1) == "S")
{
Product newItem = item;
newItem.Qoh = total;
newItem.UpdateInformation(item, newItem);
textBoxQoh.Text = total.ToString();
textBoxCheck.Text = "";
}
}
}
}
}
}
示例2: comboBoxName_SelectedIndexChanged
private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e)
{
//read qoh from a product
textBoxQoh.Text = "";
List<Product> listOfProduct=null;
if (comboBoxType.Text == "Book")
{
Product searchProduct = new Product("", comboBoxName.Text, 0, "", "", "");
listOfProduct = searchProduct.SearchInformation(searchProduct);
foreach (var item in listOfProduct)
{
if (item.ProductId.Substring(0, 1) == "B")
{
textBoxQoh.Text = item.Qoh.ToString();
}
}
}
else if (comboBoxType.Text == "Software")
{
Product searchProduct = new Product("", comboBoxName.Text, 0, "", "", "");
listOfProduct = searchProduct.SearchInformation(searchProduct);
foreach (var item in listOfProduct)
{
if (item.ProductId.Substring(0, 1) == "S")
{
textBoxQoh.Text = item.Qoh.ToString();
}
}
}
}