本文整理汇总了C#中Product.GetInformation方法的典型用法代码示例。如果您正苦于以下问题:C# Product.GetInformation方法的具体用法?C# Product.GetInformation怎么用?C# Product.GetInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product.GetInformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadOrderDA
//read file
public static List<Order> ReadOrderDA()
{
List<Order> listOfOrder = new List<Order>();
if (File.Exists(path))
{
using (StreamReader sReader = new StreamReader(path))
{
String line = sReader.ReadLine();
while (line != null)
{
string[] column = line.Split(',');
string orderId = column[0];
string clientId = column[1];
string clientName = column[2];
string productId = column[3];
string productName = column[4];
int totalQty = Int32.Parse(column[5]);
double price = Double.Parse(column[6]);
string requiredDate = column[7];
string shippingDate = column[8];
string address = column[9];
string phoneNumber = column[10];
string status = column[11];
//get the client and product information by id
Client cl = new Client();
cl.ClientId = clientId;
Client clInfo = cl.GetClientInformation(cl);
Product pr = new Product();
pr.ProductId = productId;
Product prInfo = pr.GetInformation(pr);
//MessageBox.Show(prInfo.ProductName);
Order order = new Order(orderId, clInfo, prInfo, totalQty, requiredDate, shippingDate, status);
listOfOrder.Add(order);
line = sReader.ReadLine();
}
}
}
else
{
MessageBox.Show("There is no Orders.dat file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return listOfOrder;
}
示例2: comboBoxProduct_SelectedIndexChanged
private void comboBoxProduct_SelectedIndexChanged(object sender, EventArgs e)
{
//get productid
string[] column = comboBoxProduct.Text.Split('-');
string productId = column[0];
labelProductId.Text = productId;
//get productInfo
Product pd = new Product();
Book bkInfo = null;
Software sfInfo = null;
if (productId != "" && productId.Substring(0, 1) == "B")
{
pd.ProductId = productId;
bkInfo = (Book)pd.GetInformation(pd);
textBoxPrice.Text = bkInfo.UnitPrice.ToString();
textBoxIsbn.Text = bkInfo.Isbn;
textBoxPublisher.Text = bkInfo.Publisher;
textBoxYear.Text = bkInfo.YearPublished;
textBoxAuthor.Text = bkInfo.Author.LastName + "," + bkInfo.Author.FirstName;
labelProductName.Text = bkInfo.ProductName;
}
if (productId != "" && productId.Substring(0, 1) == "S")
{
pd.ProductId = productId;
sfInfo = (Software)pd.GetInformation(pd);
textBoxPrice.Text = sfInfo.UnitPrice.ToString();
textBoxIsbn.Text = sfInfo.Isbn;
textBoxPublisher.Text = sfInfo.Publisher;
textBoxPlatform.Text = sfInfo.Platform;
labelProductName.Text = sfInfo.ProductName;
}
//set qty =0
textBoxQty.Text = "0";
}