Esempio n. 1
0
        public List <Product> GetSSShirts(int id)
        {
            List <Product> list    = new List <Product>();
            var            conn    = GetConnection();
            string         sql     = String.Format("SELECT SSShirt.* FROM SSShirt where ProductId = {0};", id);
            OleDbCommand   command = new OleDbCommand(sql, connection);

            try
            {
                conn.Open();
                using (OleDbDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Product p = new SSShirt(Convert.ToDouble(reader["Neck"]));
                        p.Quantity   = Convert.ToInt16(reader["Quantity"]);
                        p.Dbquantity = Convert.ToInt16(reader["Quantity"]);
                        Console.WriteLine(p.ToString());
                        list.Add(p);
                    }
                }
                conn.Close();
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(list);
        }
Esempio n. 2
0
        private void buttonOrder_Click(object sender, EventArgs e)
        {
            if (list.products.Count > 0)
            {
                bool flag  = db.InsertLineItem(invoice);
                bool flag1 = db.InsertInvoice(invoice);

                foreach (var p in list.products)
                {
                    if (p.Type == "TeeShirt")
                    {
                        TeeShirt t           = (TeeShirt)p;
                        int      newQuantity = t.Dbquantity - t.Quantity;
                        db.UpdateTeeShirtQty(newQuantity, t.Size, t.Id);
                    }
                    if (p.Type == "Pants")
                    {
                        Pants t           = (Pants)p;
                        int   newQuantity = t.Dbquantity - t.Quantity;
                        db.UpdatePantsQty(newQuantity, t.Inseam, t.Waist, t.Id);
                    }
                    if (p.Type == "LSShirts")
                    {
                        LSShirt t           = (LSShirt)p;
                        int     newQuantity = t.Dbquantity - t.Quantity;
                        db.UpdateLSSQty(newQuantity, t.Neck, t.Sleeve, t.Id);
                    }
                    if (p.Type == "Shorts")
                    {
                        Shorts t           = (Shorts)p;
                        int    newQuantity = t.Dbquantity - t.Quantity;
                        db.UpdateShortsQty(newQuantity, t.Waist, t.Id);
                    }
                    if (p.Type == "SSShirt")
                    {
                        SSShirt t           = (SSShirt)p;
                        int     newQuantity = t.Dbquantity - t.Quantity;
                        db.UpdateSSShirtQty(newQuantity, t.Neck, t.Id);
                    }
                }

                if (flag && flag1)
                {
                    detailsBox.Text = "Thanks for your order.";
                    list.products.Clear();
                }
                else
                {
                    MessageBox.Show("Error in saving to file!");
                }
                invoice = new Invoice(list);
            }
        }
Esempio n. 3
0
 public TeeShirt(SSShirt toCopy) : base(toCopy)
 {
     this.Copy(toCopy);
 }
Esempio n. 4
0
 public void Copy(SSShirt toCopy)
 {
     base.Copy(toCopy);
     this.neck = toCopy.neck;
 }