Example #1
0
        private void dgvScadenze_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
        {
            if (_disabilitaCancellazione)
            {
                return;
            }
            int    rowIndex     = dgvODL.SelectedCells[0].RowIndex;
            string IDPRDMOVFASE = dgvODL.Rows[rowIndex].Cells[(int)Colonne.IDPRDMOVFASE].Value as string;

            using (PrioritaBusiness bPriorita = new PrioritaBusiness())
            {
                bPriorita.UpdateRW_SCADENZE(_dsPriorita);
            }
            int numeroRighe = _dsPriorita.RW_SCADENZE.Where(x => x.IDPRDMOVFASE == IDPRDMOVFASE).Count();

            AggiornaColoreRiga(rowIndex, numeroRighe > 0);
        }
Example #2
0
        private void btnInserisciScadenza_Click(object sender, EventArgs e)
        {
            if (dgvODL.SelectedCells.Count == 0)
            {
                MessageBox.Show("Selezionare un ODL", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (nmQuantita.Value == 0)
            {
                MessageBox.Show("La quantità non può essere 0", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            int rowIndex = dgvODL.SelectedCells[0].RowIndex;

            decimal quantitaDaTerminare = (decimal)dgvODL.Rows[rowIndex].Cells[(int)Colonne.QUANTITADATERMINARE].Value;

            if (quantitaDaTerminare == 0)
            {
                MessageBox.Show("La quantità da terminare dell'ODL è 0. Non ci sono articoli da pianificare.", "ATTENZIONE", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string  IDPRDMOVFASE = dgvODL.Rows[rowIndex].Cells[(int)Colonne.IDPRDMOVFASE].Value as string;
            decimal qtaODL       = (decimal)dgvODL.Rows[rowIndex].Cells[(int)Colonne.QUANTITA].Value;

            using (PrioritaBusiness bPriorita = new PrioritaBusiness())
            {
                if (VerificaCreazioneNuovaScadenza(qtaODL, IDPRDMOVFASE))
                {
                    dgvScadenze.DataSource = null;
                    PrioritaDS.RW_SCADENZERow nuovaScadenza = _dsPriorita.RW_SCADENZE.NewRW_SCADENZERow();
                    nuovaScadenza.IDSCADENZA   = bPriorita.GetID();
                    nuovaScadenza.IDPRDMOVFASE = IDPRDMOVFASE;
                    nuovaScadenza.DATA         = EstraiSoloData(dtScadenza.Value);
                    nuovaScadenza.QTA          = nmQuantita.Value;
                    _dsPriorita.RW_SCADENZE.AddRW_SCADENZERow(nuovaScadenza);
                }
                bPriorita.UpdateRW_SCADENZE(_dsPriorita);
                _dsPriorita.AcceptChanges();

                AssociaScadenze(IDPRDMOVFASE);
            }
            AggiornaColoreRiga(rowIndex, dgvScadenze.Rows.Count > 0);
        }