コード例 #1
0
        private void btnModProdSup_Click(object sender, EventArgs e)
        {
            frmAddModifyProdSuppltbl secondform = new frmAddModifyProdSuppltbl();

            secondform.isModify = true;
            int prodId  = Convert.ToInt32(productIdTextBox.Text);
            int supplId = Convert.ToInt32(supplierIdTextBox.Text);

            using (TravelExpertDataContext dataContext = new TravelExpertDataContext())
            {
                secondform.activeProdSuppId = (from m in dataContext.Products_Suppliers
                                               where m.ProductId == prodId && m.SupplierId == supplId
                                               select m).Single();
            }
            DialogResult result = secondform.ShowDialog();

            using (TravelExpertDataContext dataContext = new TravelExpertDataContext()) // refresh the grid
            {
                if (result == DialogResult.OK)
                {
                    productSupIds = (from m in dataContext.Products_Suppliers
                                     select m.ProductSupplierId).ToList();
                    productSupplierIdComboBox.DataSource = productSupIds;
                }
            }
        }
コード例 #2
0
        private void btnAddProdSup_Click(object sender, EventArgs e)
        {
            frmAddModifyProdSuppltbl secondform = new frmAddModifyProdSuppltbl();
            DialogResult             result     = secondform.ShowDialog();

            using (TravelExpertDataContext dataContext = new TravelExpertDataContext()) // refresh the grid
            {
                if (result == DialogResult.OK)
                {
                    productSupIds = (from m in dataContext.Products_Suppliers
                                     select m.ProductSupplierId).ToList();
                    productSupplierIdComboBox.DataSource = productSupIds;
                }
            }
        }