private void btnCreaListino_Click(object sender, EventArgs e) { txtMessaggio.Text = string.Empty; if (ddlAziende.SelectedIndex == -1) { txtMessaggio.Text = "Selezionare un'azienda"; return; } try { if (string.IsNullOrEmpty(txtNomeTerzista.Text)) { txtMessaggio.Text = "Inserisci il terzista di destinazione"; return; } if (string.IsNullOrEmpty(txtAnagContLavoro.Text)) { txtMessaggio.Text = "Inserire un codice Anagrafica"; return; } if (string.IsNullOrEmpty(ddlTaskContoLavoro.Text)) { txtMessaggio.Text = "Inserisci il task da eseguire"; return; } string azienda = (string)ddlAziende.SelectedItem; BCServices bc = new BCServices(); bc.CreaConnessione(azienda); StringBuilder sb = new StringBuilder(); bc.CreaListino(txtAnagContLavoro.Text, txtNomeTerzista.Text, ddlTaskContoLavoro.Text, dtInizioListinoContoLav.Value, dtFineListinoContoLav.Value, nCostoListino.Value); txtMessaggio.Text = "Listino Creato Correttamente"; } catch (Exception ex) { txtMessaggio.Text = estraiErrore(ex); } }