示例#1
0
        public void InsertCalendarioEvento(ref CalendarioEventiModel cem, ModelDBISE db)
        {
            CALENDARIOEVENTI ca = new CALENDARIOEVENTI();

            ca.ANNULLATO        = cem.Annullato;
            ca.COMPLETATO       = cem.Completato;
            ca.DATACOMPLETATO   = cem.DataCompletato;
            ca.DATAINIZIOEVENTO = cem.DataInizioEvento;
            ca.DATASCADENZA     = cem.DataScadenza;
            ca.IDFUNZIONIEVENTI = (decimal)cem.idFunzioneEventi;
            ca.IDTRASFERIMENTO  = cem.idTrasferimento;
            db.CALENDARIOEVENTI.Add(ca);
            int i = db.SaveChanges();

            if (i <= 0)
            {
                throw new Exception("Errore nella fase d'inserimento dell'evento per il calendario eventi.");
            }
            else
            {
                cem.idCalendarioEventi = ca.IDCALENDARIOEVENTI;//per il ref parametro
                Utility.SetLogAttivita(EnumAttivitaCrud.Inserimento, "Inserimento  dell'evento relativo al calendario eventi.",
                                       "CALENDARIOEVENTI", db, ca.IDTRASFERIMENTO, ca.IDCALENDARIOEVENTI);
            }
        }
示例#2
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);
                    }
                }
            }
        }
示例#3
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);
                }
            }
        }