private bool CaricaODL(string barcode, decimal colli) { if (string.IsNullOrEmpty(barcode)) { return(false); } using (TrasferimentiBusiness bTrasferimenti = new TrasferimentiBusiness()) { if (!_ds.USR_PRD_MOVFASI.Any(x => x.BARCODE == barcode)) { bTrasferimenti.FillUSR_PRD_MOVFASI(_ds, barcode); } TrasferimentiDS.USR_PRD_MOVFASIRow odl = _ds.USR_PRD_MOVFASI.Where(x => x.BARCODE == barcode).FirstOrDefault(); if (odl == null) { lblMessaggi.Text = "BARCODE NON TROVATO"; return(false); } AnagraficaDS.MAGAZZRow articolo = _anagrafica.GetMAGAZZ(odl.IDMAGAZZ); DataTable dtGriglia = _dsGriglia.Tables[_tabellaGriglia]; DataRow riga = dtGriglia.NewRow(); riga[(int)colonneGriglia.BARCODE] = odl.IsBARCODENull() ? string.Empty : odl.BARCODE; riga[(int)colonneGriglia.MODELLO] = articolo == null ? string.Empty : articolo.MODELLO; riga[(int)colonneGriglia.NUMMOVFASE] = odl.IsNUMMOVFASENull() ? string.Empty : odl.NUMMOVFASE; riga[(int)colonneGriglia.REPARTO] = odl.IsCODICECLIFODESTNull() ? string.Empty : odl.CODICECLIFODEST; riga[(int)colonneGriglia.QUANTITA] = odl.QTA; riga[(int)colonneGriglia.COLLI] = colli; dtGriglia.Rows.Add(riga); } return(true); }
private void button1_Click(object sender, EventArgs e) { if (nQuantita.Value == 0) { MessageBox.Show("Indicare LA QUANTITà ", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Spedizioni sp = new Spedizioni(); lblEsito.Text = String.Empty; if (string.IsNullOrEmpty(txtUbicazione.Text)) { MessageBox.Show("Indicare l'ubicazione", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } txtUbicazione.Text = txtUbicazione.Text.ToUpper(); txtarticolo.Text = txtarticolo.Text.ToUpper(); txtCausale.Text = txtCausale.Text.ToUpper(); SpedizioniDS.SPUBICAZIONIRow ubicazione = _ds.SPUBICAZIONI.Where(x => x.CODICE == txtUbicazione.Text).FirstOrDefault(); if (ubicazione == null) { MessageBox.Show("Ubicazione inesistente", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(txtarticolo.Text)) { MessageBox.Show("Indicare l'articolo", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } sp.FillMagazz(_ds, txtarticolo.Text); if (_ds.MAGAZZ.Count == 0) { MessageBox.Show("Impossibile trovare l'articolo", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_ds.MAGAZZ.Count > 1) { MessageBox.Show("Più articoli trovati con questa descrizione. Filtrare i dati", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SpedizioniDS.MAGAZZRow articolo = _ds.MAGAZZ.Where(x => x.MODELLO == txtarticolo.Text).FirstOrDefault(); Anagrafica anagrafica = new Anagrafica(); AnagraficaDS.MAGAZZRow art = anagrafica.GetMAGAZZ(articolo.IDMAGAZZ); if (!sp.Inserimento(ubicazione, art, nQuantita.Value, txtCausale.Text, _utenteConnesso)) { MessageBox.Show("OPERAZIONE FALLITA errore nel salvataggio", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } lblEsito.Text = "OPERAZIONE RIUSCITA"; nQuantita.Value = 0; }