public bool verificaEsistenzaFileInCache(string docnumber) { bool retval = false; DocsPaUtils.Query sql = DocsPaUtils.InitQuery.getInstance().getQuery("S_FILE_IN_CACHE"); sql.setParam("docnumber", docnumber.ToString()); logger.Debug("verificaEsistenzaFileInCache - query: " + sql.getSQL()); using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { using (System.Data.IDataReader reader = dbProvider.ExecuteReader(sql.getSQL())) { if (reader != null) { while (reader.Read()) { retval = true; break; } } } } return(retval); }
public bool inserimetoCache(InfoFileCaching info) { bool result = false; using (DBProvider dbProvider = new DBProvider()) { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_CACHE"); q.setParam("docnumber", info.DocNumber.ToString()); q.setParam("pathcache", "'" + info.CacheFilePath + "'"); q.setParam("idAmministrazione", "'" + info.idAmministrazione + "'"); q.setParam("aggiornato", info.Aggiornato.ToString()); q.setParam("version_id", info.Version_id.ToString()); q.setParam("loked", "'" + info.locked.ToString() + "'"); q.setParam("comptype", "'" + info.comptype + "'"); q.setParam("file_size", info.file_size.ToString()); q.setParam("alternate_path", "'" + info.alternate_path + "'"); q.setParam("var_impronta", "'" + info.var_impronta + "'"); q.setParam("ext", "'" + info.ext.ToUpper() + "'"); q.setParam("data", "'" + info.last_access + "'"); string sql = q.getSQL(); logger.Debug(sql); if (!dbProvider.ExecuteNonQuery(sql)) { logger.Debug("inserimentoCache - errore query"); dbProvider.RollbackTransaction(); result = false; } else { result = true; dbProvider.CommitTransaction(); } } return(result); }
//MEV utenti multi-amministrazione /// <summary> /// Caricamento dati relativi alla data creazione e alla scadenza password per un utente di un'amministrazione /// </summary> protected virtual UserPasswordData GetPassworUserInAmmdData() { UserPasswordData data = null; using (DBProvider dbProvider = new DBProvider()) { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("USER_IN_AMM_PASSWORD_GET_DATA"); queryDef.setParam("userId", this.UserId); queryDef.setParam("codAmm", this.IdAmministrazione); string commandText = queryDef.getSQL(); logger.Debug(commandText); logger.Debug(commandText); using (IDataReader reader = dbProvider.ExecuteReader(commandText)) { if (reader.Read()) { data = new UserPasswordData(reader); } } } return(data); }
public string recuperaPathCache(InfoFileCaching info) { string path = string.Empty; DocsPaUtils.Query sql = DocsPaUtils.InitQuery.getInstance().getQuery("S_VERIFICA_FILE_IN_CACHE"); sql.setParam("docnumber", info.DocNumber.ToString()); sql.setParam("idAmministrazione", "'" + info.idAmministrazione + "'"); sql.setParam("version_id", info.Version_id.ToString()); logger.Debug("recuperaPathCache - query: " + sql.getSQL()); using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { using (System.Data.IDataReader reader = dbProvider.ExecuteReader(sql.getSQL())) { if (reader != null) { while (reader.Read()) { path = reader.GetString(reader.GetOrdinal("PATHCACHE")); } } } } return(path); }
public string GetDBDate(bool time) { string dataTimeDb = ""; string[] dbFormats; string sql = string.Empty; string dbmms = System.Configuration.ConfigurationManager.AppSettings["dbType"].ToUpper(); if (time) { dbFormats = new string[2] { "dd/MM/yyyy HH:mm:ss", "DD/MM/YYYY HH24:MI:SS" } } ; else { dbFormats = new string[2] { "dd/MM/yyyy", "DD/MM/YYYY" } }; DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("S_DB_DATE_TIME"); if (dbmms.Equals("ORACLE")) { q.setParam("format", dbFormats[1]); } else { q.setParam("format", dbFormats[0]); } sql = q.getSQL(); this.ExecuteScalar(out dataTimeDb, sql); return(dataTimeDb); }
/// <summary> /// /// </summary> /// <param name="peoples"></param> /// <param name="idGruppo"></param> /// <returns></returns> public bool Imp_GetPeopleInGroup(out System.Data.DataSet peoples, string idGruppo) { bool result = true; peoples = null; try { DocsPaUtils.Query q = DocsPaUtils.InitImportExportQuery.getInstance().getQuery("IMP_GET_PEOPLE_IN_GROUP"); q.setParam("param1", idGruppo); string command = q.getSQL(); logger.Debug(command); if (!this.ExecuteQuery(out peoples, "PEOPLES", command)) { throw new Exception(); } } catch (Exception exception) { logger.Debug("Errore durante la lettura degli utenti appartenenti al gruppo", exception); result = false; } return(result); }
public static string getCitta(string systemId) { // co.debug.add("getCitta"); logger.Debug("getCitta"); DocsPaDB.DBProvider db = null; string res = null; bool rtn = false; try { if (systemId != null && !systemId.Equals("")) { string queryString = "SELECT VAR_CITTA FROM DPA_DETT_GLOBALI WHERE ID_CORR_GLOBALI=" + systemId; DocsPaUtils.Query q = new DocsPaUtils.Query(queryString); db = new DocsPaDB.DBProvider(); rtn = db.ExecuteScalar(out res, queryString); if (!rtn) { throw new Exception("AS400, reperimento valore città corrispondente " + systemId + " non riuscito"); } } } catch (Exception ex) { throw ex; } finally { if (db != null) { db.Dispose(); } } return(res); }
public InfoFileCaching getFileCache(string docnumber) { InfoFileCaching info = null; DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("S_CACHE_BY_DOCNUMBER"); q.setParam("docnumber", docnumber); string queryString = q.getSQL(); logger.Debug("getFileCache - query: " + queryString); using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { using (System.Data.IDataReader reader = dbProvider.ExecuteReader(queryString)) { if (reader != null) { while (reader.Read()) { info = new InfoFileCaching(); info.Aggiornato = reader.GetInt32(reader.GetOrdinal("AGGIORNATO")); info.alternate_path = reader.GetString(reader.GetOrdinal("ALTERNATE_PATH")); info.CacheFilePath = reader.GetString(reader.GetOrdinal("PATHCACHE")); info.comptype = reader.GetString(reader.GetOrdinal("COMPTYPE")); info.DocNumber = reader.GetInt32(reader.GetOrdinal("DOCNUMBER")); info.ext = reader.GetString(reader.GetOrdinal("EXT")); info.var_impronta = reader.GetString(reader.GetOrdinal("VAR_IMPRONTA")); info.file_size = reader.GetInt32(reader.GetOrdinal("FILE_SIZE")); info.idAmministrazione = reader.GetString(reader.GetOrdinal("idAmministrazione")); info.locked = int.Parse(reader.GetString(reader.GetOrdinal("LOCKED"))); info.Version_id = reader.GetInt32(reader.GetOrdinal("VERSION_ID")); info.last_access = reader.GetString(reader.GetOrdinal("LAST_ACCESS")); } } } } return(info); }
public List <Assertion> GetListAssertionByAmm(string idAmm) { List <Assertion> listAssertion = new List <Assertion>(); DataSet ds; try { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_DPA_EVENT_TYPE_ASSERTIONS"); queryDef.setParam("idAmm", idAmm); string commandText = queryDef.getSQL(); logger.Debug("Eseguo la query:\n" + commandText); if (this.ExecuteQuery(out ds, "ASSERTIONS", commandText)) { CreateObjectAssertion(ds, ref listAssertion); } } catch (Exception exc) { logger.Debug("Si è verificata un'eccezione durante l'esecuzione della query S_DPA_EVENT_TYPE_ASSERTIONS:\n" + exc.Message); return(listAssertion); } return(listAssertion); }
public TipoNotifica[] ricercaTipoNotifiche() { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("S_DPA_TIPO_NOTIFICA"); List <TipoNotifica> Tiponotifica = new List <TipoNotifica>(); logger.Debug("ricerca tipo notifica " + q.getSQL()); using (IDataReader reader = ExecuteReader(q.getSQL())) { if (reader.FieldCount > 0) { if (reader.Read()) { TipoNotifica tipoNotifica = new TipoNotifica(); tipoNotifica.idTipoNotifica = reader["SYSTEM_ID"].ToString(); tipoNotifica.codiceNotifica = reader["VAR_CODICE_NOTIFICA"].ToString(); tipoNotifica.descrizioneNotifica = reader["VAR_DESCRIZIONE"].ToString(); Tiponotifica.Add(tipoNotifica); } } } return(Tiponotifica.ToArray()); }
/// <summary> /// Returns the list of events to be processed /// </summary> /// <returns></returns> public List <Event> SelectEventsToBeProcessed() { List <Event> listEvent = new List <Event>(); try { DataSet ds = new DataSet(); DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("S_J_DPA_LOG_DPA_ANAGRAFICA_LOG"); string queryString = q.getSQL(); OpenConnection(); this.BeginTransaction(); if (!this.ExecuteQuery(out ds, "RecordEvents", q.getSQL())) { this.RollbackTransaction(); return(listEvent); } else { this.CreateEventObjects(ds, ref listEvent); } } catch (Exception exc) { logger.Error(exc); } finally { if (listEvent.Count < 1) { //da eliminare in questo punto del codice this.RollbackTransaction(); } CloseConnection(); } return(listEvent); }
/// <summary> /// Annullamento dello stato CheckedOut per un documento /// </summary> /// <param name="checkOutInfo"></param> /// <returns></returns> public bool UndoCheckOut(CheckOutStatus checkOutStatus) { bool retValue = false; try { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("CHECKINOUT_UNDO_CHECKOUT_DOCUMENT"); queryDef.setParam("id", checkOutStatus.ID.ToString()); string commandText = queryDef.getSQL(); logger.Debug(commandText); using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) retValue = dbProvider.ExecuteNonQuery(commandText); } catch (Exception ex) { logger.Debug(ex.Message, ex); throw new ApplicationException("Errore nell'UndoCheckOut del documento. IDDocumento: " + checkOutStatus.IDDocument, ex); } return(retValue); }
/// <summary> /// Verifica se un documento è in stato checkedout /// </summary> /// <param name="idDocument"></param> /// <param name="checkOutInfo">Informazioni sullo stato del checkout</param> /// <returns></returns> public bool IsCheckedOut(string idDocument, string documentNumber, out string ownerUser) { bool retValue = false; ownerUser = string.Empty; try { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("CHECKINOUT_HUMMY_IS_CHECKED_OUT"); queryDef.setParam("documentNumber", documentNumber); string commandText = queryDef.getSQL(); logger.Debug(commandText); using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { using (IDataReader reader = dbProvider.ExecuteReader(commandText)) { if (reader.Read()) { retValue = true; ownerUser = reader.GetValue(reader.GetOrdinal("USER_NAME")).ToString(); } } } } catch (Exception ex) { logger.Debug(ex.Message, ex); throw new ApplicationException("Errore nella verifica dello stato del documento estratto. IDDocumento: " + idDocument, ex); } return(retValue); }
///<summary> /// Returns the multiplicity for those events whose multiplicity value is tied to the object specialized /// </summary> /// <param name="notificationRecipients"></param> /// <param name="idSpecializedObject"></param> /// <returns></returns> private string MultiplicityEvent(string eventType, int idSpecializedObject) { string multiplicity = string.Empty; try { switch (Utils.GetTypeEvent(eventType)) { case SupportStructures.EventType.TRASM: DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("S_MULTIPLICITY_EVENT_TRASM"); q.setParam("idTrasmSing", idSpecializedObject.ToString()); this.ExecuteScalar(out multiplicity, q.getSQL()); break; default: break; } } catch (Exception exc) { // traccia l'eccezione nel file di log logger.Error(exc); } if (!string.IsNullOrEmpty(multiplicity)) { if (multiplicity.Equals("T")) { return(SupportStructures.MULTIPLICITY.ALL); } else if (multiplicity.Equals("S")) { return(SupportStructures.MULTIPLICITY.ONE); } } return(multiplicity); }
public List <string> GetTypeConfigurableEvents(string idAmm) { List <string> listTypeEvent = new List <string>(); DataSet ds; try { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_TYPE_EVENT_CONFIGURABLE"); queryDef.setParam("idAmm", idAmm); string commandText = queryDef.getSQL(); logger.Debug("Eseguo la query:\n" + commandText); if (this.ExecuteQuery(out ds, "TYPE_EVENT_CONF", commandText)) { CreateTypeEventConf(ds, ref listTypeEvent); } } catch (Exception exc) { logger.Debug("Si è verificata un'eccezione durante l'esecuzione della query S_TYPE_EVENT_CONFIGURABLE:\n" + exc.Message); return(listTypeEvent); } return(listTypeEvent); }
public DocsPaVO.fascicolazione.VoceIndiceSistematico existVoceIndice(DocsPaVO.fascicolazione.VoceIndiceSistematico voceIndice) { DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider(); try { DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("INDS_EXSIST_VOCE_INDICE"); queryMng.setParam("voceIndice", voceIndice.voceIndice); string commandText = queryMng.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - existVoceIndice - IndiceSistematico.cs - QUERY : " + commandText); logger.Debug("SQL - existVoceIndice - IndiceSistematico.cs - QUERY : " + commandText); DataSet dsVoceIndice = new DataSet(); dbProvider.ExecuteQuery(dsVoceIndice, commandText); if (dsVoceIndice.Tables[0].Rows.Count != 0) { DocsPaVO.fascicolazione.VoceIndiceSistematico voceIndiceRicercato = new DocsPaVO.fascicolazione.VoceIndiceSistematico(); voceIndiceRicercato.voceIndice = dsVoceIndice.Tables[0].Rows[0]["VOCE_INDICE"].ToString(); voceIndiceRicercato.systemId = dsVoceIndice.Tables[0].Rows[0]["SYSTEM_ID"].ToString(); return(voceIndiceRicercato); } else { return(null); } } catch { dbProvider.RollbackTransaction(); return(null); } finally { dbProvider.Dispose(); } }
///// <summary> ///// ///// </summary> ///// <param name="containsFileModel"></param> ///// <param name="fileType"></param> ///// <param name="provider"></param> ///// <param name="brokenRules"></param> ///// <returns></returns> //private static bool SetContainsFileModelFlag(SupportedFileType fileType, DBProvider provider, ArrayList brokenRules) //{ // bool retValue = false; // // Reperimento tipi documento per l'amministrazione // DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("U_SET_CONTAINS_FILE_MODEL"); // if (fileType.ContainsFileModel) // queryDef.setParam("containsFileModel", "1"); // else // queryDef.setParam("containsFileModel", "0"); // queryDef.setParam("idSupportedFileType", fileType.SystemId.ToString()); // string commandText = queryDef.getSQL(); // logger.Debug(commandText); // int rowsAffected; // if (provider.ExecuteNonQuery(commandText, out rowsAffected)) // { // retValue = (rowsAffected == 1); // if (!retValue) // brokenRules.Add(new BrokenRule("SET_CONTAINS_FILE_MODEL_ERROR", "Errore nell'impostazione del modello predefinito", BrokenRule.BrokenRuleLevelEnum.Error)); // } // return retValue; //} /// <summary> /// Inserimento nuovo tipo di file /// </summary> /// <param name="fileType"></param> /// <param name="provider"></param> /// <param name="brokenRules"></param> private static bool InsertFileType(SupportedFileType fileType, DBProvider provider, ArrayList brokenRules) { bool retValue = false; try { // Verifica se il tipo di file è già presente if (ContainsFileType(fileType, provider)) { string errorMessage = string.Format("Tipo file {0} già esistente", fileType.FileExtension); logger.Debug(errorMessage); brokenRules.Add(new BrokenRule("FILE_TYPE_EXIST", errorMessage, BrokenRule.BrokenRuleLevelEnum.Error)); retValue = false; } else { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("I_INSERT_SUPPORTED_FILE_TYPES"); queryDef.setParam("colSystemId", DocsPaDbManagement.Functions.Functions.GetSystemIdColName()); queryDef.setParam("systemId", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal(null)); if (fileType.IdAmministrazione > 0) { queryDef.setParam("idAmministrazione", fileType.IdAmministrazione.ToString()); } else { queryDef.setParam("idAmministrazione", "Null"); } if (fileType.FileTypeUsed) { queryDef.setParam("fileTypeUsed", "1"); } else { queryDef.setParam("fileTypeUsed", "0"); } if (fileType.FileTypeSignature) { queryDef.setParam("fileTypeSignature", "1"); } else { queryDef.setParam("fileTypeSignature", "0"); } if (fileType.FileTypePreservation) { queryDef.setParam("fileTypePreservation", "1"); } else { queryDef.setParam("fileTypePreservation", "0"); } if (fileType.FileTypeValidation) { queryDef.setParam("fileTypeValidation", "1"); } else { queryDef.setParam("fileTypeValidation", "0"); } queryDef.setParam("description", fileType.Description); //queryDef.setParam("mimeType", fileType.MimeType); queryDef.setParam("fileExtensione", fileType.FileExtension); queryDef.setParam("maxFileSize", fileType.MaxFileSize.ToString()); queryDef.setParam("maxFileSizeAlertMode", ((int)fileType.MaxFileSizeAlertMode).ToString()); if (fileType.ContainsFileModel) { queryDef.setParam("containsFileModel", "1"); } else { queryDef.setParam("containsFileModel", "0"); } queryDef.setParam("documentType", ((int)fileType.DocumentType).ToString()); string commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected; if (provider.ExecuteNonQuery(commandText, out rowsAffected)) { retValue = (rowsAffected > 0); } if (retValue) { commandText = DocsPaDbManagement.Functions.Functions.GetQueryLastSystemIdInserted(); logger.Debug(commandText); string newId; if (provider.ExecuteScalar(out newId, commandText)) { fileType.SystemId = Convert.ToInt32(newId); retValue = true; } else { throw new Exception(); } } else { throw new Exception(); } } } catch (Exception ex) { string errorMessage = string.Format("Tipo file {0}: errore nell'inserimento", fileType.FileExtension); logger.Debug(errorMessage, ex); brokenRules.Add(new BrokenRule("INSERT_ERROR", errorMessage, BrokenRule.BrokenRuleLevelEnum.Error)); } return(retValue); }
/// <summary> /// Aggiornamento tipo di file /// </summary> /// <param name="fileType"></param> /// <param name="provider"></param> /// <param name="brokenRules"></param> /// <returns></returns> private static bool UpdateFileType(SupportedFileType fileType, DBProvider provider, ArrayList brokenRules) { bool retValue = false; try { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("U_UPDATE_SUPPORTED_FILE_TYPES"); queryDef.setParam("description", fileType.Description); if (fileType.FileTypeUsed) { queryDef.setParam("fileTypeUsed", "1"); } else { queryDef.setParam("fileTypeUsed", "0"); } if (fileType.FileTypeSignature) { queryDef.setParam("fileTypeSignature", "1"); } else { queryDef.setParam("fileTypeSignature", "0"); } if (fileType.FileTypePreservation) { queryDef.setParam("fileTypePreservation", "1"); } else { queryDef.setParam("fileTypePreservation", "0"); } if (fileType.FileTypeValidation) { queryDef.setParam("fileTypeValidation", "1"); } else { queryDef.setParam("fileTypeValidation", "0"); } //queryDef.setParam("mimeType", fileType.MimeType); queryDef.setParam("fileExtensione", fileType.FileExtension); queryDef.setParam("maxFileSize", fileType.MaxFileSize.ToString()); queryDef.setParam("maxFileSizeAlertMode", ((int)fileType.MaxFileSizeAlertMode).ToString()); if (fileType.ContainsFileModel) { queryDef.setParam("containsFileModel", "1"); } else { queryDef.setParam("containsFileModel", "0"); } queryDef.setParam("documentType", ((int)fileType.DocumentType).ToString()); queryDef.setParam("systemId", fileType.SystemId.ToString()); string commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected; if (provider.ExecuteNonQuery(commandText, out rowsAffected)) { retValue = (rowsAffected > 0); } //if (retValue) //{ // if (AdminContainsFileType(fileType, provider)) // { // // Aggiornamento valore del flag "CONTAINS_FILE_MODEL" // retValue = SetContainsFileModelFlag(fileType, provider, brokenRules); // } //} } catch (Exception ex) { string errorMessage = string.Format("Tipo file {0}: errore nella modifica"); logger.Debug(errorMessage, ex); brokenRules.Add(new BrokenRule("UPDATE_ERROR", errorMessage, BrokenRule.BrokenRuleLevelEnum.Error)); } return(retValue); }
/// <summary> /// Metodo per la creazione del TASK /// </summary> /// <param name="task"></param> /// <param name="infoUtente"></param> /// <returns></returns> public bool InsertTask(DocsPaVO.Task.Task task, DocsPaVO.utente.InfoUtente infoUtente) { bool result = false; logger.Debug("Inizio Metodo InsertTask in DocsPaDb.Query_DocsPAWS.Task"); if (task != null) { try { BeginTransaction(); DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_TASK"); if (DBType.ToUpper().Equals("ORACLE")) { q.setParam("idTask", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_TASK")); } q.setParam("idRuoloMtt", task.RUOLO_MITTENTE.idGruppo); q.setParam("idUtenteMitt", task.UTENTE_MITTENTE.idPeople); q.setParam("idRuoloDest", task.RUOLO_DESTINATARIO.idGruppo); q.setParam("idUtenteDest", task.UTENTE_DESTINATARIO.idPeople); if (!string.IsNullOrEmpty(task.ID_PROJECT)) { q.setParam("idProject", task.ID_PROJECT); q.setParam("idProfile", "null"); } else { q.setParam("idProfile", task.ID_PROFILE); q.setParam("idProject", "null"); } q.setParam("idTrasmissione", task.ID_TRASMISSIONE); q.setParam("idTrasmSingola", task.ID_TRASM_SINGOLA); q.setParam("idRagioneTrasm", task.ID_RAGIONE_TRASM); string query = q.getSQL(); logger.Debug("InsertTask: " + query); if (ExecuteNonQuery(query)) { string idTask = string.Empty; string sql = DocsPaDbManagement.Functions.Functions.GetQueryLastSystemIdInserted("DPA_TASK"); this.ExecuteScalar(out idTask, sql); q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_STATO_TASK"); if (DBType.ToUpper().Equals("ORACLE")) { q.setParam("idStatoTask", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_STATO_TASK")); } q.setParam("idTask", idTask); q.setParam("dataApertura", DocsPaDbManagement.Functions.Functions.GetDate()); q.setParam("dataScadenza", DocsPaDbManagement.Functions.Functions.ToDate(task.STATO_TASK.DATA_SCADENZA)); q.setParam("noteRiapertura", string.IsNullOrEmpty(task.STATO_TASK.NOTE_RIAPERTURA) ? string.Empty : task.STATO_TASK.NOTE_RIAPERTURA.Replace("'", "''")); q.setParam("stato", "A"); query = q.getSQL(); logger.Debug("InsertStatoTask: " + query); if (ExecuteNonQuery(query)) { result = true; } } if (result) { CommitTransaction(); } else { throw new Exception("Errore durante la creazione del task: " + query); } } catch (Exception e) { RollbackTransaction(); logger.Error("Errore in DocsPaDb.Query_DocsPAWS.Task - Metodo InsertTask", e); result = false; } } logger.Debug("Fine Metodo InserTask in DocsPaDb.Query_DocsPAWS.Task"); return(result); }
public VtDocs.BusinessServices.Entities.Spotlight.SpotlightResponse SpotlightDocumenti(VtDocs.BusinessServices.Entities.Spotlight.SpotlightRequest request) { VtDocs.BusinessServices.Entities.Spotlight.SpotlightResponse response = new VtDocs.BusinessServices.Entities.Spotlight.SpotlightResponse(); try { using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { string filterString = string.Format("{0}*", request.Filter).Replace("'", "''"); DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("SPOTLIGHT_GET_COUNT_DOCUMENTI"); queryDef.setParam("filter", filterString); queryDef.setParam("idPeople", request.InfoUtente.idPeople); queryDef.setParam("idGruppo", request.InfoUtente.idGruppo); string commandText = queryDef.getSQL(); string countField; if (dbProvider.ExecuteScalar(out countField, commandText)) { response.TotalRecordCount = Convert.ToInt32(countField); queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("SPOTLIGHT_GET_DOCUMENTI"); queryDef.setParam("filter", filterString); queryDef.setParam("idPeople", request.InfoUtente.idPeople); queryDef.setParam("idGruppo", request.InfoUtente.idGruppo); queryDef.setParam("start", request.Start.ToString()); queryDef.setParam("limit", request.Limit.ToString()); commandText = queryDef.getSQL(); List <VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultRecord> records = new List <VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultRecord>(); using (System.Data.IDataReader reader = dbProvider.ExecuteReader(commandText)) { while (reader.Read()) { List <VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultCell> cells = new List <VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultCell>(); cells.Add ( new VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultCell { FieldName = "IdProfile", FieldValue = reader.GetValue(reader.GetOrdinal("IdProfile")).ToString() } ); cells.Add ( new VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultCell { FieldName = "Oggetto", FieldValue = reader.GetString(reader.GetOrdinal("Oggetto")) } ); cells.Add ( new VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultCell { FieldName = "DocName", FieldValue = reader.GetString(reader.GetOrdinal("DocName")) } ); records.Add( new VtDocs.BusinessServices.Entities.Spotlight.SpotlightResultRecord { Cells = cells.ToArray() }); } } response.Records = records.ToArray(); response.Success = true; } else { throw new ApplicationException(dbProvider.LastExceptionMessage); } } } catch (Exception ex) { response.Success = false; if (request.TrowOnError) { throw DocsPaUtils.Exceptions.SoapExceptionFactory.Create(ex); } else { response.Exception = ex.Message; } } return(response); }
/// <summary> /// /// </summary> /// <param name="idDocument"></param> /// <param name="toState"></param> /// <returns></returns> protected virtual DocsPaVO.documento.DocumentConsolidationStateInfo InternalSetState(string idDocument, DocsPaVO.documento.DocumentConsolidationStateEnum toState) { try { DocsPaVO.documento.DocumentConsolidationStateInfo retValue = null; using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_SET_DOCUMENT_CONSOLIDATION_STATE"); queryDef.setParam("state", ((int)toState).ToString()); queryDef.setParam("author", this.UserInfo.idPeople); queryDef.setParam("role", this.UserInfo.idGruppo); queryDef.setParam("date", DocsPaDbManagement.Functions.Functions.GetDate()); queryDef.setParam("idDocument", idDocument); string commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected; if (dbProvider.ExecuteNonQuery(commandText, out rowsAffected)) { // Reperimento stato di consolidamento aggiornato retValue = this.GetState(idDocument); if (toState == DocsPaVO.documento.DocumentConsolidationStateEnum.Step2) { // Inserimento dei dati fondamentali del documento consolidato nella tabella dello storico queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("I_INSERT_CONSOLIDATED_DOCUMENT"); queryDef.setParam("idDocument", idDocument); queryDef.setParam("userdb", DocsPaDbManagement.Functions.Functions.GetDbUserSession()); commandText = queryDef.getSQL(); logger.Debug(commandText); if (dbProvider.ExecuteNonQuery(commandText, out rowsAffected)) { if (rowsAffected == 0) { throw new ApplicationException("Errore nella storicizzazione dei dati del documento consolidato"); } } else { throw new ApplicationException("Errore nell'esecuzione della query I_INSERT_CONSOLIDATED_DOCUMENT"); } } } else { throw new ApplicationException("Errore nell'esecuzione della query U_SET_DOCUMENT_CONSOLIDATION_STATE"); } return(retValue); } } catch (Exception ex) { string errorMessage = string.Format("Errore nell'impostazione dello stato di consolidamento del documento con id {0}", idDocument); logger.Debug(errorMessage, ex); throw new ApplicationException(errorMessage, ex); } }
private void getInfoOggetto(Oggetto oggetto) { logger.Debug("getInfoOggetto"); DocsPaUtils.Query infoQuery = new DocsPaUtils.Query(""); }
public bool BigFilesFTP_updateTable(DocsPaVO.ExternalServices.FileFtpUpInfo infoFile) { bool retval = true; try { using (DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider()) { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("U_DPABIGFILE"); q.setParam("stato", infoFile.Status); q.setParam("messErrore", infoFile.ErrorMessage); q.setParam("pathFS", infoFile.FSPath); q.setParam("idQueue", infoFile.IdQueue); string queryString = q.getSQL(); logger.Debug(queryString); retval = this.ExecuteNonQuery(queryString); if (infoFile.Status == "OK") { DocsPaUtils.Query q2 = DocsPaUtils.InitQuery.getInstance().getQuery("U_Versions"); q2.setParam("param1", "SUBVERSION = 'A'"); q2.setParam("param2", "VERSION_ID = " + infoFile.VersionId); queryString = q2.getSQL(); logger.Debug(queryString); retval = this.ExecuteNonQuery(queryString); DocsPaUtils.Query q3 = DocsPaUtils.InitQuery.getInstance().getQuery("U_PROFILE_EXT"); // controllare le operazioni sul nome del file. string filenameX = infoFile.FileName.ToLower(); string cha_firmato = "0", cha_tipo_firma = "N"; if (filenameX.ToUpper().Contains(".P7M")) { cha_firmato = "1"; cha_tipo_firma = "C"; } while (filenameX.EndsWith(".p7m") || filenameX.EndsWith(".tsd")) { filenameX = filenameX.Substring(0, filenameX.Length - 4); } q3.setParam("ext", "'" + filenameX.Substring(filenameX.LastIndexOf('.') + 1) + "'"); q3.setParam("docnumber", infoFile.IdDocument); queryString = q3.getSQL(); logger.Debug(queryString); retval = this.ExecuteNonQuery(queryString); DocsPaUtils.Query q4 = DocsPaUtils.InitQuery.getInstance().getQuery("U_Components"); q4.setParam("param1", string.Format( "PATH = '{0}', FILE_SIZE = {1}, VAR_IMPRONTA = '{2}', VAR_NOMEORIGINALE='{3}', ID_PEOPLE_PUTFILE={4}, DTA_FILE_ACQUIRED = SYSDATE, CHA_TIPO_FIRMA = '{5}', CHA_FIRMATO = '{6}'", infoFile.FSPath, infoFile.FileSize, infoFile.HashFile.ToUpper(), infoFile.FileName, infoFile.UploaderId, cha_tipo_firma, cha_firmato)); q4.setParam("param2", "VERSION_ID = " + infoFile.VersionId); queryString = q4.getSQL(); logger.Debug(queryString); retval = this.ExecuteNonQuery(queryString); } } } catch (Exception ex) { logger.Error(ex); retval = false; } return(retval); }
/// <summary> /// Reperimento delle informazioni di configurazione ldap per una singolo utente /// </summary> /// <param name="userName"></param> /// <returns></returns> public DocsPaVO.Ldap.LdapUserConfig GetLdapUserConfigByName(string userName) { try { DocsPaVO.Ldap.LdapUserConfig info = null; using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_GET_LDAP_USER_CONFIG_BY_NAME"); queryDef.setParam("userName", userName); string commandText = queryDef.getSQL(); logger.Debug(commandText); using (IDataReader reader = dbProvider.ExecuteReader(commandText)) { if (reader.Read()) { info = new LdapUserConfig { LdapIdSync = DocsPaUtils.Data.DataReaderHelper.GetValue <string>(reader, "LDAP_ID_SYNC", true, string.Empty), LdapSyncronized = (!string.IsNullOrEmpty(DocsPaUtils.Data.DataReaderHelper.GetValue <string>(reader, "LDAP_ID_SYNC", true, string.Empty)) && (DocsPaUtils.Data.DataReaderHelper.GetValue <string>(reader, "LDAP_NEVER_SYNC", true, "0") == "0")), LdapAuthenticated = (DocsPaUtils.Data.DataReaderHelper.GetValue <string>(reader, "LDAP_AUTHENTICATED", true, "0") == "1") }; //if (info.LdapAuthenticated) //{ // info.LdapUserConfigSettings = new LdapConfig // { // LdapIntegrationActive = true, // ServerName = DocsPaUtils.Data.DataReaderHelper.GetValue<string>(reader, "SERVER_NAME", true, string.Empty), // GroupDN = DocsPaUtils.Data.DataReaderHelper.GetValue<string>(reader, "GROUP_DN", true, string.Empty) // }; // if (string.IsNullOrEmpty(info.LdapUserConfigSettings.ServerName) || // string.IsNullOrEmpty(info.LdapUserConfigSettings.GroupDN)) // { // using (Utenti userDb = new Utenti()) // { // string idAmm; // // Reperimento id amministrazione per l'utente // userDb.GetIdAmmUtente(out idAmm, userName); // LdapConfig adminConfig = GetLdapConfig(idAmm); // info.LdapUserConfigSettings.ServerName = adminConfig.ServerName; // info.LdapUserConfigSettings.GroupDN = adminConfig.GroupDN; // } // } //} } } } return(info); } catch (Exception ex) { string errorMessage = "Errore nel reperimento delle configurazione LDAP per l'utente"; logger.Debug(errorMessage, ex); throw new ApplicationException(errorMessage, ex); } }
/// <summary> /// Save dei dati per la gestione delle password in amministrazione /// </summary> /// <param name="configurations"></param> /// <returns></returns> public static bool SavePasswordConfigurations(PasswordConfigurations configurations) { bool saved = false; using (DBProvider dbProvider = new DBProvider()) { dbProvider.BeginTransaction(); // Reperimento configurazioni precedenti PasswordConfigurations oldConfigurations = GetPasswordConfigurations(configurations.IdAmministrazione); DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("PASSWORD_CONFIG_SET_DATA"); if (configurations.ExpirationEnabled) { queryDef.setParam("enablePasswordExpiration", "1"); queryDef.setParam("passwordExpirationDays", configurations.ValidityDays.ToString()); } else { queryDef.setParam("enablePasswordExpiration", "NULL"); queryDef.setParam("passwordExpirationDays", "NULL"); } if (configurations.MinLength > 0) { queryDef.setParam("passwordMinLength", configurations.MinLength.ToString()); } else { queryDef.setParam("passwordMinLength", "NULL"); } if (configurations.SpecialCharacters != null && configurations.SpecialCharacters.Length > 0) { queryDef.setParam("passwordSpecialChars", string.Format("'{0}'", new string(configurations.SpecialCharacters).Replace("'", "''"))); } else { queryDef.setParam("passwordSpecialChars", "NULL"); } if (configurations.IdAmministrazione == -1) { // System administrator queryDef.setParam("idAmministrazione", " IS NULL"); } else { queryDef.setParam("idAmministrazione", " = " + configurations.IdAmministrazione.ToString()); } string commandText = queryDef.getSQL(); //Debugger.Write(commandText); logger.Debug(commandText); int rowsAffected; if (!dbProvider.ExecuteNonQuery(commandText, out rowsAffected)) { throw new ApplicationException(string.Format("Errore nell'aggiornamento delle configurazioni delle password. ID Amministrazione: {0}", configurations.IdAmministrazione.ToString())); } saved = (rowsAffected == 1); // Se il numero di giorni di validità è cambiato // per ogni utente dell'amministrazione // viene aggiornata la data di creazione della password if (saved) { SetCreationDateAllUser(dbProvider, configurations, oldConfigurations); } dbProvider.CommitTransaction(); } return(saved); }
/// <summary> /// Insert a new assertion event. /// </summary> /// <param name="assertion"></param> public int InsertAssertionEvent(Assertion assertion) { string commandText; StringBuilder strbuilderForLog = new StringBuilder(); int res; try { //preparo le info sull'asserzione per il log strbuilderForLog.Append("ID TIPO EVENTO: " + assertion.ID_TYPE_EVENT.ToString() + "\n" + "DESCR. TIPO EVENTO: " + assertion.DESC_TYPE_EVENT.Replace("'", "''") + "\n" + "ID AGGREGATORE : " + assertion.ID_AUR.ToString() + "\n" + "TIPO AGGREGATORE: " + assertion.TYPE_AUR + "\n" + "DESCR. AGGREGATORE: " + assertion.DESC_AUR.Replace("'", "''") + "\n" + "TIPOLOGIA NOTIFICA: " + assertion.TYPE_NOTIFY.ToString() + "\n" + "IN ESERCIZIO: " + (assertion.IS_EXERCISE ? "SI" : "NO") + "\n" + "ID AMMINISTRAZIONE: " + assertion.ID_AMM.ToString() + "\n"); //verifico se l'asserzione è gia presente su db DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_ASSERTIONS_COUNT_DUPLICATE"); queryDef.setParam("idTypeEvent", assertion.ID_TYPE_EVENT.ToString()); queryDef.setParam("idAur", assertion.ID_AUR.ToString()); queryDef.setParam("typeAur", "'" + assertion.TYPE_AUR + "'"); queryDef.setParam("idAmm", assertion.ID_AMM.ToString()); commandText = queryDef.getSQL(); string count; this.ExecuteScalar(out count, commandText); if (string.IsNullOrEmpty(count) || count.Equals("0")) // l'asserzione è presente sul db, quindi vado avanti nell'inserimento { StringBuilder strbuilder = new StringBuilder(); strbuilder.Append("seq.nextval, "); strbuilder.Append(assertion.ID_TYPE_EVENT.ToString() + ", "); strbuilder.Append("'" + assertion.DESC_TYPE_EVENT.Replace("'", "''") + "', "); strbuilder.Append(assertion.ID_AUR.ToString() + ", "); strbuilder.Append("'" + assertion.DESC_AUR + "', "); strbuilder.Append("'" + assertion.TYPE_AUR + "', "); strbuilder.Append("'" + assertion.TYPE_NOTIFY.ToString() + "', "); strbuilder.Append(assertion.IS_EXERCISE ? "'1', " : "'0', "); strbuilder.Append(assertion.ID_AMM); queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_EVENT_TYPE_ASSERTIONS"); queryDef.setParam("value", strbuilder.ToString()); commandText = queryDef.getSQL(); logger.Debug("Eseguo la query:\n" + commandText); if (!this.ExecuteNonQuery(commandText)) { res = -1;//errore durante la insert logger.Debug("ERRORE DURANTE LA CREAZIONE DELL'ASSERZIONE:\n" + strbuilderForLog.ToString()); } else { res = 0; logger.Debug("ASSERZIONE:\n" + strbuilderForLog.ToString() + "CORRETTAMENTE CREATA"); } } else { res = 1; logger.Debug("L'ASSERZIONE:\n" + strbuilderForLog.ToString() + "E' GIA' PRESENTE SUL DB"); } } catch (Exception exc) { logger.Debug("SI E' VERIFICATA UN'ECCEZIONE DURANTE LA CREAZIONE DELL'ASSERZIONE:\n" + strbuilderForLog.ToString() + "DETTAGLIO ECCEZIONE:\n" + exc.Message); res = -1; } return(res); }
/// <summary> /// /// </summary> /// <param name="idAmministrazione"></param> /// <param name="syncResponse"></param> /// <returns></returns> public LdapSyncronizationHistoryItem SaveLdapSyncResult(string idAmministrazione, LdapSyncronizationResponse syncResponse) { try { LdapSyncronizationHistoryItem result = null; using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { dbProvider.BeginTransaction(); const string TABLE_NAME = "DPA_LDAP_SYNC_HISTORY"; DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("I_INSERT_LDAP_SYNC_HISTORY_ITEM"); queryDef.setParam("colId", DocsPaDbManagement.Functions.Functions.GetSystemIdColName()); queryDef.setParam("idValue", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal(TABLE_NAME)); queryDef.setParam("idAmm", idAmministrazione); queryDef.setParam("userId", this.NormalizeStringValue(syncResponse.User)); queryDef.setParam("syncDate", DocsPaDbManagement.Functions.Functions.GetDate()); queryDef.setParam("itemsSync", syncResponse.ItemsSyncronized.ToString()); queryDef.setParam("errorDetails", this.NormalizeStringValue(syncResponse.ErrorDetails)); string commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected; if (dbProvider.ExecuteNonQuery(commandText, out rowsAffected)) { if (rowsAffected == 1) { commandText = DocsPaDbManagement.Functions.Functions.GetQueryLastSystemIdInserted(TABLE_NAME); logger.Debug(commandText); string field; if (dbProvider.ExecuteScalar(out field, commandText)) { result = new LdapSyncronizationHistoryItem(); result.Id = Convert.ToInt32(field); result.User = syncResponse.User; result.Date = syncResponse.Date; result.ErrorDetails = syncResponse.ErrorDetails; dbProvider.CommitTransaction(); } } } else { throw new ApplicationException("Errore in esecuzione query I_INSERT_LDAP_SYNC_HISTORY_ITEM"); } } return(result); } catch (Exception ex) { string errorMessage = "Errore nell'aggiornamento delle informazioni sulla sincronizzazione LDAP effettuata per l'amministrazione"; logger.Debug(errorMessage, ex); throw new ApplicationException(errorMessage, ex); } }
/// <summary> /// Save delle informazioni per l'integrazione docspa / ldap /// </summary> /// <param name="idAmministrazione"></param> /// <param name="ldapInfo"></param> public void SaveLdapConfig(string idAmministrazione, LdapConfig ldapInfo) { try { using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("S_CONTAINS_LDAP_CONFIG"); queryDef.setParam("idAmm", idAmministrazione); string commandText = queryDef.getSQL(); logger.Debug(commandText); string field; if (dbProvider.ExecuteScalar(out field, commandText)) { string queryName = string.Empty; if (Convert.ToInt32(field) > 0) { queryName = "U_UPDATE_LDAP_CONFIG"; } else { queryName = "I_INSERT_LDAP_CONFIG"; } queryDef = DocsPaUtils.InitQuery.getInstance().getQuery(queryName); queryDef.setParam("idAmm", idAmministrazione); queryDef.setParam("serverName", this.NormalizeStringValue(ldapInfo.ServerName)); queryDef.setParam("groupDN", this.NormalizeStringValue(ldapInfo.GroupDN)); queryDef.setParam("userId", this.NormalizeStringValue(ldapInfo.UserAttributes.UserId)); queryDef.setParam("email", this.NormalizeStringValue(ldapInfo.UserAttributes.Email)); queryDef.setParam("matricola", this.NormalizeStringValue(ldapInfo.UserAttributes.Matricola)); queryDef.setParam("nome", this.NormalizeStringValue(ldapInfo.UserAttributes.Nome)); queryDef.setParam("cognome", this.NormalizeStringValue(ldapInfo.UserAttributes.Cognome)); queryDef.setParam("sede", this.NormalizeStringValue(ldapInfo.UserAttributes.Sede)); commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected; if (!dbProvider.ExecuteNonQuery(commandText, out rowsAffected)) { throw new ApplicationException(string.Format("Errore in esecuzione query {0}", queryName)); } else { if (!string.IsNullOrEmpty(ldapInfo.DomainUserName) && !string.IsNullOrEmpty(ldapInfo.DomainUserPassword)) { this.SetLdapConfigDomainCredentials(idAmministrazione, ldapInfo.DomainUserName, ldapInfo.DomainUserPassword); } } } else { throw new ApplicationException("Errore in esecuzione query S_CONTAINS_LDAP_CONFIG"); } } } catch (Exception ex) { string errorMessage = "Errore nell'aggiornamento delle configurazione LDAP per l'amministrazione"; logger.Debug(errorMessage, ex); throw new ApplicationException(errorMessage, ex); } }
/// <summary> /// Aggiornamento legame funzione - tipo funzione /// </summary> /// <param name="dbProvider"></param> /// <param name="funzione"></param> /// <returns></returns> internal static bool Update(DBProvider dbProvider, OrgFunzione funzione) { bool retValue = false; bool insertMode = (funzione.StatoFunzione == DocsPaVO.amministrazione.OrgFunzione.StatoOrgFunzioneEnum.Inserted); bool deleteMode = (funzione.StatoFunzione == DocsPaVO.amministrazione.OrgFunzione.StatoOrgFunzioneEnum.Deleted); DocsPaUtils.Query queryDef = null; string commandText = string.Empty; if (insertMode) { // Inserimento del legame tra tipo funzione e anagrafica funzione queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("AMM_I_INSERT_FUNZIONE_ELEMENTARE"); queryDef.setParam("colSystemID", DocsPaDbManagement.Functions.Functions.GetSystemIdColName()); queryDef.setParam("systemID", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal(null)); queryDef.setParam("codiceFunzione", GetStringParameterValue(funzione.FunzioneAnagrafica.Codice)); queryDef.setParam("idTipoFunzione", funzione.IDTipoFunzione); queryDef.setParam("chaTipoFunz", GetStringParameterValue(funzione.FunzioneAnagrafica.TipoFunzione)); queryDef.setParam("descrizioneFunzione", GetStringParameterValue(funzione.FunzioneAnagrafica.Codice)); queryDef.setParam("idAmm", funzione.IDAmministrazione); } else if (deleteMode) { // Cancellazione del legame tra tipo funzione e anagrafica funzione queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("AMM_D_DELETE_FUNZIONE_ELEMENTARE"); queryDef.setParam("systemID", funzione.ID); } commandText = queryDef.getSQL(); logger.Debug(commandText); int rowsAffected = 0; try { retValue = dbProvider.ExecuteNonQuery(commandText, out rowsAffected); retValue = (retValue && rowsAffected == 1); if (retValue) { if (insertMode) { // Reperimento e impostazione systemID appena inserita commandText = DocsPaDbManagement.Functions.Functions.GetQueryLastSystemIdInserted(); logger.Debug(commandText); string outParam; retValue = dbProvider.ExecuteScalar(out outParam, commandText); if (retValue) { funzione.ID = outParam; } } else if (deleteMode) { // Funzione non più presente su database, // rimozione degli id funzione.ID = string.Empty; funzione.IDTipoFunzione = string.Empty; } // Impostazione dello stato della funzione funzione.StatoFunzione = DocsPaVO.amministrazione.OrgFunzione.StatoOrgFunzioneEnum.Unchanged; } } catch { retValue = false; } finally { } return(retValue); }
/// <summary> /// /// </summary> /// <param name="admin"></param> /// <param name="fileType"></param> /// <param name="containsFileModel"></param> /// <param name="brokenRules"></param> /// <returns></returns> private static bool UpdateFileModel(DBProvider provider, string admin, string fileType, bool containsFileModel, ArrayList brokenRules) { bool retValue = false; // Reperimento tipi documento per l'amministrazione DocsPaUtils.Query queryDef = DocsPaUtils.InitQuery.getInstance().getQuery("U_SET_CONTAINS_FILE_MODEL_2"); if (containsFileModel) { queryDef.setParam("containsFileModel", "1"); } else { queryDef.setParam("containsFileModel", "0"); } queryDef.setParam("codiceAmministrazione", admin); queryDef.setParam("fileType", fileType); string commandText = queryDef.getSQL(); logger.Debug(commandText); bool disposeProvider = (provider == null); try { if (disposeProvider) { provider = new DBProvider(); provider.BeginTransaction(); } int rowsAffected; provider.ExecuteNonQuery(commandText, out rowsAffected); retValue = (rowsAffected == 1); if (!retValue) { brokenRules.Add(new BrokenRule("UPDATE_FILE_MODEL_ERROR", "Errore nell'aggiornamento del modello predefinito", BrokenRule.BrokenRuleLevelEnum.Error)); } } catch (Exception ex) { throw ex; } finally { if (disposeProvider) { if (retValue) { provider.CommitTransaction(); } else { provider.RollbackTransaction(); } provider.Dispose(); } } return(retValue); }