Example #1
0
        public string CreaManutentore(string NomeCognome, string Account, decimal IdDitta, string Nota, string account)
        {
            string nomeCognome = correggiString(NomeCognome, 45);
            string utente      = correggiString(Account, 45);
            string nota        = correggiString(Nota, 100);

            using (ManutezioneBusiness bManutenzione = new ManutezioneBusiness())
            {
                bManutenzione.FillManutentori(_ds, false);

                if (_ds.MANUTENTORI.Any(x => x.NOMECOGNOME.Trim() == nomeCognome))
                {
                    return("Manutentore giĆ  inserito a sistema");
                }

                ManutenzioneDS.MANUTENTORIRow manutentore = _ds.MANUTENTORI.NewMANUTENTORIRow();

                manutentore.CANCELLATO     = SiNo.No;
                manutentore.DATAMODIFICA   = DateTime.Now;
                manutentore.UTENTEMODIFICA = account;
                manutentore.NOMECOGNOME    = nomeCognome;
                manutentore.ACCOUNT        = utente;
                manutentore.IDDITTA        = IdDitta;
                manutentore.NOTA           = nota;

                _ds.MANUTENTORI.AddMANUTENTORIRow(manutentore);

                bManutenzione.UpdateTable(_ds.MANUTENTORI.TableName, _ds);
            }
            return(string.Empty);
        }
Example #2
0
        private ManutentoreModel CreaManutentoreModel(ManutenzioneDS.MANUTENTORIRow manutentore, ManutenzioneDS ds)
        {
            ManutentoreModel dm = new ManutentoreModel();

            dm.IdManutentore = manutentore.IDMANUTENTORE;
            dm.NomeCognome   = manutentore.NOMECOGNOME;
            dm.Account       = manutentore.IsACCOUNTNull() ? string.Empty : manutentore.ACCOUNT;
            dm.Nota          = manutentore.IsNOTANull() ? string.Empty : manutentore.NOTA;

            ManutenzioneDS.DITTERow ditta = _ds.DITTE.Where(x => x.IDDITTA == manutentore.IDDITTA).FirstOrDefault();
            dm.Ditta = CreaDittaModel(ditta, _ds);

            RiferimentoModelContainer rmc = new RiferimentoModelContainer();

            dm.Riferimenti = rmc;

            rmc.TabellaEsterna = TabelleEsterne.Manutentori;
            rmc.IdEsterna      = manutentore.IDMANUTENTORE;
            rmc.Riferimenti    = new List <RiferimentoModel>();

            foreach (ManutenzioneDS.RIFERIMENTIRow riferimento in ds.RIFERIMENTI.Where(x => x.IDESTERNA == manutentore.IDMANUTENTORE && x.TABELLAESTERNA == TabelleEsterne.Manutentori))
            {
                rmc.Riferimenti.Add(CreaRiferimentoModel(riferimento));
            }

            return(dm);
        }
Example #3
0
        private ManutentoreModel CreaManutentoreModel(decimal idManutentore, ManutenzioneDS ds)
        {
            ManutenzioneDS.MANUTENTORIRow manutentore = ds.MANUTENTORI.Where(x => x.IDMANUTENTORE == idManutentore).FirstOrDefault();
            if (manutentore == null)
            {
                return(null);
            }

            return(CreaManutentoreModel(manutentore, ds));
        }
Example #4
0
        public void CancellaManutentore(decimal IdManutentore, string account)
        {
            using (ManutezioneBusiness bManutenzione = new ManutezioneBusiness())
            {
                bManutenzione.FillManutentori(_ds, true);
                ManutenzioneDS.MANUTENTORIRow manutentore = _ds.MANUTENTORI.Where(x => x.IDMANUTENTORE == IdManutentore).FirstOrDefault();
                if (manutentore != null)
                {
                    manutentore.CANCELLATO     = SiNo.Si;
                    manutentore.DATAMODIFICA   = DateTime.Now;
                    manutentore.UTENTEMODIFICA = account;

                    bManutenzione.UpdateTable(_ds.MANUTENTORI.TableName, _ds);
                }
            }
        }
Example #5
0
        public void ModificaManutentore(decimal IdManutentore, string utente, string nota, string account)
        {
            using (ManutezioneBusiness bManutenzione = new ManutezioneBusiness())
            {
                bManutenzione.FillManutentori(_ds, true);
                ManutenzioneDS.MANUTENTORIRow manutentore = _ds.MANUTENTORI.Where(x => x.IDMANUTENTORE == IdManutentore).FirstOrDefault();
                if (manutentore != null)
                {
                    manutentore.ACCOUNT = correggiString(utente, 45);;
                    manutentore.NOTA    = correggiString(nota, 100);

                    manutentore.DATAMODIFICA   = DateTime.Now;
                    manutentore.UTENTEMODIFICA = account;

                    bManutenzione.UpdateTable(_ds.MANUTENTORI.TableName, _ds);
                }
            }
        }