Exemplo n.º 1
0
        public void drawDressShirt(Product p)
        {
            DressShirt dressS = (DressShirt)p;

            drawSet(true, true, true, true, true, false, false, false);
            drawApparel(p);
            lblVar4.Text = "Neck";
            txtVar4.Text = dressS.Neck.ToString();
            lblVar5.Text = "Sleeve";
            txtVar5.Text = dressS.Sleeve.ToString();
        }
Exemplo n.º 2
0
        public static DressShirt SelectDressShirt(string id)
        {
            DressShirt p = null;

            OleDbConnection connection = GetConnection();

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

            OleDbCommand command = new OleDbCommand(select, connection);

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

            return(p);
        }