Esempio n. 1
0
        public List <PosizioneCampionarioModel> TrovaPosizioneCampionario(string Campione, string Seriale, string Posizione, string Cliente)
        {
            List <PosizioneCampionarioModel> model = new List <PosizioneCampionarioModel>();

            using (MagazzinoBusiness bMagazzino = new MagazzinoBusiness())
            {
                MagazzinoDS ds = new MagazzinoDS();
                bMagazzino.FillRW_POSIZIONE_CAMPIONI(ds);

                List <MagazzinoDS.RW_POSIZIONE_CAMPIONIRow> elementi = ds.RW_POSIZIONE_CAMPIONI.ToList();
                if (!string.IsNullOrEmpty(Campione))
                {
                    elementi = elementi.Where(x => x.CAMPIONE.Contains(Campione)).ToList();
                }

                if (!string.IsNullOrEmpty(Cliente))
                {
                    elementi = elementi.Where(x => !x.IsCLIENTENull() && x.CLIENTE.Contains(Cliente)).ToList();
                }

                if (!string.IsNullOrEmpty(Posizione))
                {
                    elementi = elementi.Where(x => x.POSIZIONE.Contains(Posizione)).ToList();
                }

                if (!string.IsNullOrEmpty(Seriale))
                {
                    elementi = elementi.Where(x => x.SERIALE.Contains(Seriale)).ToList();
                }

                foreach (MagazzinoDS.RW_POSIZIONE_CAMPIONIRow posizione in elementi)
                {
                    PosizioneCampionarioModel m = new PosizioneCampionarioModel()
                    {
                        Campione    = posizione.CAMPIONE,
                        Cliente     = posizione.IsCLIENTENull() ? string.Empty : posizione.CLIENTE,
                        Seriale     = posizione.SERIALE,
                        Posizione   = posizione.POSIZIONE.Trim(),
                        Progressivo = posizione.IsPROGRESSIVONull() ? -1 : posizione.PROGRESSIVO,
                        IDPOSIZCAMP = posizione.IDPOSIZCAMP
                    };

                    model.Add(m);
                }
            }

            return(model);
        }
Esempio n. 2
0
        public void CancellaPosizioneCampioni(string Id, string Seriale, string Cliente)
        {
            MagazzinoDS ds = new MagazzinoDS();

            using (MagazzinoBusiness bMagazzino = new MagazzinoBusiness())
            {
                bMagazzino.FillRW_POSIZIONE_CAMPIONI(ds);
                MagazzinoDS.RW_POSIZIONE_CAMPIONIRow elemento = null;
                if (!string.IsNullOrEmpty(Id))
                {
                    decimal id = decimal.Parse(Id);
                    elemento = ds.RW_POSIZIONE_CAMPIONI.Where(x => x.IDPOSIZCAMP == id).FirstOrDefault();
                    if (elemento == null)
                    {
                        throw new ArgumentException(string.Format("IDPOSIZCAMP non trovato il valore {0} impossibile salvare", Id));
                    }
                    elemento.Delete();
                }
                bMagazzino.UpdateRW_POSIZIONE_CAMPIONI(ds);
            }
        }
Esempio n. 3
0
        public void SalvaPosizioneCampioni(string Id, string Campione, string Posizione, decimal Progressivo, string Seriale, string Cliente, string User)
        {
            MagazzinoDS ds = new MagazzinoDS();

            using (MagazzinoBusiness bMagazzino = new MagazzinoBusiness())
            {
                bMagazzino.FillRW_POSIZIONE_CAMPIONI(ds);
                MagazzinoDS.RW_POSIZIONE_CAMPIONIRow elemento = null;
                if (string.IsNullOrEmpty(Id))
                {
                    elemento                 = ds.RW_POSIZIONE_CAMPIONI.NewRW_POSIZIONE_CAMPIONIRow();
                    elemento.CAMPIONE        = Campione;
                    elemento.POSIZIONE       = Posizione;
                    elemento.PROGRESSIVO     = Progressivo;
                    elemento.SERIALE         = Seriale;
                    elemento.CLIENTE         = Cliente;
                    elemento.UTENTE          = User;
                    elemento.DATAINSERIMENTO = DateTime.Now;
                    ds.RW_POSIZIONE_CAMPIONI.AddRW_POSIZIONE_CAMPIONIRow(elemento);
                }
                else
                {
                    decimal id = decimal.Parse(Id);
                    elemento = ds.RW_POSIZIONE_CAMPIONI.Where(x => x.IDPOSIZCAMP == id).FirstOrDefault();
                    if (elemento == null)
                    {
                        throw new ArgumentException(string.Format("IDPOSIZCAMP non trovato il valore {0} impossibile salvare", Id));
                    }
                    elemento.CAMPIONE        = Campione;
                    elemento.POSIZIONE       = Posizione;
                    elemento.PROGRESSIVO     = Progressivo;
                    elemento.SERIALE         = Seriale;
                    elemento.CLIENTE         = Cliente;
                    elemento.UTENTE          = User;
                    elemento.DATAINSERIMENTO = DateTime.Now;
                }
                bMagazzino.UpdateRW_POSIZIONE_CAMPIONI(ds);
            }
        }