Exemple #1
0
        public void ModificaInCompletatoCalendarioEvento(decimal idTrasferimento, EnumFunzioniEventi fe)
        {
            decimal funzEv = (decimal)fe;

            using (ModelDBISE db = new ModelDBISE())
            {
                var lce =
                    db.CALENDARIOEVENTI.Where(
                        c =>
                        c.IDTRASFERIMENTO == idTrasferimento && c.IDFUNZIONIEVENTI == funzEv && c.COMPLETATO == false &&
                        c.ANNULLATO == false).OrderByDescending(a => a.IDCALENDARIOEVENTI);

                if (lce?.Any() ?? false)
                {
                    CALENDARIOEVENTI y = lce.First();
                    y.COMPLETATO     = true;
                    y.DATACOMPLETATO = DateTime.Now;
                    int i = db.SaveChanges();
                    if (i <= 0)
                    {
                        throw new Exception("Errore nella fase di modifica in 'Completato' dell'evento per il calendario eventi.");
                    }
                    else
                    {
                        Utility.SetLogAttivita(EnumAttivitaCrud.Modifica, "Modifica in 'Completato' dell'evento relativo al calendario eventi.",
                                               "CALENDARIOEVENTI", db, idTrasferimento, y.IDCALENDARIOEVENTI);
                    }
                }
            }
        }
Exemple #2
0
        public void AnnullaMessaggioEvento(decimal idTrasferimento, EnumFunzioniEventi fe, ModelDBISE db)
        {
            decimal funzEv = (decimal)fe;

            var lce =
                db.CALENDARIOEVENTI.Where(
                    a =>
                    a.IDTRASFERIMENTO == idTrasferimento && a.IDFUNZIONIEVENTI == funzEv && a.COMPLETATO == false &&
                    a.ANNULLATO == false).OrderByDescending(a => a.IDCALENDARIOEVENTI).ToList();

            if (lce?.Any() ?? false)
            {
                CALENDARIOEVENTI y = lce.First();
                y.ANNULLATO = true;
                int i = db.SaveChanges();
                if (i <= 0)
                {
                    throw new Exception("Errore nella fase di modifica in 'Completato' dell'evento per il calendario eventi.");
                }
                else
                {
                    Utility.SetLogAttivita(EnumAttivitaCrud.Annullato, "Annullamento del evento.",
                                           "CALENDARIOEVENTI", db, idTrasferimento, y.IDCALENDARIOEVENTI);
                }
            }
        }
Exemple #3
0
        public DettagliMessaggio OgggettoFunzioneEvento(EnumFunzioniEventi idf, int idd)
        {
            List <DettagliMessaggio> tmp = new List <DettagliMessaggio>();

            try
            {
                using (var db = new ModelDBISE())
                {
                    decimal x = (decimal)idf;
                    tmp = (from e in db.CALENDARIOEVENTI
                           where e.IDFUNZIONIEVENTI == x && e.TRASFERIMENTO.IDDIPENDENTE == idd && e.ANNULLATO == false
                           select new DettagliMessaggio()
                    {
                        NomeFunzione = e.FUNZIONIEVENTI.NOMEFUNZIONE,
                        Nominativo = e.TRASFERIMENTO.DIPENDENTI.COGNOME + " " + e.TRASFERIMENTO.DIPENDENTI.NOME,
                        Trasferimento = e.TRASFERIMENTO.UFFICI.DESCRIZIONEUFFICIO + " (" + e.TRASFERIMENTO.UFFICI.CODICEUFFICIO + ")",
                        MessaggioEvento = e.FUNZIONIEVENTI.MESSAGGIOEVENTO,
                    }).ToList();
                }
                return(tmp.FirstOrDefault());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        public bool EsisteEventoTrasferimentoDaAttivare(decimal idTrasferimento, EnumFunzioniEventi fe, ModelDBISE db)
        {
            decimal funzEv = (decimal)fe;
            bool    ret    = false;

            var lce =
                db.CALENDARIOEVENTI
                .Where(
                    c =>
                    c.IDTRASFERIMENTO == idTrasferimento && c.IDFUNZIONIEVENTI == funzEv && c.ANNULLATO == false).OrderByDescending(a => a.IDCALENDARIOEVENTI)
                .ToList();

            if (lce?.Any() ?? false)
            {
                ret = true;
            }
            return(ret);
        }
Exemple #5
0
        public ActionResult DetailsFunzioneEvento(EnumFunzioniEventi idf, int idd)
        {
            DettagliMessaggio tmp = new DettagliMessaggio();

            try
            {
                using (dtCalendarioEventi dtcal = new dtCalendarioEventi())
                {
                    tmp = dtcal.OgggettoFunzioneEvento(idf, idd);
                }
            }
            catch (Exception ex)
            {
                return(PartialView("ErrorPartial", new MsgErr()
                {
                    msg = ex.Message
                }));
            }
            return(PartialView(tmp));
        }