示例#1
0
        //---------------------------
        // ADD ITEM BUTTON METHODS  |
        //---------------------------
        private void btnAddSupplier_Click(object sender, EventArgs e)
        {
            Supplier_AddForm saf = new Supplier_AddForm();

            saf.ShowDialog();

            if (saf.Cancel == false)
            {
                supplierList.Add(new Supplier(
                                     supplierIDCounter,
                                     saf.SupplierName,
                                     saf.SupplierPerson,
                                     saf.SupplierNumber,
                                     saf.SupplierEmail,
                                     saf.SupplierAddress));

                dgvSuppliers.Rows.Add(saf.SupplierName, saf.SupplierPerson, saf.SupplierNumber);

                Supplier newSupplier = (Supplier)supplierList[(supplierList.Count - 1)]; //Casting
                sql.InsertSupplier(newSupplier);

                supplierIDCounter++;
            }
        }