/// <summary> /// Creazione di un nuovo oggetto "MezzoSpedizione" /// </summary> /// <param name="row"></param> /// <returns></returns> private static MezzoSpedizione GetMezzoSpedizione(DataRow row) { MezzoSpedizione m_sped = new MezzoSpedizione(); m_sped.IDSystem = row["ID_MEZZO_SPEDIZIONE"].ToString(); m_sped.chaTipoCanale = row["CHA_TIPO_CANALE"].ToString(); m_sped.Descrizione = row["DESCRIZIONE"].ToString(); m_sped.Disabled = row["DISABLED"].ToString(); return(m_sped); }
/// <summary> /// Reperimento di un mezzo di spedizione /// </summary> /// <param name="idMezzoSpedizione"></param> /// <returns></returns> public static MezzoSpedizione GetMezzoSpedizione(string idMezzoSpedizione) { MezzoSpedizione retValue = null; DocsPaDB.Query_DocsPAWS.Amministrazione dbAmm = new DocsPaDB.Query_DocsPAWS.Amministrazione(); DataSet ds = dbAmm.GetDsMezzoSpedizione(idMezzoSpedizione); dbAmm = null; if (ds != null && ds.Tables.Count > 0) { DataTable tableMezziSpedizione = ds.Tables["MEZZO_SPEDIZIONE"]; if (tableMezziSpedizione.Rows.Count == 1) { retValue = GetMezzoSpedizione(tableMezziSpedizione.Rows[0]); } } return(retValue); }
public static DocsPaVO.Validations.ValidationResultInfo DeleteMezzoSpedizione(MezzoSpedizione m_sped) { DocsPaVO.Validations.ValidationResultInfo retValue = CanUpdateMezzoSpedizione(m_sped); if (retValue.Value) { DocsPaDB.Query_DocsPAWS.Amministrazione dbAmm = new DocsPaDB.Query_DocsPAWS.Amministrazione(); retValue.Value = dbAmm.DeleteMezzoSpedizione(m_sped); } return(retValue); }
public static DocsPaVO.Validations.ValidationResultInfo CanUpdateMezzoSpedizione(MezzoSpedizione m_sped) { DocsPaVO.Validations.ValidationResultInfo retValue = new ValidationResultInfo(); DocsPaDB.Query_DocsPAWS.Amministrazione dbAmministrazione = new DocsPaDB.Query_DocsPAWS.Amministrazione(); string descrizione = dbAmministrazione.GetDescrizioneMezzoSpedizione(m_sped.IDSystem); if (!m_sped.Descrizione.ToUpper().Equals(descrizione)) { retValue.Value = false; } else { retValue.Value = true; } return(retValue); }
/// <summary> /// Verifica Verifica vincoli in inserimento di un tiporuolo /// </summary> /// <param name="tipoRuolo"></param> /// <returns></returns> public static DocsPaVO.Validations.ValidationResultInfo CanInsertMezzoSpedizione(MezzoSpedizione m_sped) { DocsPaVO.Validations.ValidationResultInfo retValue = new ValidationResultInfo(); // Verifica univocità descrizione mezzo di spedizione DocsPaDB.Query_DocsPAWS.Amministrazione dbAmm = new DocsPaDB.Query_DocsPAWS.Amministrazione(); retValue.Value = dbAmm.CheckUniqueDescrizioneMezzoSpedizione(m_sped.Descrizione); //if (!retValue.Value) // retValue.BrokenRules.Add(new DocsPaVO.Validations.BrokenRule("CODICE_TIPO_RUOLO", "Codice tipo ruolo già presente")); return(retValue); }
public static DocsPaVO.Validations.ValidationResultInfo InsertMezzoSpedizione(MezzoSpedizione m_sped) { DocsPaVO.Validations.ValidationResultInfo retValue = CanInsertMezzoSpedizione(m_sped); if (retValue.Value) { DocsPaDB.Query_DocsPAWS.Amministrazione dbAmm = new DocsPaDB.Query_DocsPAWS.Amministrazione(); retValue.Value = dbAmm.InsertMezzoSpedizione(m_sped); //if (!retValue.Value) //{ // // Errore nell'inserimento di un tipo ruolo // retValue.BrokenRules.Add( // new DocsPaVO.Validations.BrokenRule("DB_ERROR", "Errore in inserimento di un tipo ruolo")); //} } return(retValue); }
/// <summary> /// Creazione del documento nel sistema /// </summary> /// <param name="settings">Impostazioni relative al registro su cui creare il documento</param> /// <param name="senderInfo">Informazioni sul mittente della richiesta</param> /// <param name="interoperabilityMessage">Messaggio con le informazioni sulla richiesta di interoperabilità</param> /// <param name="userRole">Ruolo dell'utente da utilizzare per la creazione del documento</param> /// <param name="user">Utente da utilizzare per la creazione del documento</param> /// <returns>Scheda del documento creato</returns> private static SchedaDocumento CreateDocument(InteroperabilitySettings settings, Corrispondente senderInfo, InteroperabilityMessage interoperabilityMessage, Ruolo userRole, Utente user, String messageId) { // Recupero delle informazioni sull'utente da utilizzare come creatore del documento InfoUtente userInfo = UserManager.GetInfoUtente(user, userRole); // Creazione della scheda documento da restituire SchedaDocumento document = DocManager.NewSchedaDocumento(userInfo); // Recupero del registro su cui creare il predisposto Registro registry = RegistriManager.getRegistro(settings.RegistryId); // Recupero del mezzo di spedizione MezzoSpedizione channel = InfoDocManager.GetMezzoSpedizioneDaCodice("SIMPLIFIEDINTEROPERABILITY"); // Impostazione delle proprietà del documento try { if (!String.IsNullOrEmpty(interoperabilityMessage.MainDocument.FileName)) { document.appId = InteroperabilitaSegnatura.getApp(interoperabilityMessage.MainDocument.FileName).application; } } catch (Exception e) {} document.idPeople = user.idPeople; document.userId = user.userId; document.oggetto = new Oggetto() { descrizione = interoperabilityMessage.Record.Subject }; document.predisponiProtocollazione = true; document.registro = registry; document.tipoProto = "A"; document.typeId = "SIMPLIFIEDINTEROPERABILITY"; document.mezzoSpedizione = channel.IDSystem; document.descMezzoSpedizione = channel.Descrizione; document.interop = "S"; document.protocollatore = new Protocollatore(userInfo, userRole); document.privato = interoperabilityMessage.IsPrivate ? "1" : "0"; // Se la gestione dell'interoperabilità è manuale con mantenimento // del documento pendente, il documento viene creato privato e subito dopo // la creazione viene rimarcato come non privato if (settings.ManagementMode == ManagementType.M && settings.KeepPrivate) { document.privato = "1"; } // Preparazione dell'oggetto protocollo entrata ProtocolloEntrata proto = new ProtocolloEntrata(); proto.mittente = senderInfo; proto.dataProtocolloMittente = interoperabilityMessage.Record.RecordDate.ToString("dd/MM/yyyy HH:mm:ss"); proto.descrizioneProtocolloMittente = String.Format("{0}{1}{2}", interoperabilityMessage.Record.AOOCode, DocsPaDB.Utils.Personalization.getInstance(registry.idAmministrazione).getSepSegnatura(), interoperabilityMessage.Record.RecordNumber); document.protocollo = proto; // Se per l'amministrazione è configurata l'aggiunta di una nota visibile a tutti, // ne viene aggiunta una String value = DocsPaUtils.Configuration.InitConfigurationKeys.GetValue("0", "BE_NOTE_IN_SEGNATURA"); if (!String.IsNullOrEmpty(value) && value == "1" && !String.IsNullOrEmpty(interoperabilityMessage.Note)) { document.noteDocumento = new List <DocsPaVO.Note.InfoNota>() { new DocsPaVO.Note.InfoNota(interoperabilityMessage.Note, userInfo.idPeople, userInfo.idGruppo, DocsPaVO.Note.TipiVisibilitaNotaEnum.Tutti, String.Empty) { DaInserire = true } } } ; // Salvataggio del documento try { document = DocSave.addDocGrigia(document, userInfo, userRole); // Associazione del canale di spedizione al documento ProtoManager.collegaMezzoSpedizioneDocumento(userInfo, channel.IDSystem, document.systemId); } catch (Exception e) { SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(String.Empty, true, e.Message + " Id messaggio: " + messageId); throw new CreatingDocumentException("Errore durante la creazione del documento"); } // Se tutto è andato bene, la scheda documento ha ora il campo system id popolato, quindi viene aggiunta // una voce al log e viene aggiornato l'id profile per la voce nel registro dei messaggi ricevuti SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(document.systemId, false, String.Format("Documento relativo alla richiesta con id {0}, creato correttamente.", messageId)); SimplifiedInteroperabilityLogAndRegistryManager.SetIdProfileForMessage(messageId, document.systemId); // Impostazione delle informazioni aggiuntive e salvataggio del documento ((Documento)document.documenti[0]).dataArrivo = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); bool toUpdate; document = DocSave.save(userInfo, document, false, out toUpdate, userRole); string errPutFile = ""; try { // Associazione dell'immagine al documento String err = String.Empty; FileRequest request = document.documenti[0] as FileRequest; logger.DebugFormat("IS - Associa documento. Versionid {0}, Versionlabel {1}, version {2}", request.versionId, request.versionLabel, request.version); if (!String.IsNullOrEmpty(interoperabilityMessage.MainDocument.FileName)) { SimplifiedInteroperabilityFileManager.DownloadFile( interoperabilityMessage.MainDocument, interoperabilityMessage.Sender.AdministrationId, request, userInfo, interoperabilityMessage.Sender.FileManagerUrl, out errPutFile); } if (!string.IsNullOrEmpty(errPutFile)) { throw new Exception("Errore durante l'associazione dell'immagine al documento principale"); } } catch (Exception e) { SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog( document.systemId, true, String.Format("Errore durante l'associazione dell'immagine per il documento principale. Messaggio eccezione: {0}", e.Message)); if (!string.IsNullOrEmpty(errPutFile) && errPutFile.Contains("formato file")) { throw new DownloadDocumentException("Errore durante l'associazione dell'immagine al documento principale." + errPutFile + " destinataria."); } else { throw new DownloadDocumentException("Errore durante l'associazione dell'immagine al documento principale"); } } AddAttachments(document.docNumber, interoperabilityMessage.Attachments, userInfo, interoperabilityMessage.Sender.AdministrationId, interoperabilityMessage.Sender.FileManagerUrl); // Restituzione del documento salvato return(document); }