/// <summary> /// crea una richiesta per l'inserimento in Parer di un documento /// </summary> /// <returns></returns> private static UnitaDocumentaria GetRequestForParer(Document thisDocument, ParerContext thisContext, string TipoDocumento, string Ambiente) { UnitaDocumentaria thisParerDoc = new UnitaDocumentaria(); ParerConfig thisConfig = new ParerConfig(); thisParerDoc = UnitaDocumetariaParerHelper.GetIntestazione(thisParerDoc, thisDocument, thisContext, Ambiente); thisParerDoc = UnitaDocumetariaParerHelper.GetConfigurazione(thisParerDoc, thisDocument, thisContext, thisConfig); thisParerDoc = UnitaDocumetariaParerHelper.GetDocumentoPrincipale(thisParerDoc, thisDocument); // thisParerDoc = UnitaDocumetariaParerHelper.GetFascicolo(thisParerDoc, thisDocument); thisParerDoc = UnitaDocumetariaParerHelper.GetProfilo(thisParerDoc, thisDocument); // non c'è gestione allegati // thisParerDoc = UnitaDocumetariaParerHelper.GetProfiloAllegati(thisParerDoc, thisDocument); thisParerDoc = UnitaDocumetariaParerHelper.GetProfiloCollegate(thisParerDoc, thisDocument); // Carica i dati specifici dei referti switch (TipoDocumento) { case "REFERTO": thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiReferto(thisParerDoc, thisDocument); break; case "MODELLO770": thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiModello770(thisParerDoc, thisDocument); break; case "CUD": thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiCUD(thisParerDoc, thisDocument); break; case "CEDOLINO STIPENDIALE": thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiCedolino(thisParerDoc, thisDocument); break; case "CEDOLINO STIPENDIALE CUMULATIVO": thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiCedolinoComulativo(thisParerDoc, thisDocument); break; case "MODELLOF24": // F24 non ha dati specifici // thisParerDoc = UnitaDocumetariaParerHelper.GetDatiSpecificiModelloF24(thisParerDoc, thisDocument); break; } return(thisParerDoc); }
public static string GetXmlRequestForParer(Document thisDocument, ParerContext thisContext, string TipoDocumento, string Ambiente) { UnitaDocumentaria thisParerDoc = GetRequestForParer(thisDocument, thisContext, TipoDocumento, Ambiente); return(GetXmlForUnitaDocumentaria(thisParerDoc)); }
public static string Send(string xmlParerDocument, Document thisDocument, ParerContext thisContext, string Ambiente) { string urlWebService; if (Ambiente == "PARER") { urlWebService = Settings.Default.HTTPVersamentoService_PROD; } else { urlWebService = Settings.Default.HTTPVersamentoService_PRE; } string userAgent = "Browser"; // Genera i dati della chiamata POST Dictionary <string, object> parametriPerPost = new Dictionary <string, object>(); parametriPerPost.Add("VERSIONE", "1.3"); parametriPerPost.Add("LOGINNAME ", thisContext.IdCliente); parametriPerPost.Add("PASSWORD ", thisContext.UserPwd); parametriPerPost.Add("XMLSIP", xmlParerDocument); // documento principale string IDDocumento = thisDocument.Documento.IDDocumentKey(0); parametriPerPost.Add(IDDocumento, new ParerSender.FileParameter(thisDocument.Documento.BytesDocumento, IDDocumento, "binary/octetstream")); // annessi /* * if (thisDocument._Annessi.Count > 0) * { * for (int iAnnesso = 0; iAnnesso < thisDocument._Annessi.Count; iAnnesso++) * { * string IDAnnesso = thisDocument._Annessi[iAnnesso].IDDocumentKey(iAnnesso + 1); * parametriPerPost.Add(IDAnnesso, new ParerSender.FileParameter(thisDocument._Annessi[iAnnesso].BytesDocumento, IDAnnesso, "binary/octetstream")); * } * } * * // allegati * if (thisDocument._Allegati.Count > 0) * { * for (int iAllegato = 0; iAllegato < thisDocument._Allegati.Count; iAllegato++) * { * string IDAllegato = thisDocument._Allegati[iAllegato].IDDocumentKey(iAllegato + 1); * parametriPerPost.Add(IDAllegato, new ParerSender.FileParameter(thisDocument._Allegati[iAllegato].BytesDocumento, IDAllegato, "binary/octetstream")); * } * } */ // Prepara la request e ottieni la response string fullResponse; #if DEBUG fullResponse = "<xml><message>DEBUG</message></xml>"; #else try { HttpWebResponse webResponse = ParerSender.MultipartFormDataPost(urlWebService, userAgent, parametriPerPost); // Elabora la response StreamReader responseReader = new StreamReader(webResponse.GetResponseStream()); fullResponse = responseReader.ReadToEnd(); webResponse.Close(); } catch (WebException e) { fullResponse = "<xml><message>" + e.Message + "</message></xml>"; } #endif return(fullResponse); }