private void detach_ORDINE(ORDINE entity) { this.SendPropertyChanging(); entity.CLIENTE = null; }
// Query V1 e V2 per l'inserimento di un ordine. private void queryV1V2() { ORDINE ordine = new ORDINE { data = System.DateTime.Now, DIPENDENTE = (DIPENDENTE)this.comboBoxCODfiscale.SelectedValue, prezzo = 0 }; if (this.radioButtonVendita.Checked == true) { // Query V1: Aggiunta di un nuovo ordine di vendita. ordine.tipo = "vendita"; ordine.CLIENTE = (CLIENTE)this.comboBoxIDCliente.SelectedValue; } else { // Query V2: Aggiunta di un nuovo ordine di acquisto. ordine.tipo = "acquisto"; ordine.FORNITORE = (FORNITORE)this.comboBoxIDFornitore.SelectedValue; } // inserimento nel database db.ORDINE.InsertOnSubmit(ordine); try { db.SubmitChanges(); } catch (System.Data.Linq.DuplicateKeyException e) { db.ORDINE.DeleteOnSubmit(ordine); db.SubmitChanges(); MessageBox.Show("Hai già inserito questo ordine"); } catch (Exception e) { db.ORDINE.DeleteOnSubmit(ordine); db.SubmitChanges(); MessageBox.Show(e.GetType().ToString()); } // avvio la form per l'inserimento dei dettagli d'ordine relativi a questo ordine DettaglioOrdine dettaglio = new DettaglioOrdine(ordine); dettaglio.Activate(); dettaglio.Show(); }
partial void DeleteORDINE(ORDINE instance);
private void attach_ORDINE(ORDINE entity) { this.SendPropertyChanging(); entity.CLIENTE = this; }
partial void UpdateORDINE(ORDINE instance);
partial void InsertORDINE(ORDINE instance);
private void detach_ORDINE(ORDINE entity) { this.SendPropertyChanging(); entity.FORNITORE = null; }
private void attach_ORDINE(ORDINE entity) { this.SendPropertyChanging(); entity.FORNITORE = this; }
public DettaglioOrdine(ORDINE IDordine) { InitializeComponent(); this.ordine = IDordine; }