Esempio n. 1
0
        //---------------------------
        // ADD ITEM BUTTON METHODS  |
        //---------------------------
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            Item_AddForm iaf = new Item_AddForm();

            iaf.ShowDialog();
            string FromDateNoTime = iaf.FromDate.ToShortDateString();
            string ToDateNoTime   = iaf.ToDate.ToShortDateString();

            if (iaf.Cancel == false) //Meaning, will add the Item. If Cancel is true, nothing happens.
            {
                //---ADD the new Item to the ArrayList
                itemList.Add(new Item(iaf.PartNumber,
                                      iaf.ItemName,
                                      iaf.ItemDescription,
                                      double.Parse(iaf.SupplierUnitPrice),
                                      int.Parse(iaf.Markup),
                                      double.Parse(iaf.ReicUnitPrice),
                                      int.Parse(iaf.Moq),
                                      iaf.Uom,
                                      FromDateNoTime,
                                      ToDateNoTime,
                                      iaf.SupplierIDFK
                                      ));

                Item newItem = (Item)itemList[(itemList.Count - 1)]; //Casting
                sql.InsertItem(newItem);
                //---DISPLAY the newly added Item in the Main Screen DGV
                dgvItems.Rows.Add(iaf.PartNumber, iaf.ItemName, iaf.SupplierName);
            }
        }