示例#1
0
        public void drawTShirt(Product p)
        {
            TShirt t = (TShirt)p;

            drawSet(true, true, true, true, false, false, false, false);
            drawApparel(p);
            lblVar4.Text = "Size";
            txtVar4.Text = t.Size;
        }
示例#2
0
        public static TShirt SelectTShirt(string id)
        {
            TShirt p = null;

            OleDbConnection connection = GetConnection();

            string select = "SELECT Product.ID, Product.Desc, Product.Price, "
                            + "Product.Qty, Product.Type, Apparel.Material, Apparel.Color, Apparel.Manufacturer, "
                            + "TShirt.SizeT FROM (Product INNER JOIN Apparel ON Product.ID = Apparel.ID)"
                            + "INNER JOIN TShirt ON Apparel.ID = TShirt.ID WHERE Product.ID = '" + id + "';";

            OleDbCommand command = new OleDbCommand(select, connection);

            try
            {
                connection.Open();
                OleDbDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    p              = new TShirt();
                    p.ID           = reader.GetString(0);
                    p.Desc         = reader.GetString(1);
                    p.Price        = reader.GetDouble(2);
                    p.Qty          = reader.GetInt32(3);
                    p.Type         = reader.GetString(4);
                    p.Material     = reader.GetString(5);
                    p.Color        = reader.GetString(6);
                    p.Manufacturer = reader.GetString(7);
                    p.Size         = reader.GetString(8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                p = null;
            }
            finally
            {
                connection.Close();
            }

            return(p);
        }