Beispiel #1
0
        public string saveTipoAlert(Azienda azienda, DettaglioTabellaSempliceDTO elemento, Gipasoft.Sfera.Enums.CRUDOperation operation, IDaoFactory daoFactory)
        {
            try
            {
                var message = string.Empty;

                TipoAlert item;
                if (elemento.Id > 0)
                    item = daoFactory.GetTipoAlertDao().Find(elemento.Id, false);
                else
                {
                    item = new TipoAlert(elemento.Descrizione);
                    daoFactory.GetTipoAlertDao().SaveOrUpdate(item);
                }

                if (item != null)
                {
                    if (operation == Gipasoft.Sfera.Enums.CRUDOperation.Update)
                    {
                        item.Descrizione = elemento.Descrizione;
                        item.Azienda = azienda;
                    }
                    else if (operation == Gipasoft.Sfera.Enums.CRUDOperation.Delete)
                        daoFactory.GetTipoAlertDao().Delete(item);
                }

                return message;
            }
            catch (Exception ex)
            {
                
                _log.Error("Errore nel salvataggio del tipo ALERT: " + Utility.GetMethodDescription() + " - id:" + elemento.Id, ex);
                throw;
            }
        }
Beispiel #2
0
 private TipoAlertDTO setTipoAlertDto(TipoAlert tipo)
 {
     var dto = new TipoAlertDTO {ID = tipo.ID, Descrizione = tipo.Descrizione};
     return dto;
 }
Beispiel #3
0
 public TipoAlertDTO GetByDomainEntityTipoAlert(TipoAlert tipo)
 {
     try
     {
         return setTipoAlertDto(tipo);
     }
     catch (Exception ex)
     {
          
         _log.Error("Errore nel caricamento delle tipologie di alert: " + Utility.GetMethodDescription() + " - id:" + tipo.ID, ex);
         throw;
     }
 }