Пример #1
0
        private void btnDeleteProductSup_Click(object sender, EventArgs e)
        {
            TravelExpertDataContext dbContext = new TravelExpertDataContext();
            int          sup_id = Convert.ToInt32(productSupplierIdComboBox.SelectedItem);
            DialogResult answer = MessageBox.Show("Are you sure you want to delete Supplier Id: " + sup_id + "?", "Confirm", MessageBoxButtons.OKCancel);

            if (answer == DialogResult.OK)
            {
                using (TravelExpertDataContext dataContext = new TravelExpertDataContext())
                {
                    try
                    {
                        Products_Supplier selectedValue = (from m in dataContext.Products_Suppliers
                                                           where m.ProductSupplierId == sup_id
                                                           select m).Single();

                        dataContext.Products_Suppliers.DeleteOnSubmit(selectedValue);
                        dataContext.SubmitChanges();

                        productSupIds = (from m in dataContext.Products_Suppliers
                                         select m.ProductSupplierId).ToList();
                        productSupplierIdComboBox.DataSource = productSupIds;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, ex.GetType().ToString());
                    }
                }
            }
        }
Пример #2
0
 private void detach_Products_Suppliers(Products_Supplier entity)
 {
     this.SendPropertyChanging();
     entity.Supplier = null;
 }
Пример #3
0
 private void attach_Products_Suppliers(Products_Supplier entity)
 {
     this.SendPropertyChanging();
     entity.Product = this;
 }
Пример #4
0
 partial void DeleteProducts_Supplier(Products_Supplier instance);
Пример #5
0
 partial void UpdateProducts_Supplier(Products_Supplier instance);
Пример #6
0
 partial void InsertProducts_Supplier(Products_Supplier instance);