private void btnCreaOdP_Click(object sender, EventArgs e) { txtMessaggio.Text = string.Empty; if (ddlAziende.SelectedIndex == -1) { txtMessaggio.Text = "Selezionare un'azienda"; return; } try { if (string.IsNullOrEmpty(txtAnagraficaOdP.Text)) { txtMessaggio.Text = "Inserire un codice Anagrafica"; return; } if (string.IsNullOrEmpty(txtLocationOdP.Text)) { txtMessaggio.Text = "Inserire una ubicazione"; return; } string azienda = (string)ddlAziende.SelectedItem; BCServices bc = new BCServices(); bc.CreaConnessione(azienda); bc.CreaOdDPConfermato(txtAnagraficaOdP.Text, dtScadenzaOdP.Value, nQuntitàOdP.Value, txtLocationOdP.Text, txtDescrizioneOdP.Text, txtDescrizione2.Text); txtMessaggio.Text = "Ordine Crato Correttamente"; } catch (Exception ex) { txtMessaggio.Text = estraiErrore(ex); } }