public List <ActiveUp.Net.Common.DeltaExt.Action> GetAllActionsByFolder(int id, string tipo, int IdUser) { List <ActiveUp.Net.Common.DeltaExt.Action> list = new List <ActiveUp.Net.Common.DeltaExt.Action>(); try { using (FAXPECContext dbcontext = new FAXPECContext()) { using (var oCmd = dbcontext.Database.Connection.CreateCommand()) { string queryActions = " SELECT ACTIONS.ID, ACTIONS.NOME_AZIONE,ACTIONS.ID_NOME_DESTINAZIONE,ACTIONS.TIPO_DESTINAZIONE, " + " ACTIONS.TIPO_AZIONE, ACTIONS.NUOVO_STATUS,ACTIONS_FOLDERS.IDFOLDER,ACTIONS.ID_FOLDER_DESTINAZIONE " + " FROM [FAXPEC].[FAXPEC].ACTIONS, [FAXPEC].[FAXPEC].ACTIONS_FOLDERS,[FAXPEC].[FAXPEC].FOLDERS_SENDERS,[FAXPEC].[FAXPEC].FOLDERS " + " WHERE FOLDERS.ID= " + id + " AND FOLDERS_SENDERS.IDFOLDER=FOLDERS.ID " + " AND FOLDERS_SENDERS.IDSENDER = " + IdUser + " AND FOLDERS_SENDERS.IDFOLDER= ACTIONS_FOLDERS.IDFOLDER " + " AND ACTIONS.ID= ACTIONS_FOLDERS.IDACTION AND ((ID_FOLDER_DESTINAZIONE IN (SELECT FOLDERS_SENDERS.IDFOLDER " + " FROM [FAXPEC].[FAXPEC].FOLDERS_SENDERS WHERE IDSENDER = " + IdUser + " )) " + "OR (ID_FOLDER_DESTINAZIONE IS NULL AND FOLDERS.TIPO IN ('I','E')))"; oCmd.CommandText = queryActions; oCmd.Connection.Open(); using (var r = oCmd.ExecuteReader()) { if (r.HasRows) { list = new List <ActiveUp.Net.Common.DeltaExt.Action>(); while (r.Read()) { list.Add(DaoSQLServerDBHelper.MapToAction(r)); } } } oCmd.Connection.Close(); } } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ERR_ACC_003", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = id.ToString(); log.Error(err); } } return(list); }