예제 #1
0
        public void CancellaCampioni(string Id, string Codice, string Finitura)
        {
            MagazzinoDS ds = new MagazzinoDS();

            using (MagazzinoBusiness bMagazzino = new MagazzinoBusiness())
            {
                bMagazzino.FillRW_MAGAZZINO_CAMPIONI(ds);
                MagazzinoDS.RW_MAGAZZINO_CAMPIONIRow elemento = null;
                if (!string.IsNullOrEmpty(Id))
                {
                    decimal id = decimal.Parse(Id);
                    elemento = ds.RW_MAGAZZINO_CAMPIONI.Where(x => x.IDMAGAZCAMP == id).FirstOrDefault();
                    if (elemento == null)
                    {
                        throw new ArgumentException(string.Format("IDMAGAZCAMP non trovato il valore {0} impossibile salvare", Id));
                    }
                    elemento.Delete();
                }
                bMagazzino.UpdateRW_MAGAZZINO_CAMPIONI(ds);
            }
        }
예제 #2
0
        public void SalvaCampioni(string Id, string Codice, string Finitura, string Piano, string Posizione, string Descrizione, string User)
        {
            MagazzinoDS ds = new MagazzinoDS();

            using (MagazzinoBusiness bMagazzino = new MagazzinoBusiness())
            {
                bMagazzino.FillRW_MAGAZZINO_CAMPIONI(ds);
                MagazzinoDS.RW_MAGAZZINO_CAMPIONIRow elemento = null;
                if (string.IsNullOrEmpty(Id))
                {
                    elemento                 = ds.RW_MAGAZZINO_CAMPIONI.NewRW_MAGAZZINO_CAMPIONIRow();
                    elemento.CODICE          = Codice;
                    elemento.FINITURA        = Finitura;
                    elemento.PIANO           = Piano;
                    elemento.POSIZIONE       = Posizione;
                    elemento.DESCRIZIONE     = Descrizione;
                    elemento.UTENTE          = User;
                    elemento.DATAINSERIMENTO = DateTime.Now;
                    ds.RW_MAGAZZINO_CAMPIONI.AddRW_MAGAZZINO_CAMPIONIRow(elemento);
                }
                else
                {
                    decimal id = decimal.Parse(Id);
                    elemento = ds.RW_MAGAZZINO_CAMPIONI.Where(x => x.IDMAGAZCAMP == id).FirstOrDefault();
                    if (elemento == null)
                    {
                        throw new ArgumentException(string.Format("IDMAGAZCAMP non trovato il valore {0} impossibile salvare", Id));
                    }
                    elemento.CODICE          = Codice;
                    elemento.FINITURA        = Finitura;
                    elemento.PIANO           = Piano;
                    elemento.POSIZIONE       = Posizione;
                    elemento.DESCRIZIONE     = Descrizione;
                    elemento.UTENTE          = User;
                    elemento.DATAINSERIMENTO = DateTime.Now;
                }
                bMagazzino.UpdateRW_MAGAZZINO_CAMPIONI(ds);
            }
        }