/// <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> /// Change the notification status from unread to read /// </summary> /// <returns></returns> public static bool ChangeStateReadNotification(DocsPaVO.Notification.Notification notify, bool isNotEnabledSetDataVistaGrd) { bool res = false; try { DocsPaDB.Query_DocsPAWS.NotificationDB notificationDB = new DocsPaDB.Query_DocsPAWS.NotificationDB(); res = notificationDB.ChangeStateReadNotification(notify, isNotEnabledSetDataVistaGrd); } catch (Exception e) { logger.Debug("Errore in BusinessLogic.ServiceNotifications.Notification - metodo: ChangeStateReadNotification ", e); } return(res); }
/// <summary> /// Aggiorna le notifiche legate all'system id del documento/fascicolo in base alle modifiche subite da quest'ultimo /// </summary> /// <param name="infoUtente"></param> /// <param name="typeOperation"></param> /// <param name="idObject"></param> /// <param name="domainObject"></param> /// <returns></returns> public static bool ModifyNotifications(InfoUtente infoUtente, TypeOperation[] typeOperation, string idObject, string domainObject) { bool result = false; try { DocsPaDB.Query_DocsPAWS.NotificationDB notificationDB = new DocsPaDB.Query_DocsPAWS.NotificationDB(); List <DocsPaVO.Notification.Notification> notificationList = notificationDB.GetNotificationsByIdObject(idObject, domainObject); if (notificationList != null && notificationList.Count > 0) { DocsPaVO.documento.SchedaDocumento schedaDoc = null; DocsPaVO.fascicolazione.Fascicolo project = null; if (notificationList[0].DOMAINOBJECT.Equals(ListDomainObject.DOCUMENT)) { schedaDoc = Documenti.DocManager.getDettaglioPerNotificaAllegati(infoUtente, notificationList[0].ID_OBJECT, notificationList[0].ID_OBJECT); } else if (notificationList[0].DOMAINOBJECT.Equals(ListDomainObject.FOLDER)) { project = Fascicoli.FascicoloManager.getFascicoloById(notificationList[0].ID_OBJECT, infoUtente); } DocsPaVO.Notification.Notification newNotification = ExecuteChangeItems(infoUtente, typeOperation, notificationList[0], schedaDoc, project); foreach (DocsPaVO.Notification.Notification notification in notificationList) { //Tutte le notifiche relative ad un documento o fascicolo hanno i valori dei campi item uguali notification.ITEMS = newNotification.ITEMS; //Le notifiche relative ad un documento o fascicolo posso avere ITEM_SPECIALIZED diverso(esempio note individuali o generali) notification.ITEM_SPECIALIZED = ExecuteChangeSpecializedItem(infoUtente, typeOperation, notification, schedaDoc, project).ITEM_SPECIALIZED; } result = notificationDB.UpdateNotifications(notificationList); } } catch (Exception e) { logger.Debug("Errore in BusinessLogic.ServiceNotifications.Notification - metodo: ModifyNotification ", e); } return(result); }
/// <summary> /// /// </summary> /// <returns></returns> public static bool CheckNotification(DocsPaVO.Notification.Notification notification) { bool res = false; try { DocsPaDB.Query_DocsPAWS.NotificationDB notificationDB = new DocsPaDB.Query_DocsPAWS.NotificationDB(); if (notification.MULTIPLICITY.Equals(DocsPaVO.Notification.Multiplicity.ONE)) { res = notificationDB.CheckNotification(notification.ID_EVENT, string.Empty, notification.ID_GROUP); } else { res = notificationDB.CheckNotification(notification.ID_EVENT, notification.ID_PEOPLE, notification.ID_GROUP); } } catch (Exception e) { logger.Debug("Errore in BusinessLogic.ServiceNotifications.Notification - metodo: CheckNotification ", e); } return(res); }
private static DocsPaVO.Notification.Notification ExecuteChangeSpecializedItem(InfoUtente infoUtente, TypeOperation[] typeOperation, DocsPaVO.Notification.Notification oldNotification, DocsPaVO.documento.SchedaDocumento schedaDoc, DocsPaVO.fascicolazione.Fascicolo project) { String dataAnnullamento = String.Empty; DocsPaVO.Notification.Notification newNotification = oldNotification; try { if (schedaDoc != null) { foreach (TypeOperation operation in typeOperation) { switch (operation) { case TypeOperation.CHANGE_OBJECT: newNotification.ITEM_SPECIALIZED = UpdateSpecializeItem(oldNotification.ITEM_SPECIALIZED, schedaDoc.oggetto.descrizione, "lblObjectDescription"); break; case TypeOperation.CHANGE_TYPE_DOC: newNotification.ITEM_SPECIALIZED = UpdateSpecializeItem(oldNotification.ITEM_SPECIALIZED, schedaDoc.tipologiaAtto.descrizione, "lblDocType"); break; case TypeOperation.CHANGE_SENDER: string mittente = string.Empty; switch (schedaDoc.tipoProto) { case "P": mittente = (schedaDoc.protocollo as DocsPaVO.documento.ProtocolloUscita).mittente.descrizione; break; case "A": mittente = (schedaDoc.protocollo as DocsPaVO.documento.ProtocolloEntrata).mittente.descrizione; break; case "I": mittente = (schedaDoc.protocollo as DocsPaVO.documento.ProtocolloInterno).mittente.descrizione; break; } newNotification.ITEM_SPECIALIZED = UpdateSpecializeItem(oldNotification.ITEM_SPECIALIZED, mittente, "lblSender"); break; } } } else if (project != null) { foreach (TypeOperation operation in typeOperation) { switch (operation) { case TypeOperation.CHANGE_OBJECT: newNotification.ITEM_SPECIALIZED = UpdateSpecializeItem(oldNotification.ITEM_SPECIALIZED, project.descrizione, "lblObjectDescription"); break; case TypeOperation.CHANGE_TYPE_PROJ: DocsPaVO.ProfilazioneDinamica.Templates templete = ProfilazioneDinamica.ProfilazioneFascicoli.getTemplateFascDettagli(project.systemID); if (templete != null && !string.IsNullOrEmpty(templete.DESCRIZIONE)) { newNotification.ITEM_SPECIALIZED = UpdateSpecializeItem(oldNotification.ITEM_SPECIALIZED, templete.DESCRIZIONE, "lblFascType"); } break; } } } } catch (Exception exc) { logger.Info("Errore in BusinessLogic.ServiceNotifications.Notification - metodo: ExecuteChangeNotifications", exc); throw exc; } return(newNotification); }
/// <summary> /// Aggiorna i campi, che sono stati modificati, sull'oggetto notifica in base all'elenco del tipo di operazioni di modifica in input /// </summary> /// <param name="infoUtente"></param> /// <param name="typeOperation"></param> /// <param name="oldNotification"></param> /// <returns>Restituisce la notifica con i campi variati aggiornati</returns> private static DocsPaVO.Notification.Notification ExecuteChangeItems(InfoUtente infoUtente, TypeOperation[] typeOperation, DocsPaVO.Notification.Notification oldNotification, DocsPaVO.documento.SchedaDocumento schedaDoc, DocsPaVO.fascicolazione.Fascicolo project) { String dataAnnullamento = String.Empty; DocsPaVO.Notification.Notification newNotification = oldNotification; try { if (schedaDoc != null) { foreach (TypeOperation operation in typeOperation) { switch (operation) { case TypeOperation.CHANGE_OBJECT: newNotification.ITEMS.ITEM3 = schedaDoc.oggetto.descrizione; break; case TypeOperation.CHANGE_TYPE_DOC: string segnaturaRepertorio = Documenti.DocManager.GetSegnaturaRepertorio(schedaDoc.systemId, infoUtente.idAmministrazione, false, out dataAnnullamento); if (!string.IsNullOrEmpty(segnaturaRepertorio)) { newNotification.ITEMS.ITEM4 = TagItem.LABEL + "lblRepertorio" + TagItem.CLOSE_LABEL + TagItem.COLORRED + segnaturaRepertorio + TagItem.CLOSE_COLORRED; } break; case TypeOperation.RECORD_PREDISPOSED: newNotification.ITEMS.ITEM1 = schedaDoc.systemId; newNotification.ITEMS.ITEM2 = TagItem.COLORRED + schedaDoc.protocollo.segnatura + TagItem.CLOSE_COLORRED + GetLabelTypeProto(schedaDoc.tipoProto); break; case TypeOperation.CHANGE_TYPE_PROTO: newNotification.ITEMS.ITEM1 = schedaDoc.systemId + GetLabelTypeProto(schedaDoc.tipoProto); break; case TypeOperation.ABORT_RECORD: newNotification.ITEMS.ITEM2 = TagItem.COLORRED_STRIKE + schedaDoc.protocollo.segnatura + TagItem.CLOSE_COLORRED_STRIKE + GetLabelTypeProto(schedaDoc.tipoProto); break; case TypeOperation.ABORT_COUNTER_REPERTOIRE: newNotification.ITEMS.ITEM4 = oldNotification.ITEMS.ITEM4.Replace(TagItem.COLORRED, TagItem.COLORRED_STRIKE). Replace(TagItem.CLOSE_COLORRED, TagItem.CLOSE_COLORRED_STRIKE); break; } } } else if (project != null) { foreach (TypeOperation operation in typeOperation) { switch (operation) { case TypeOperation.CHANGE_OBJECT: newNotification.ITEMS.ITEM3 = project.descrizione; break; } } } } catch (Exception exc) { logger.Info("Errore in BusinessLogic.ServiceNotifications.Notification - metodo: ExecuteChangeNotifications", exc); throw exc; } return(newNotification); }