Esempio n. 1
0
 public void Update(ActiveUp.Net.Common.DeltaExt.Action entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             var action = dbcontext.ACTIONS.Where(x => x.ID == (double)entity.Id).FirstOrDefault();
             action = DaoSQLServerDBHelper.MapToActionDto(entity, false);
             int resp = dbcontext.SaveChanges();
             if (resp == 0)
             {
                 throw new Exception("Nessun record aggiornato");
             }
         }
         catch (Exception ex)
         {
             if (ex.GetType() == typeof(ManagedException))
             {
                 ManagedException mEx = new ManagedException(ex.Message, "ACT_ORA002", string.Empty, string.Empty, ex);
                 ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                 log.Error(er);
                 throw mEx;
             }
         }
     }
 }
Esempio n. 2
0
 public void Update(ActiveUp.Net.Common.DeltaExt.Action action)
 {
     using (ActionsSQLDb dao = new ActionsSQLDb())
     {
         dao.Update(action);
     }
 }
Esempio n. 3
0
 public void Insert(ActiveUp.Net.Common.DeltaExt.Action action)
 {
     using (ActionsSQLDb dao = new ActionsSQLDb())
     {
         dao.Insert(action);
     }
 }
 internal static ActiveUp.Net.Common.DeltaExt.Action MapToAction(IDataRecord dr)
 {
     ActiveUp.Net.Common.DeltaExt.Action a = new ActiveUp.Net.Common.DeltaExt.Action();
     a.Id               = (decimal)dr.GetDecimal("ID");
     a.NomeAzione       = dr.GetString("NOME_AZIONE");
     a.IdDestinazione   = (decimal)dr.GetDouble("ID_NOME_DESTINAZIONE");
     a.NuovoStatus      = dr.GetString("NUOVO_STATUS");
     a.TipoAzione       = dr.GetString("TIPO_AZIONE");
     a.TipoDestinazione = dr.GetString("TIPO_DESTINAZIONE");
     if (dr.FieldCount > 7)
     {
         a.IdComp = dr.GetDecimal("IDFOLDER").ToString();
     }
     a.IdFolderDestinazione = int.Parse(dr.GetDouble("ID_FOLDER_DESTINAZIONE").ToString());
     return(a);
 }
        internal static ACTIONS MapToActionDto(ActiveUp.Net.Common.DeltaExt.Action entity, bool isInsert)
        {
            ACTIONS a = new ACTIONS()
            {
                ID_FOLDER_DESTINAZIONE = entity.IdFolderDestinazione,
                NOME_AZIONE            = entity.NomeAzione,
                NUOVO_STATUS           = entity.NuovoStatus,
                TIPO_AZIONE            = entity.TipoAzione,
                ID_NOME_DESTINAZIONE   = (double)entity.IdDestinazione,
                TIPO_DESTINAZIONE      = entity.TipoDestinazione
            };

            if (!isInsert)
            {
                a.ID = (double)entity.Id;
            }
            return(a);
        }
Esempio n. 6
0
 public ActiveUp.Net.Common.DeltaExt.Action GetById(long id)
 {
     ActiveUp.Net.Common.DeltaExt.Action action = null;
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             ACTIONS a = dbcontext.ACTIONS.Where(x => x.ID == id).FirstOrDefault();
             action = AutoMapperConfiguration.MapToAction(a);
         }
         catch (Exception ex)
         {
             ManagedException mEx = new ManagedException(ex.Message, "ACT_ORA003", string.Empty, string.Empty, ex);
             ErrorLogInfo     er  = new ErrorLogInfo(mEx);
             log.Error(er);
             throw mEx;
         }
         return(action);
     }
 }
Esempio n. 7
0
 public void Insert(ActiveUp.Net.Common.DeltaExt.Action entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             ACTIONS action = DaoSQLServerDBHelper.MapToActionDto(entity, true);
             dbcontext.ACTIONS.Add(action);
         }
         catch (Exception ex)
         {
             if (ex.GetType() == typeof(ManagedException))
             {
                 ManagedException mEx = new ManagedException(ex.Message, "ACT_ORA001", string.Empty, string.Empty, ex);
                 ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                 log.Error(er);
                 throw mEx;
             }
         }
     }
 }
Esempio n. 8
0
        internal static void CreateActionsForFolders(decimal idIn, decimal idOut, decimal idInArch, decimal idOutArch, string nome, string idNome)
        {
            List <ActiveUp.Net.Common.DeltaExt.Action> actions = new List <ActiveUp.Net.Common.DeltaExt.Action>();

            ActiveUp.Net.Common.DeltaExt.Action actionin = new ActiveUp.Net.Common.DeltaExt.Action();
            actionin.IdDestinazione       = decimal.Parse(idNome);
            actionin.IdFolderDestinazione = (int)idIn;
            actionin.NomeAzione           = "SPOSTA IN " + nome;
            actionin.TipoAzione           = "SP";
            actions.Add(actionin);
            ActiveUp.Net.Common.DeltaExt.Action actionout = new ActiveUp.Net.Common.DeltaExt.Action();
            actionout.IdDestinazione       = decimal.Parse(idNome);
            actionout.IdFolderDestinazione = (int)idOut;
            actionout.NomeAzione           = "SPOSTA IN " + nome;
            actionout.TipoAzione           = "SP";
            actions.Add(actionout);
            // archivio
            ActiveUp.Net.Common.DeltaExt.Action actioninArch = new ActiveUp.Net.Common.DeltaExt.Action();
            actioninArch.IdDestinazione       = decimal.Parse(idNome);
            actioninArch.IdFolderDestinazione = (int)idInArch;
            actioninArch.NomeAzione           = "SPOSTA IN " + nome;
            actioninArch.TipoAzione           = "SP";
            actions.Add(actioninArch);
            ActiveUp.Net.Common.DeltaExt.Action actionoutArch = new ActiveUp.Net.Common.DeltaExt.Action();
            actionoutArch.IdDestinazione       = decimal.Parse(idNome);
            actionoutArch.IdFolderDestinazione = (int)idOutArch;
            actionoutArch.NomeAzione           = "SPOSTA IN " + nome;
            actionoutArch.TipoAzione           = "SP";
            actions.Add(actionoutArch);
            ActionsService actService = new ActionsService();

            try
            {
                actService.Insert(actions);
                List <ActionFolder> actionsFolders = new List <ActionFolder>();
                // inserimento azioni e collegamento con folders
                ActionFolder afInbox = new ActionFolder();
                afInbox.idAction = actionin.Id;
                afInbox.idFolder = 1;
                actionsFolders.Add(afInbox);
                ActionFolder afNewFolder = new ActionFolder();
                afNewFolder.idAction = 4;
                afNewFolder.idFolder = idIn;
                actionsFolders.Add(afNewFolder);
                ActionFolder afOutBox = new ActionFolder();
                afOutBox.idAction = actionout.Id;
                afOutBox.idFolder = 2;
                actionsFolders.Add(afOutBox);
                ActionFolder afNewFolderOut = new ActionFolder();
                afNewFolderOut.idAction = 6;
                afNewFolderOut.idFolder = idOut;
                actionsFolders.Add(afNewFolderOut);
                // ARCHIVI
                ActionFolder afInboxArch = new ActionFolder();
                afInboxArch.idAction = actioninArch.Id;
                afInboxArch.idFolder = 5;
                actionsFolders.Add(afInboxArch);
                ActionFolder afNewFolderArch = new ActionFolder();
                afNewFolderArch.idAction = 4;
                afNewFolderArch.idFolder = idInArch;
                actionsFolders.Add(afNewFolderArch);
                ActionFolder afOutBoxArch = new ActionFolder();
                afOutBoxArch.idAction = actionoutArch.Id;
                afOutBoxArch.idFolder = 7;
                actionsFolders.Add(afOutBoxArch);
                ActionFolder afNewFolderOutArch = new ActionFolder();
                afNewFolderOutArch.idAction = 6;
                afNewFolderOutArch.idFolder = idOutArch;
                actionsFolders.Add(afNewFolderOutArch);
                ActionsFoldersService service = new ActionsFoldersService();
                service.Insert(actionsFolders);
            }
            catch (Exception ex)
            {
                ManagedException mEx = new ManagedException(ex.Message, "FOL_APP001", string.Empty, string.Empty, ex);
                ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                log.Error(er);
                throw mEx;
            }
        }