/// <summary> /// Inserimento di un nuovo contesto procedurale /// </summary> /// <param name="contesto"></param> /// <returns></returns> public bool InsertContestoProcedurale(DocsPaVO.FlussoAutomatico.ContestoProcedurale contesto) { bool result = false; string query; try { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_CONTESTO_PROCEDURALE"); if (DBType.ToUpper().Equals("ORACLE")) { q.setParam("systemId", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_CONTESTO_PROCEDURALE")); } q.setParam("tipoContesto", contesto.TIPO_CONTESTO_PROCEDURALE); q.setParam("nome", contesto.NOME); q.setParam("famiglia", contesto.FAMIGLIA); q.setParam("versione", contesto.VERSIONE); query = q.getSQL(); logger.Debug("InsertContestoProcedurale: " + query); if (ExecuteNonQuery(query)) { result = true; } } catch (Exception e) { logger.Error("Errore in InsertContestoProcedurale: " + e.Message); } return(result); }
public bool InsertFlussoProcedurale(DocsPaVO.FlussoAutomatico.Flusso flusso) { bool result = false; string query; try { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_FLUSSO_PROCEDURALE"); if (DBType.ToUpper().Equals("ORACLE")) { q.setParam("systemId", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_FLUSSO_PROCEDURALE")); } q.setParam("idProcesso", flusso.ID_PROCESSO); q.setParam("idMessaggio", flusso.MESSAGGIO.ID); q.setParam("dataArrivo", DocsPaDbManagement.Functions.Functions.GetDate()); q.setParam("idProfile", flusso.INFO_DOCUMENTO.ID_PROFILE); q.setParam("nomeRegistroIn", string.IsNullOrEmpty(flusso.INFO_DOCUMENTO.NOME_REGISTRO_IN) ? string.Empty : flusso.INFO_DOCUMENTO.NOME_REGISTRO_IN); q.setParam("numeroRegistroIn", string.IsNullOrEmpty(flusso.INFO_DOCUMENTO.NUMERO_REGISTRO_IN) ? "null" : flusso.INFO_DOCUMENTO.NUMERO_REGISTRO_IN); q.setParam("dataRegistroIn", string.IsNullOrEmpty(flusso.INFO_DOCUMENTO.DATA_REGISTRO_IN) ? "null" : DocsPaDbManagement.Functions.Functions.ToDate(flusso.INFO_DOCUMENTO.DATA_REGISTRO_IN)); query = q.getSQL(); logger.Debug("InsertFlussoProcedurale: " + query); if (ExecuteNonQuery(query)) { result = true; } } catch (Exception e) { logger.Error("Errore in InsertFlussoProcedurale: " + e.Message); } return(result); }
/// <summary> /// copy of the notification removed from the notification center in the history /// </summary> public bool InsertIntoHistory(DocsPaVO.Notification.Notification notification) { try { int res; string values = string.Empty; string query; DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_NOTIFY_HISTORY"); System.Text.StringBuilder strBuilder = new StringBuilder(); if (DBType.ToUpper().Equals("ORACLE")) { strBuilder.Append("seq.nextval, "); } strBuilder.Append(notification.ID_NOTIFY + ", "); strBuilder.Append(notification.ID_EVENT + ", "); strBuilder.Append("'" + notification.PRODUCER.Replace("'", "''") + "', "); strBuilder.Append(notification.ID_PEOPLE + ", "); strBuilder.Append(notification.ID_GROUP + ", "); strBuilder.Append("'" + notification.TYPE_NOTIFICATION + "', "); strBuilder.Append(DocsPaDbManagement.Functions.Functions.ToDate(notification.DTA_NOTIFY.ToString()) + ", "); //if (dbType.ToUpper() == "SQL") // strBuilder.Append("CONVERT(DATETIME,'" + notification.DTA_NOTIFY.ToShortDateString() + " " + notification.DTA_NOTIFY.ToLongTimeString() + "',103), "); //else // strBuilder.Append("to_date('" + notification.DTA_NOTIFY.ToShortDateString() + " " + notification.DTA_NOTIFY.ToLongTimeString() + "','DD/MM/YYYY HH24:MI:SS'), "); strBuilder.Append("'" + notification.ITEMS.ITEM1.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.ITEMS.ITEM2.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.ITEMS.ITEM3.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.ITEMS.ITEM4.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.MULTIPLICITY.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.ITEM_SPECIALIZED.Replace("'", "''") + "', "); strBuilder.Append("'" + notification.TYPE_EVENT + "', "); strBuilder.Append("'" + notification.DOMAINOBJECT + "', "); strBuilder.Append(notification.ID_OBJECT + ", "); strBuilder.Append(notification.ID_SPECIALIZED_OBJECT + ", "); strBuilder.Append(DocsPaDbManagement.Functions.Functions.ToDate(notification.DTA_EVENT.ToString()) + ", "); //if (dbType.ToUpper() == "SQL") // strBuilder.Append("CONVERT(DATETIME,'" + notification.DTA_EVENT.ToShortDateString() + " " + notification.DTA_EVENT.ToLongTimeString() + "',103), "); //else // strBuilder.Append("to_date('" + notification.DTA_EVENT.ToShortDateString() + " " + notification.DTA_EVENT.ToLongTimeString() + "','DD/MM/YYYY HH24:MI:SS'), "); strBuilder.Append("'" + notification.READ_NOTIFICATION + "', "); strBuilder.Append("'" + notification.NOTES + "' "); values = strBuilder.ToString(); q.setParam("values", values); query = q.getSQL(); this.ExecuteNonQuery(query, out res); if (res > 0) { return(true); } else { return(false); } } catch (Exception exc) { throw exc; } }
/// <summary> /// Metodo per la creazione di un reminder /// </summary> /// <param name="task"></param> /// <param name="infoUtente"></param> /// <returns></returns> public bool InsertReminder(DocsPaVO.Task.Task task, string subject, DocsPaVO.utente.InfoUtente infoUtente) { bool result = false; string query = string.Empty; string function = "DocsPaDb.Query_DocsPAWS.Reminder.InsertReminder"; logger.DebugFormat("{0} - START ", function); if (task == null) { logger.DebugFormat("{0} - Parameter task is null", function); logger.DebugFormat("{0} - END "); return(false); } try { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_REMINDER"); if (DBType.ToUpper().Equals("ORACLE")) { q.setParam("IdReminder", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_REMINDER")); } q.setParam("IdTask", task.ID_TASK); q.setParam("IdUtenteMitt", task.UTENTE_MITTENTE.idPeople); q.setParam("IdUtenteDest", task.UTENTE_DESTINATARIO.idPeople); q.setParam("DtaScadenza", DocsPaDbManagement.Functions.Functions.ToDate(task.STATO_TASK.DATA_SCADENZA)); q.setParam("NumInvii", "0"); q.setParam("Descr", GetStringParameterValue(subject)); query = q.getSQL(); logger.DebugFormat("{0} - {1} ", function, query); if (!ExecuteNonQuery(query)) { throw new Exception("Errore durante la creazione del reminder: " + query); } result = true; } catch (Exception e) { logger.Error(function, e); } logger.DebugFormat("{0} - END", function); return(result); }
/// <summary> /// Riapre la lavorazione del task /// </summary> /// <param name="task"></param> /// <returns></returns> public bool RiapriLavorazioneTask(DocsPaVO.Task.Task task) { //La riapertura del task consiste nell'inserire un nuovo record nella dpa_stato_task bool result = false; logger.Debug("Inizio Metodo RiapriLavorazioneTask in DocsPaDb.Query_DocsPAWS.Task"); try { if (task != null) { DocsPaUtils.Query 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", task.ID_TASK); q.setParam("dataApertura", DocsPaDbManagement.Functions.Functions.GetDate()); q.setParam("dataScadenza", DocsPaDbManagement.Functions.Functions.ToDate(task.STATO_TASK.DATA_SCADENZA)); q.setParam("stato", "R"); q.setParam("noteRiapertura", string.IsNullOrEmpty(task.STATO_TASK.NOTE_RIAPERTURA) ? string.Empty : task.STATO_TASK.NOTE_RIAPERTURA.Replace("'", "''")); string query = q.getSQL(); logger.Debug("InsertStatoTask: " + query); if (ExecuteNonQuery(query)) { q = DocsPaUtils.InitQuery.getInstance().getQuery("U_DPA_TASK_ID_ID_PROFILE_REVIEW"); q.setParam("idTask", task.ID_TASK); query = q.getSQL(); logger.Debug("UpdateCotributo: " + query); if (ExecuteNonQuery(query)) { result = true; } } } } catch (Exception e) { logger.Error("Errore in DocsPaDb.Query_DocsPAWS.Task - Metodo RiapriLavorazioneTask", e); } return(result); }
/// <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); }
/// <summary> /// Writes the notifications associated with the event. /// </summary> /// <param name="e"></param> /// <returns>Returns true if the notifications have been properly generated false otherwise</returns> public bool WriteEventNotifications(Event e) { bool res = true; string castDate = ConfigurationManager.AppSettings["CAST_DATE"]; try { if (e.NOTIFICATIONS != null && e.NOTIFICATIONS.Count > 0) { this.BeginTransaction(); foreach (Notification notification in e.NOTIFICATIONS) { DocsPaUtils.Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_DPA_NOTIFY"); System.Text.StringBuilder strBuilder = new StringBuilder(); if (DBType.ToUpper().Equals("ORACLE")) { strBuilder.Append("seq.nextval,"); } strBuilder.Append(e.SYSTEM_ID.ToString() + ","); strBuilder.Append("'" + e.ACTORS.PRODUCER.DES_PRODUCER.Replace("'", "''") + "',"); strBuilder.Append(notification.RECIPIENT.ID_USER.ToString() + ","); strBuilder.Append(notification.RECIPIENT.ID_ROLE.ToString() + ","); strBuilder.Append("'" + notification.TYPE_NOTIFY + "',"); strBuilder.Append(DocsPaDbManagement.Functions.Functions.GetDate() + ","); if (notification.ITEMS.GetType() == typeof(ItemsDocument)) { strBuilder.Append("'" + (notification.ITEMS as ItemsDocument).ID_OBJECT.Replace("'", "''") + "',"); strBuilder.Append("'" + (notification.ITEMS as ItemsDocument).SEGNATURA.Replace("'", "''") + "',"); strBuilder.Append("'" + (notification.ITEMS as ItemsDocument).ITEM_DESCRIPTION.Replace("'", "''").Replace("°", DocsPaDbManagement.Functions.Functions.convertDegre()) + "',"); strBuilder.Append("'" + (notification.ITEMS as ItemsDocument).LIST_NUMBER.Replace("'", "''") + "',"); } else if (notification.ITEMS.GetType() == typeof(ItemsFolder)) { strBuilder.Append("'" + (notification.ITEMS as ItemsFolder).ID_OBJECT.Replace("'", "''") + "',"); strBuilder.Append("null,"); strBuilder.Append("'" + (notification.ITEMS as ItemsFolder).ITEM_DESCRIPTION.Replace("'", "''").Replace("°", DocsPaDbManagement.Functions.Functions.convertDegre()) + "',"); strBuilder.Append("null,"); } strBuilder.Append("'" + e.MULTIPLICITY + "',"); strBuilder.Append("'" + notification.ITEMS.ITEM_SPECIALIZED.Replace("'", "''").Replace("°", DocsPaDbManagement.Functions.Functions.convertDegre()) + "',"); strBuilder.Append("'" + e.TYPE_EVENT + "',"); strBuilder.Append("'" + e.DOMAIN_OBJECT + "',"); strBuilder.Append(e.ID_OBJECT + ","); strBuilder.Append(e.ID_SPECIALIZED_OBJECT + ","); strBuilder.Append(DocsPaDbManagement.Functions.Functions.ToDate(e.DTA_EVENT) + ","); strBuilder.Append("'0',"); strBuilder.Append("'" + e.COLOR + "',"); strBuilder.Append("null"); q.setParam("value", strBuilder.ToString()); string query = q.getSQL(); if (!this.ExecuteNonQuery(query)) { this.RollbackTransaction(); CloseConnection(); return(false); } } this.CommitTransaction(); CloseConnection(); } } catch (Exception exc) { // traccia l'eccezione nel file di log logger.Error(exc); this.RollbackTransaction(); CloseConnection(); res = false; } return(res); }