Пример #1
0
        /*************************/
        /* Supplier CRUD Buttons */
        /*************************/
        // ADD
        private void btnAddSupplier_Click(object sender, EventArgs e)
        {
            DialogResult result = DialogResult.Cancel;

            frmAddEditSupplier frmAddSup = new frmAddEditSupplier();

            frmAddSup.isNewSupplier = true;
            result = frmAddSup.ShowDialog();

            if (result == DialogResult.OK)
            {
                DisplaySuppliers();
            }
        }
Пример #2
0
        // EDIT
        private void btnEditSupplier_Click(object sender, EventArgs e)
        {
            DialogResult result = DialogResult.Cancel;

            frmAddEditSupplier frmEditSup = new frmAddEditSupplier();

            frmEditSup.isNewSupplier = false;
            int rowNum = Convert.ToInt32(dgvSupplier.CurrentCell.RowIndex);
            int suppID = Convert.ToInt32(dgvSupplier["dataGridViewTextBoxColumn1", rowNum].Value);

            using (TravelExpertDataDataContext dbContext = new TravelExpertDataDataContext())
            {
                frmEditSup.currentSupplier = (from supp in dbContext.Suppliers
                                              where supp.SupplierId == suppID
                                              select supp).Single();
            }
            result = frmEditSup.ShowDialog();

            if (result == DialogResult.OK)
            {
                DisplaySuppliers();
            }
        }