Exemplo n.º 1
0
        public void drawPants(Product p)
        {
            Pants pants = (Pants)p;

            drawSet(true, true, true, true, true, false, false, false);
            drawApparel(p);
            lblVar4.Text = "Waist";
            txtVar4.Text = pants.Waist.ToString();
            lblVar5.Text = "Inseam";
            txtVar5.Text = pants.Inseam.ToString();
        }
Exemplo n.º 2
0
        public static Pants SelectPants(string id)
        {
            Pants p = null;

            OleDbConnection connection = GetConnection();

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

            OleDbCommand command = new OleDbCommand(select, connection);

            try
            {
                connection.Open();
                OleDbDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    p              = new Pants();
                    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.Waist        = reader.GetInt32(8);
                    p.Inseam       = reader.GetInt32(9);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                p = null;
            }
            finally
            {
                connection.Close();
            }

            return(p);
        }