当前位置: 首页>>代码示例>>C#>>正文


C# Product.GetInformation方法代码示例

本文整理汇总了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;
        }
开发者ID:mrmontreal,项目名称:works,代码行数:45,代码来源:OrderDataMangement.cs

示例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";
        }
开发者ID:mrmontreal,项目名称:works,代码行数:36,代码来源:FormAddOrder.cs


注:本文中的Product.GetInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。