protected void btnHandLoad_Click(object sender, ImageClickEventArgs e) { try { int rowIndex = Convert.ToInt32(this.hidRowIndex.Value); string[] fileNames = this.grdLog.Rows[rowIndex].Cells[6].Text.Split('\\'); string fileName = fileNames[fileNames.Length - 1]; string path = "../../Logerror/" + DateTime.Now.ToShortDateString();; if (!Directory.Exists(Server.MapPath(path))) { Directory.CreateDirectory(Server.MapPath(path)); } XmlDocument doc = new XmlDocument(); doc.Load("http://" + Common.INTERFACESERVER + "/acctruewms/" + fileName); doc.Save(Server.MapPath(path) + "/" + fileName);//保存本地文件 MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTPClass(); xmlhttp.open("post", Common.NCWERBSERVER, false, "", ""); DOMDocument sDoc = new DOMDocument(); sDoc.loadXML(doc.InnerXml); xmlhttp.send(sDoc); if (xmlhttp.status == 200) { string comResult = ""; string comDes = ""; doc.LoadXml(xmlhttp.responseText); XmlElement rootRoot = doc.DocumentElement; string rootTag = rootRoot.GetAttribute("roottag"); XmlNode node = rootRoot.SelectSingleNode(rootTag + "/resultcode"); if (node != null) { comResult = node.InnerText.Trim(); } XmlNode nodeDes = rootRoot.SelectSingleNode(rootTag + "/resultdescription"); if (nodeDes != null) { comDes = nodeDes.InnerText.Trim(); } HtmlInputHidden hidCom = (HtmlInputHidden)this.grdLog.Rows[rowIndex].Cells[0].FindControl("hidComid"); string comID = hidCom.Value; int uResult = DataOperClass.ReLoadLog(comResult, comDes, comID); if (uResult == -1) { PrintfError("数据访问失败!"); return; } BindGridView(); PrintfError("手工加载成功"); } } catch { this.PrintfError("数据访问错误!"); return; } }
public static __XDocument Parse(string text) { var doc = new DOMDocument(); doc.loadXML(text); return(new __XDocument { InternalDocument = doc }); }
public void loadXML(string sXML) { try { _root.loadXML(sXML); } catch { throw; } }
public void Check(int idSolicitud, Eventos evento, string xmlContent) { if (idSolicitud == _idSolicitud) { prevXmlData = xmlData; xmlData = xmlContent; DOMDocument Xml = new DOMDocument(); Xml.loadXML(xmlData); root = Xml.documentElement; Ejecutar(T(Estado_Actual, evento)); } }
protected override void EnviarNotifDeAprobacion() { _statusDoc = (int)Estatus.REVISADO; //_Observacion = _index + 1 < _ruta.Length ? root.childNodes[3].text : string.Empty; _Observacion = string.Empty; bool _fecha = _index + 1 < _ruta.Length ? true : false; DOMDocument Xml = new DOMDocument(); Xml.loadXML(prevXmlData); IXMLDOMElement _root = Xml.documentElement; if (_index < _ruta.Length) { _staff_from = int.Parse(_root.childNodes[2].text); DataSet ds = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_BuscarEmpleadoEspecifico, _staff_from); _email_from = ds.Tables[0].Rows[0]["emp_str_email"].ToString(); } //string Mensaje = ConstruirMensaje(_idWorkflow,_Referencia,ENVIAR_NOTIF_DE_APROBACION,out _email_title, out _email_from_sys); //EmailHelper.SendEmail(ConfigurationSettings.AppSettings[WinflowAC.Global.CfgKeySmtpServer],_email_origen,_email_from_sys,_email_title,Mensaje,System.Web.Mail.MailFormat.Html); //===================================================== // NUEVO FORMA //===================================================== string Mensaje = ""; DataSet dstSolicitud = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_CargarDatosSolicitud, _idWorkflow, _Referencia); if (Convert.ToInt16(dstSolicitud.Tables[0].Rows[0]["posicion"]) == Convert.ToInt16(dstSolicitud.Tables[0].Rows[0]["num_aprob"])) // SI ES LA PROBACION FINAL { Mensaje = ConstruirMensajeAprobacion(_idWorkflow, _Referencia, ENVIAR_NOTIF_DE_APROBACION, out _email_title, out _email_from_sys); } else { Mensaje = ConstruirMensaje(_idWorkflow, _Referencia, ENVIAR_NOTIF_DE_APROBACION, out _email_title, out _email_from_sys); } EmailHelper.SendEmail(ConfigurationSettings.AppSettings[WinflowAC.Global.CfgKeySmtpServer], _email_origen, _email_from_sys, _email_title, Mensaje, System.Web.Mail.MailFormat.Html); dstSolicitud = null; //===================================================== //===================================================== _index++; // Se sale de este estado con un evento automático [Neutro] GuardarHistorico(_idSolicitud, _statusDoc, ENVIAR_NOTIF_DE_APROBACION, _Observacion, _index, _staff_from, _staff_to, prevXmlData, xmlData, _fecha); }
public IXMLDOMNode AddChildFromNode(IXMLDOMNode newNode, IXMLDOMNode Parent) { try { IXMLDOMElement xnod = _root.createElement(newNode.nodeName); DOMDocument doc = new DOMDocument(); doc.loadXML(newNode.xml); IXMLDOMNode xnodReturn = Parent.appendChild(doc.documentElement); return(xnodReturn); } catch { throw; } return(null); }
/// <summary> /// This method has to use the old XSL Processor because of the fact that the /// http://www.w3.org/TR/WD-xsl namespace is unsupported. /// /// The simplest way was to use the old xsl instead of re-inventing the wheel. /// I could not find a way to easily fully convert this to XSLT 1.0 due to /// the lack of namespace and cdata 'selectability'. /// /// This brings back memories :) /// </summary> /// <param name="xmlToRender">the xml string to render</param> /// <returns>HTML string</returns> internal static string Render(string xmlToRender) { XSLTemplate oXSLT; FreeThreadedDOMDocument oStyleSheet; IXSLProcessor oXSLTProc; DOMDocument oXMLSource; try { oXSLT = new XSLTemplate(); oStyleSheet = new FreeThreadedDOMDocument(); oXMLSource = new DOMDocument(); oStyleSheet.async = false; oStyleSheet.loadXML(XmlRender.XMLToHTML); oXSLT.stylesheet = oStyleSheet; oXSLTProc = oXSLT.createProcessor(); oXMLSource.async = false; oXMLSource.loadXML(xmlToRender); oXSLTProc.input = oXMLSource; oXSLTProc.transform(); return oXSLTProc.output.ToString(); } catch (Exception e) { return e.Message; } finally { oXSLT = null; oStyleSheet = null; oXMLSource = null; oXSLTProc = null; } }
/// <summary> /// This method has to use the old XSL Processor because of the fact that the /// http://www.w3.org/TR/WD-xsl namespace is unsupported. /// /// The simplest way was to use the old xsl instead of re-inventing the wheel. /// I could not find a way to easily fully convert this to XSLT 1.0 due to /// the lack of namespace and cdata 'selectability'. /// /// This brings back memories :) /// </summary> /// <param name="xmlToRender">the xml string to render</param> /// <returns>HTML string</returns> internal static string Render(string xmlToRender) { XSLTemplate oXSLT; FreeThreadedDOMDocument oStyleSheet; IXSLProcessor oXSLTProc; DOMDocument oXMLSource; try { oXSLT = new XSLTemplate(); oStyleSheet = new FreeThreadedDOMDocument(); oXMLSource = new DOMDocument(); oStyleSheet.async = false; oStyleSheet.loadXML(XmlRender.XMLToHTML); oXSLT.stylesheet = oStyleSheet; oXSLTProc = oXSLT.createProcessor(); oXMLSource.async = false; oXMLSource.loadXML(xmlToRender); oXSLTProc.input = oXMLSource; oXSLTProc.transform(); return(oXSLTProc.output.ToString()); } catch (Exception e) { return(e.Message); } finally { oXSLT = null; oStyleSheet = null; oXMLSource = null; oXSLTProc = null; } }
public static string BuildMessage(string formatFile, params object[] parameterValues) { if (parameterValues == null) { return(null); } string xmlContent = "<root>"; for (int i = 0; i < parameterValues.Length; i++) { xmlContent += "<param" + i + ">" + parameterValues[i].ToString().Trim() + "</param" + i + ">"; } xmlContent += "</root>"; DOMDocument xslDoc = new DOMDocument(); DOMDocument xmlDoc = new DOMDocument(); xmlDoc.loadXML(xmlContent); xslDoc.load(formatFile); return(xmlDoc.transformNode(xslDoc)); }
private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { lock (msgQueue) { try { msg = msgQueue.Receive(new TimeSpan(0, 0, 3)); msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(objMensaje), typeof(Eventos) }); objM = (objMensaje)msg.Body; DOMDocument Xml = new DOMDocument(); bool exitoso = Xml.loadXML(objM._Input); if (exitoso) { IXMLDOMElement root = Xml.documentElement; // primer parámetro : cod_workflow - segundo parámetro : str_referencia DataSet ds = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_ConsultarSolicitud, int.Parse(root.childNodes[0].text), root.childNodes[1].text); int nRows = ds.Tables[0].Rows.Count; int intCodCreador = 0; //+ Nuevo int intNumPosAct = 0; int intCodWF = 0; string strNumRef = string.Empty; string strDescRuta = string.Empty; int intEstatusWF = 0; int intEstatusDoc = 0; string strPrevXml = string.Empty; string strXml = string.Empty; int intCodEmpDesde = 0; int intCodEmpHasta = 0; bool blnActual = false; int intIndexActual = 0; //+ string strPrev = string.Empty; if (objM._Evento == Eventos.CREAR_SOLICITUD && nRows == 0) { CreateStateMachine(int.Parse(root.childNodes[0].text), root.childNodes[1].text, int.Parse(root.childNodes[2].text), root.childNodes[4].text); } else { SolicitudActual = Convert.ToInt32(ds.Tables[0].Rows[0]["swf_cod_solicitud"]); try { intCodCreador = Convert.ToInt32(ds.Tables[0].Rows[0]["hwf_cod_empleado_origen"]); strPrev = Convert.ToString(ds.Tables[0].Rows[0]["hwf_str_prevxmldata"]); } catch (Exception ee) { intCodCreador = 0; strPrev = string.Empty; System.Console.Write(ee.Message); } } IEnumerator arrayList = array.GetEnumerator(); if (objM._Evento == Eventos.CAMBIO_DE_DESTINATARIO) { //* Antes /* * bool blnActualCD=false; * int intIndexActualCD=0; * while ( arrayList.MoveNext() ) * { * blnActualCD=((StateMachine)arrayList.Current).Check(SolicitudActual); * intIndexActualCD++; * if(blnActualCD) * break; * * } */ //* ((StateProcSmpl)arrayList.Current).ActualizarAprobador(int.Parse(root.childNodes[2].text), SolicitudActual); ((StateMachine)arrayList.Current).Check(SolicitudActual, objM._Evento, objM._Input); // array.RemoveAt(intIndexActual-1); // StateMachine sMach = new StateProcSmpl(SolicitudActual,int.Parse(root.childNodes[0].text),root.childNodes[1].text,StateConst.ESPERAR_CORRECCION,root.childNodes[4].text,1,intCodCreador,strPrev); // array.Add(sMach); // sMach.Check(SolicitudActual,objM._Evento,objM._Input); } else { if (objM._Evento == Eventos.SOLICITUD_CORREGIDA) { blnActual = false; intIndexActual = 0; while (arrayList.MoveNext()) { blnActual = ((StateMachine)arrayList.Current).Check(SolicitudActual); intIndexActual++; if (blnActual) { break; } } array.RemoveAt(intIndexActual - 1); StateMachine sMach = new StateProcSmpl(SolicitudActual, int.Parse(root.childNodes[0].text), root.childNodes[1].text, StateConst.ESPERAR_CORRECCION, root.childNodes[4].text, 1, intCodCreador, strPrev); array.Add(sMach); // *Anterior //sMach.Check(SolicitudActual,objM._Evento,objM._Input); } // +Nuevo if ((objM._Evento == Eventos.SOLICITUD_APROBADA) || (objM._Evento == Eventos.RECHAZADO_PARCIAL) || (objM._Evento == Eventos.RECHAZADO_TOTAL)) { //+ Nuevo intNumPosAct = Convert.ToInt32(ds.Tables[0].Rows[0]["swf_num_posicion_actual"]); intCodWF = Convert.ToInt32(ds.Tables[0].Rows[0]["swf_cod_workflow"]); strNumRef = Convert.ToString(ds.Tables[0].Rows[0]["swf_str_referencia"]); strDescRuta = Convert.ToString(ds.Tables[0].Rows[0]["swf_desc_ruta"]); intEstatusWF = Convert.ToInt32(ds.Tables[0].Rows[0]["hwf_cod_estatuswkf"]); intEstatusDoc = Convert.ToInt32(ds.Tables[0].Rows[0]["hwf_cod_estatusdoc"]); strPrevXml = Convert.ToString(ds.Tables[0].Rows[0]["hwf_str_prevxmldata"]); strXml = Convert.ToString(ds.Tables[0].Rows[0]["hwf_str_xmldata"]); intCodEmpDesde = Convert.ToInt32(ds.Tables[0].Rows[0]["hwf_cod_empleado_origen"]); intCodEmpHasta = Convert.ToInt32(ds.Tables[0].Rows[0]["hwf_cod_empleado_destino"]); intCodCreador = Convert.ToInt32(ds.Tables[0].Rows[0]["swf_cod_empleado_creador"]); //+ blnActual = false; intIndexActual = 0; while (arrayList.MoveNext()) { blnActual = ((StateMachine)arrayList.Current).Check(SolicitudActual); intIndexActual++; if (blnActual) { break; } } if (blnActual) { array.RemoveAt(intIndexActual - 1); } StateMachine sMach = new StateProcSmpl((int)SolicitudActual, intCodWF, strNumRef, intEstatusWF, intEstatusDoc, strDescRuta, intNumPosAct, strPrevXml, strXml, intCodCreador, intCodEmpDesde, intCodEmpHasta); array.Add(sMach); } // + //*else //*{ arrayList = array.GetEnumerator(); while (arrayList.MoveNext()) { ((StateMachine)arrayList.Current).Check(SolicitudActual, objM._Evento, objM._Input); } //*} } } } catch { //arrayList = array.GetEnumerator(); EstadoActual = StateConst.INICIO; //while ( arrayList.MoveNext() ) //{ // ((StateMachine)arrayList.Current).Check(); // EstadoActual = ((StateMachine)arrayList.Current).EstadoActual; // if(EstadoActual == StateConst.FIN) // { // array.Remove(arrayList.Current); // } //} int i = 0, count = array.Count; while (i < count) { ((StateMachine)array[i]).Check(); EstadoActual = ((StateMachine)array[i]).EstadoActual; if (EstadoActual == StateConst.FIN) { array.RemoveAt(i); count--; } else { i++; } } arrayList = array.GetEnumerator(); } // end catch } }
//===================================================== // NUEVO FUNCION PARA APROBACION FINAL -- SEMAFORO VERDE //===================================================== private string ConstruirMensajeAprobacion(int idWorkflow, string Referencia, int idEstatusWkf, out string emailTitle, out string emailFromSys) { DataSet ds = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_ObtenerDatosEmail, idWorkflow, idEstatusWkf); Referencia = Referencia.Trim(); string workflowName = ds.Tables[0].Rows[0]["wkf_nbr_documento"].ToString(); string strAccion = " " + ds.Tables[0].Rows[0]["ewf_nbr_titulo"].ToString(); string explicacion = ds.Tables[0].Rows[0]["ewf_desc_explicacion"].ToString(); string strSubTitulo = ""; Label lblExplicacion = new Label(); lblExplicacion.ForeColor = System.Drawing.Color.Green; lblExplicacion.Font.Bold = true; lblExplicacion.Text = "ha sido APROBADO"; explicacion = lblExplicacion.Text; strAccion = ""; strSubTitulo = "DOCUMENTO APROBADO"; emailTitle = ""; emailFromSys = "SISTEMA_SPIN@soacat-ve"; DataSet dsSolicitante = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_ObtenerNombreSolicitante, idWorkflow, Referencia); string strSolicitante = dsSolicitante.Tables[0].Rows[0]["Solicitante"].ToString(); string strFechaSolicitud = dsSolicitante.Tables[0].Rows[0]["fecha_solicitud"].ToString(); string strData = ""; string strImagenSemaforo = "http://localhost/Spin/WF/bin/Debug/semaforo_verde.jpg"; emailTitle = "DOCUMENTO APROBADO" + " - " + workflowName; if ((idWorkflow >= 308 && idWorkflow <= 311) || (idWorkflow == 318)) // CIERRES DE AUXILIARES { DataSet dstProyecto = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_CargarInfProyectoPorReferencia, Convert.ToInt32(Referencia)); Referencia += " / Cliente: " + dstProyecto.Tables[0].Rows[0]["cliente"].ToString(); Referencia += " / Socio: " + dstProyecto.Tables[0].Rows[0]["socio"].ToString(); dstProyecto = null; } // param0 = Nombre del WF // param1 = Referencia // param2 = Fecha de solicitud // param3 = Explicación // param4 = Acción // param5 = Nombre solicitante // param6 = Imagen semáforo // param7 = Servidor string strServidor = System.Net.Dns.GetHostName(); strData += "<root><param0>" + workflowName + "</param0>"; strData += "<param1>" + Referencia + "</param1>"; strData += "<param2>" + strFechaSolicitud + "</param2>"; strData += "<param3>" + explicacion + "</param3>"; strData += "<param4>" + strAccion + "</param4>"; strData += "<param5>" + strSolicitante + "</param5>"; strData += "<param6>" + strImagenSemaforo + "</param6>"; strData += "<param7>" + strServidor + "</param7>"; strData += "<param8>" + strSubTitulo + "</param8></root>"; DOMDocument xslDoc = new DOMDocument(); DOMDocument xmlDoc = new DOMDocument(); xslDoc.load("WFNS001A.xsl"); xmlDoc.loadXML(strData); ds = null; dsSolicitante = null; return(xmlDoc.transformNode(xslDoc)); }
private string ConstruirMensaje(int idWorkflow, string Referencia, int idEstatusWkf, out string emailTitle, out string emailFromSys) { /* * DataSet ds = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(),Queries.WF_ObtenerDatosEmail,idWorkflow,idEstatusWkf); * * Referencia = Referencia.Trim(); * string workflowName = ds.Tables[0].Rows[0]["wkf_nbr_documento"].ToString(); * emailTitle = ds.Tables[0].Rows[0]["ewf_nbr_titulo"].ToString(); * string explicacion = ds.Tables[0].Rows[0]["ewf_desc_explicacion"].ToString(); * emailFromSys = "SISTEMA_SPIN@soacat-ve"; * * DataSet dsSolicitante = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(),Queries.WF_ObtenerNombreSolicitante,idWorkflow,Referencia); * string strSolicitante = dsSolicitante.Tables[0].Rows[0]["Solicitante"].ToString(); * string strData = ""; * * if( (idWorkflow >= 308 && idWorkflow <= 311) || ( idWorkflow == 318 ) ) // CIERRES DE AUXILIARES * { * DataSet dstProyecto = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(),Queries.WF_CargarInfProyectoPorReferencia,Convert.ToInt32(Referencia)); * Referencia += " / Cliente: " + dstProyecto.Tables[0].Rows[0]["cliente"].ToString(); * Referencia += " / Socio: " + dstProyecto.Tables[0].Rows[0]["socio"].ToString(); * } * * string strServidor=System.Net.Dns.GetHostName();//GetHostByAddress(Request.ServerVariables["REMOTE_ADDR"]).HostName; * strData += "<root><param0>"+workflowName+"</param0>"; * strData += "<param1>"+Referencia+"</param1>"; * strData += "<param2>"+strSolicitante+"</param2>"; * strData += "<param3>"+explicacion+"</param3>"; * strData += "<param4>"+strServidor+"</param4></root>"; * * DOMDocument xslDoc = new DOMDocument(); * DOMDocument xmlDoc = new DOMDocument(); * * xslDoc.load("EWIGF001A.xsl"); * xmlDoc.loadXML(strData); */ //===================================================== // NUEVO FORMATO DE CORREO //===================================================== DataSet ds = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_ObtenerDatosEmail, idWorkflow, idEstatusWkf); Referencia = Referencia.Trim(); string workflowName = ds.Tables[0].Rows[0]["wkf_nbr_documento"].ToString(); string strAccion = " " + ds.Tables[0].Rows[0]["ewf_nbr_titulo"].ToString(); string explicacion = ds.Tables[0].Rows[0]["ewf_desc_explicacion"].ToString(); emailTitle = ""; emailFromSys = "SISTEMA_SPIN@soacat-ve"; string strSubTitulo = ""; DataSet dsSolicitante = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_ObtenerNombreSolicitante, idWorkflow, Referencia); string strSolicitante = dsSolicitante.Tables[0].Rows[0]["Solicitante"].ToString(); string strFechaSolicitud = dsSolicitante.Tables[0].Rows[0]["fecha_solicitud"].ToString(); string strData = ""; string strImagenSemaforo = ""; if (idEstatusWkf == 310 || idEstatusWkf == 280) { if (idEstatusWkf == 310) // SOLICITADO { emailTitle = "Pendiente por " + strAccion + " - " + workflowName; } if (idEstatusWkf == 280) // RECHAZO PARCIAL { emailTitle = strAccion + " - " + workflowName; strAccion = ""; } strImagenSemaforo = "http://localhost/Spin/WF/bin/Debug/semaforo_amarillo.jpg"; strSubTitulo = strAccion + " DE DOCUMENTOS"; } if (idEstatusWkf == 250) // REVISADO { emailTitle = strAccion + " - " + workflowName; strImagenSemaforo = "http://localhost/Spin/WF/bin/Debug/semaforo_amarillo.jpg"; strSubTitulo = "DOCUMENTO " + strAccion; strAccion = ""; } if (idEstatusWkf == 270) // RECHAZO TOTAL { emailTitle = strAccion + " - " + workflowName; strImagenSemaforo = "http://localhost/Spin/WF/bin/Debug/semaforo_rojo.jpg"; strSubTitulo = strAccion + " DE DOCUMENTOS"; strAccion = ""; } if ((idWorkflow >= 308 && idWorkflow <= 311) || (idWorkflow == 318)) // CIERRES DE AUXILIARES { DataSet dstProyecto = SqlHelper.ExecuteDataset(WinflowAC.ConnectionString.FormarStringConexion(), Queries.WF_CargarInfProyectoPorReferencia, Convert.ToInt32(Referencia)); Referencia += " / Cliente: " + dstProyecto.Tables[0].Rows[0]["cliente"].ToString(); Referencia += " / Socio: " + dstProyecto.Tables[0].Rows[0]["socio"].ToString(); dstProyecto = null; } // param0 = Nombre del WF // param1 = Referencia // param2 = Fecha de solicitud // param3 = Explicación // param4 = Acción // param5 = Nombre solicitante // param6 = Imagen semáforo // param7 = Servidor // param8 = SubTitulo string strServidor = System.Net.Dns.GetHostName(); strData += "<root><param0>" + workflowName + "</param0>"; strData += "<param1>" + Referencia + "</param1>"; strData += "<param2>" + strFechaSolicitud + "</param2>"; strData += "<param3>" + explicacion + "</param3>"; strData += "<param4>" + strAccion + "</param4>"; strData += "<param5>" + strSolicitante + "</param5>"; strData += "<param6>" + strImagenSemaforo + "</param6>"; strData += "<param7>" + strServidor + "</param7>"; strData += "<param8>" + strSubTitulo + "</param8></root>"; DOMDocument xslDoc = new DOMDocument(); DOMDocument xmlDoc = new DOMDocument(); if ((idWorkflow >= 303 && idWorkflow <= 305) || (idWorkflow == 300) || (idWorkflow == 322)) // INFORMES DE GASTOS { if (idEstatusWkf == 270) // RECHAZO TOTAL { xslDoc.load("WFNS001A.xsl"); } else { xslDoc.load("WFIG001A.xsl"); } } else { xslDoc.load("WFNS001A.xsl"); } xmlDoc.loadXML(strData); ds = null; dsSolicitante = null; //===================================================== //===================================================== return(xmlDoc.transformNode(xslDoc)); }
protected void btndataUp_Click(object sender, ImageClickEventArgs e) { try { string YSDH = this.txtYSDH.Text.Trim(); DataSet dsYSDH = PDParam.GetPDDNC("YSDH = '" + YSDH + "'"); if (dsYSDH != null && dsYSDH.Tables[0].Rows.Count > 0) { string DJZT = dsYSDH.Tables[0].Rows[0]["DJZT"].ToString(); if (DJZT != "已盘") { this.PrintfError("只有审核过的单据才能上传"); return; } } else { this.PrintfError("没有可导出的数据"); return; } string Fdownweb = Common.RFWEBSERVER; // RF服务器地址 string Fuploadweb = Common.NCWERBSERVER; //NC服务器地址 string wmsserver = Common.INTERFACESERVER; //接口地址 //string Fdownweb = "http://192.168.1.171/";//测试地址 //string Fuploadweb = "http://localhost:800/WebSiteXML/Default.aspx"; //string wmsserver = "http://192.168.1.171/"; if ((string.IsNullOrEmpty(Fdownweb)) || (string.IsNullOrEmpty(Fuploadweb))) { this.PrintfError("服务器尚未正确设置"); } else { XmlDocument docC = new XmlDocument(); string filename = YSDH + ".xml"; docC.Load(Fdownweb + filename); //用XmlDocument类来下载Xml文件 DOMDocument doc = new DOMDocument(); XmlDocument resultdoc = new XmlDocument(); string xml = docC.InnerXml; doc.loadXML(docC.InnerXml); //将Xml文件赋给DOMDocument类型的doc IXMLDOMElement rootnode = doc.documentElement; bool XmlIsSended = PDParam.XmlIsSended(filename); if (XmlIsSended) { rootnode.setAttribute("replace", "Y"); rootnode.setAttribute("proc", "update"); } else { rootnode.setAttribute("replace", "N"); rootnode.setAttribute("proc", "add"); } string ArrSender = rootnode.getAttribute("sender").ToString(); string Aroottag = rootnode.getAttribute("roottag").ToString(); string ArrReceiver = rootnode.getAttribute("receiver").ToString(); rootnode.setAttribute("sender", ArrReceiver); rootnode.setAttribute("receiver", ArrSender); DataSet dsNCDetail = PDParam.GetNCDetail(YSDH, ""); string WLH; string PCH; string SX; string vfree1; string vfree2; string vfree3; string SPSL; string SPZL; IXMLDOMNode node; foreach (DataRow dr in dsNCDetail.Tables[0].Rows) { WLH = dr["barcode"].ToString(); PCH = dr["PCH"].ToString(); SX = dr["SX"].ToString(); vfree1 = dr["vfree1"].ToString(); vfree2 = dr["vfree2"].ToString(); vfree3 = dr["vfree3"].ToString(); SPSL = dr["SPSL"].ToString(); SPZL = dr["SPZL"].ToString(); //修改实盘数量 node = rootnode.selectSingleNode(Aroottag + "/bill_body/item[cinventorycode/text()='" + WLH + "'][vbatchcode/text()='" + PCH + "'][cqualitylevelname/text()='" + SX + "'][vfree1/text()='" + vfree1 + "'][vfree2/text()='" + vfree2 + "'][vfree3/text()='" + vfree3 + "']/ncheckastnum"); if (node != null) { node.text = SPSL; } node = rootnode.selectSingleNode(Aroottag + "/bill_body/item[cinventorycode/text()='" + WLH + "'][vbatchcode/text()='" + PCH + "'][cqualitylevelname/text()='" + SX + "'][vfree1/text()='" + vfree1 + "'][vfree2/text()='" + vfree2 + "'][vfree3/text()='" + vfree3 + "']/nchecknum"); if (node != null) { node.text = SPZL; } } //上传 MSXML2.XMLHTTP MyHttp = new MSXML2.XMLHTTPClass(); MyHttp.open("post", Fuploadweb, false, "", ""); MyHttp.send(doc); int ComResult = 0; string Comdes = string.Empty; if (MyHttp.status == 200) { resultdoc.LoadXml(MyHttp.responseText); XmlElement resultRootnode = resultdoc.DocumentElement; string Roottag = resultRootnode.GetAttribute("roottag"); XmlNode resultnode = resultRootnode.SelectSingleNode(Roottag + "/resultcode"); if (resultnode != null) { ComResult = Convert.ToInt32(resultnode.InnerText.Trim()); } resultnode = resultRootnode.SelectSingleNode(Roottag + "/resultdescription"); if (resultnode != null) { Comdes = resultnode.InnerText.Trim(); } } string CKID = dsYSDH.Tables[0].Rows[0]["CK"].ToString(); PDParam.AddXmlLog(CKID, filename, YSDH, Comdes, ComResult); if (ComResult == 1) { this.PrintfError("传输成功"); } else { this.PrintfError("传输失败"); } string apppathxml = "../../webinfo/xml"; string pathName = Server.MapPath(apppathxml); if (!Directory.Exists(pathName)) { Directory.CreateDirectory(pathName); } doc.save(pathName + "/" + filename); SaveLocalXml(doc, Aroottag, YSDH); } } catch { this.PrintfError("上传出现错误,请确认服务器地址是否正确"); return; } }
public NetUserInfo() { //initialize Object //Get net info const string apiUrl = "http://ipinfodb.com/ip_query.php"; var httpClient = new WebClient(); try { string response = httpClient.DownloadString(apiUrl); var xmlResponse = new DOMDocument(); xmlResponse.loadXML(response); const string r = " "; _xmlContent = xmlResponse.text.Split(r.ToCharArray()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }