/// <summary> /// Intenta obtener el token del soap header del web service /// </summary> /// <returns></returns> public bool traerDatosToken() { bool bRta = false; try { byte[] data = new byte[Convert.ToInt32(System.Web.HttpContext.Current.Request.InputStream.Length)]; System.Web.HttpContext.Current.Request.InputStream.Position = 0; System.Web.HttpContext.Current.Request.InputStream.Read(data, 0, Convert.ToInt32(System.Web.HttpContext.Current.Request.InputStream.Length)); UTF8Encoding encoding = new UTF8Encoding(); string decodedString = encoding.GetString(data); // cargo el soap xml XmlDataDocument myXmlDocument = new XmlDataDocument(); myXmlDocument.LoadXml(decodedString); XmlNodeList xmlToken = myXmlDocument.GetElementsByTagName("token"); // genero el token SSOEncodedToken encToken = new SSOEncodedToken(); encToken.Token = xmlToken.Item(0).InnerText; token = Credencial.ObtenerCredencialEnWs(encToken); bRta = true; } catch (Exception ex) { bRta = false; } return(bRta); }
public void LoadMap(string mapStruct) { XmlDataDocument xmldoc = new XmlDataDocument(); XmlNodeList xmlnode; xmldoc.LoadXml(mapStruct); xmlnode = xmldoc.GetElementsByTagName("map"); XmlNode mapNode = xmlnode.Item(0); int cols = Convert.ToInt32(mapNode.Attributes["cols"].Value); int rows = Convert.ToInt32(mapNode.Attributes["rows"].Value); mapItems = new GameObject[rows, cols]; for (int i = 0; i <= mapNode.ChildNodes.Count - 1; i++) { XmlNode itemNode = mapNode.ChildNodes[i]; int row = Convert.ToInt32(itemNode.Attributes["row"].Value); int col = Convert.ToInt32(itemNode.Attributes["col"].Value); mapItems[row, col] = null; if (OnProcessXMLMap != null) { mapItems[row, col] = OnProcessXMLMap(itemNode.InnerText, row, col); } if (mapItems[row, col] != null) { mapItems[row, col].SetSize(new System.Windows.Size(engine.BlockSize, engine.BlockSize)); } } LoadMap(mapItems); }
private void LoadData() { try { if (!DesignMode) { using (StreamReader reader = File.OpenText(Settings.LanguageMappingFile)) { settings.LoadXml(reader.ReadToEnd()); if (settings != null) { PopulateProviders(); } } } int index = ProviderComboBox.FindString(Settings.Driver); if (index != -1) { ProviderComboBox.SelectedIndex = index; } } catch { } }
/// <summary> /// 修改一个菜单项。 /// </summary> /// <param name="doc"></param> public static void ModifyMenu(string xml) { XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(xml); Database database = DatabaseFactory.CreateDatabase(); DbConnection cnn = database.CreateConnection(); Database.OpenConnection(cnn); DbTransaction tran = Database.BeginTransaction(cnn); DbCommand command; try { XmlNode values = xmlDoc.FirstChild.FirstChild; command = database.GetSqlStringCommand("update Sys_Menus set Name=@Name,IconCls=@Icon,ImgUrl=@Img,Href=@Href,Target=@Targ,JSEvent=@JS where Guid=@Guid"); database.AddInParameter(command, "Guid", DbType.String, values.Attributes["Guid"].Value); database.AddInParameter(command, "Name", DbType.String, values.Attributes["Name"].Value); database.AddInParameter(command, "Icon", DbType.String, values.Attributes["IconCls"].Value); database.AddInParameter(command, "Img", DbType.String, values.Attributes["ImgUrl"].Value); database.AddInParameter(command, "Href", DbType.String, values.Attributes["Href"].Value); database.AddInParameter(command, "Targ", DbType.String, values.Attributes["Target"].Value); database.AddInParameter(command, "JS", DbType.String, values.Attributes["JSEvent"].Value); database.ExecuteNonQuery(command, tran); Database.CommitTransaction(tran); } catch { Database.RollbackTransaction(tran); } finally { Database.CloseConnection(cnn); } }
public XmlImporter(string xmlFilePath) { dataDocument.LoadXml(xmlFilePath); //root = Util.Xml.getRootElement(new File(xmlFilePath)); //dsNodes = Util.Xml.getChildNodes(root, "ds"); //arcNodes = Util.Xml.getChildNodes(root, "rra"); }
public HotelImage1(string Hotelcode) { string resultxml = GetImageXML(Hotelcode); //FileStream fs = new FileStream(@"E:\aravind\BookHotel\BookHotel\BookHotel\HotelXML\hotelsImage_712018_1844-RS.xml", FileMode.Open, FileAccess.Read); //xmldoc.Load(fs); //fs.Close(); xmldoc.LoadXml(resultxml); XmlNode xnod = xmldoc.DocumentElement; XmlNode xheader = xnod.ChildNodes[0]; XmlNode xbody = xnod.ChildNodes[1]; XmlNode xGetImageRS = xbody.ChildNodes[0]; try { XmlNode xhotellogo = xGetImageRS.ChildNodes[1].ChildNodes[0].ChildNodes[0]; logo = GetValue(xhotellogo.Attributes["Logo"]); } catch { logo = "images/No Image found.png"; } try { XmlNode xhotelImage = xGetImageRS.ChildNodes[1].ChildNodes[0].ChildNodes[1].ChildNodes[0]; Image = GetValue(xhotelImage.Attributes["Url"]); } catch { Image = "images/No Image found.png"; } //logo = "images/No Image found.png"; //Image = "images/No Image found.png"; }
public HotelPropertyFile(string searchid, string hcode) { string filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + hcode + "_Roomdet-RS.xml"); string result = File.ReadAllText(filePathRQ); xmldoc.LoadXml(result); CreateTables(); XmlNode xnod = xmldoc.DocumentElement; XmlNode xheader = xnod.ChildNodes[0]; XmlNode xbody = xnod.ChildNodes[1]; XmlNode xOTA_HotelAvailRS = xbody.ChildNodes[0]; txtinfo = culinfo.TextInfo; XmlNode xAppResult = xOTA_HotelAvailRS.ChildNodes[0]; string appresult = GetValue(xAppResult.Attributes["status"]); if (appresult.ToLower() == "complete") { AddXMLPropDescRS(xOTA_HotelAvailRS); PrepareRooms(); } else { Properrormsg = GetChildText(xAppResult.ChildNodes[0].ChildNodes[0], "stl:Message"); } }
public void SimpleLoad() { string xml001 = "<root/>"; XmlDataDocument doc = new XmlDataDocument(); DataSet ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml001), null); doc.LoadXml(xml001); string xml002 = "<root><child/></root>"; doc = new XmlDataDocument(); ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml002), null); doc.LoadXml(xml002); string xml003 = "<root><col1>test</col1><col1></col1></root>"; doc = new XmlDataDocument(); ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml003), null); doc.LoadXml(xml003); string xml004 = "<set><tab1><col1>test</col1><col1>test2</col1></tab1><tab2><col2>test3</col2><col2>test4</col2></tab2></set>"; doc = new XmlDataDocument(); ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml004), null); doc.LoadXml(xml004); }
public static LTSModel LoadLTSFromXML(string text) { LTSModel lts = new LTSModel(); XmlDataDocument doc = new XmlDataDocument(); doc.LoadXml(text); XmlNodeList sitesNodes = doc.GetElementsByTagName(Parsing.DECLARATION_NODE_NAME); foreach (XmlElement component in sitesNodes) { lts.Declaration = component.InnerText; } sitesNodes = doc.GetElementsByTagName(Parsing.PROCESSES_NODE_NAME); if (sitesNodes.Count > 0) { foreach (XmlElement component in sitesNodes[0].ChildNodes) { LTSCanvas canvas = new LTSCanvas(); canvas.LoadFromXml(component); lts.Processes.Add(canvas); } } return(lts); }
public HotelImageAj(string Hotelcode, string eximagefilename, string searchid, string ContextResult) { string resultxml = GetImageXMLContext(Hotelcode, searchid, ContextResult); xmldoc.LoadXml(resultxml); XmlNode xnod = xmldoc.DocumentElement; XmlNode xheader = xnod.ChildNodes[0]; XmlNode xbody = xnod.ChildNodes[1]; XmlNode xGetImageRS = xbody.ChildNodes[0]; try { XmlNode xhotellogo = xGetImageRS.ChildNodes[1].ChildNodes[0].ChildNodes[0]; logo = GetValue(xhotellogo.Attributes["Logo"]); } catch { // logo = "../images/No Image found.png"; logo = "N"; } try { XmlNode xhotelImage = xGetImageRS.ChildNodes[1].ChildNodes[0].ChildNodes[1].ChildNodes[0]; Image = GetValue(xhotelImage.Attributes["Url"]); } catch { //Image = "../images/No Image found.png"; Image = "N"; } }
public static PDDLModel LoadPDDLModelFromXML(string text) { PDDLModel pddlModel = new PDDLModel(); XmlDataDocument doc = new XmlDataDocument(); doc.LoadXml(text); XmlNodeList sitesNodes = doc.GetElementsByTagName(Parsing.PDDL_MODEL_NODE_NAME); pddlModel.SystemName = sitesNodes[0].ChildNodes[0].InnerText; sitesNodes = doc.GetElementsByTagName(Parsing.DOMAIN_NODE_NAME); if (sitesNodes[0].HasChildNodes) { var nameNode = ((XmlElement)sitesNodes[0]).GetElementsByTagName(Parsing.PDDL_FILE_NAME_TAG); var pathNode = ((XmlElement)sitesNodes[0]).GetElementsByTagName(Parsing.PDDL_FILE_PATH_TAG); var content = ReadFile(pathNode[0].InnerText); pddlModel.Domain = new PDDLFile(nameNode[0].InnerText, pathNode[0].InnerText, content); } //pddlModel.Domain = sitesNodes[0].ChildNodes[0].InnerText; sitesNodes = doc.GetElementsByTagName(Parsing.PROBLEM_NAME); if (sitesNodes.Count > 0) { int i = 0; foreach (XmlElement component in sitesNodes) { i++; string fName, fPath; XmlNodeList problemName = component.GetElementsByTagName(Parsing.PDDL_FILE_NAME_TAG); if (problemName == null || problemName.Count < 1) { fName = "problem" + i; } else { fName = problemName[0].InnerText; } XmlNodeList problemPath = component.GetElementsByTagName(Parsing.PDDL_FILE_PATH_TAG); if (problemPath == null || problemPath.Count < 1) { fPath = ""; } else { fPath = problemPath[0].InnerText; } string pddlContent = ReadFile(fPath); pddlModel.AddProblem(new PDDLFile(fName, fPath, pddlContent)); } } return(pddlModel); }
public static BPELModel LoadLTSFromXML(string text) { BPELModel lts = new BPELModel(); XmlDataDocument doc = new XmlDataDocument(); doc.LoadXml(text); XmlNodeList sitesNodes = doc.GetElementsByTagName(Parsing.ASSERTION_NODE_NAME); foreach (XmlElement component in sitesNodes) { lts.Assertion = component.InnerText; } sitesNodes = doc.GetElementsByTagName(Parsing.FILE_NODE_NAME); if (sitesNodes.Count > 0) { foreach (XmlElement component in sitesNodes) { lts.AddPath(component.GetAttribute(Parsing.PATH_ATTR_NODE_NAME)); } } return(lts); }
public void DecodeXml(string xml) { XmlDataDocument myXml = new XmlDataDocument(); Items.Clear(); myXml.LoadXml(xml); DecodeXML(myXml); }
// public EventHandler AuthorImported; // public void OnAuthorImported(EventArgs e) // { // if(AuthorImported != null) // AuthorImported(this, e); // } // // public EventHandler PublisherImported; // public void OnPublisherImported(EventArgs e) // { // if(PublisherImported != null) // PublisherImported(this, e); // } // // public EventHandler KeywordImported; // public void OnKeywordImported(EventArgs e) // { // if(KeywordImported != null) // KeywordImported(this, e); // } #endregion public void ImportEndNoteXmlText(string xml) { XmlDataDocument xmlDocument = new XmlDataDocument(); xmlDocument.LoadXml(xml); ImportEndNoteXml(xmlDocument); }
private void GetMethodResult(string s, ref int errCode, ref string strResult) { DSResponse objResponse = new DSResponse(); XmlDataDocument objXDoc = new XmlDataDocument(objResponse); objXDoc.LoadXml(s); errCode = objResponse.G2MgrResponse[0].errorCode; strResult = objResponse.G2MgrResponse[0].results; }
public static UMLModel LoadUMLModelFromXML(string text) { UMLModel umlModel = new UMLModel(); XmlDataDocument doc = new XmlDataDocument(); doc.LoadXml(text); XmlNodeList sitesNodes = doc.GetElementsByTagName(Parsing.UML_MODEL_NODE_NAME); umlModel.SystemName = sitesNodes[0].ChildNodes[0].InnerText; sitesNodes = doc.GetElementsByTagName(Parsing.ASSERTION_NODE_NAME); if (sitesNodes[0].ChildNodes[0] != null) { umlModel.Assertion = sitesNodes[0].ChildNodes[0].InnerText; } sitesNodes = doc.GetElementsByTagName(Parsing.DIAGRAMS_NODE_NAME); if (sitesNodes.Count > 0) { int i = 0; foreach (XmlElement component in sitesNodes[0].ChildNodes) { i++; string dName, dxmiContent; XmlNodeList diagramName = component.GetElementsByTagName(Parsing.DIAGRAM_NAME); if (diagramName == null || diagramName.Count < 1) { dName = "diagram" + i; } else { dName = diagramName[0].InnerText; } XmlNodeList xmiContent = component.GetElementsByTagName(Parsing.DIAGRAM_XMI_CONTENT); if (xmiContent == null || xmiContent.Count < 1) { dxmiContent = ""; } else { dxmiContent = xmiContent[0].InnerText; } umlModel.AddDiagram(new StateDiagram(dName, dxmiContent)); } } return(umlModel); }
public void TestLoadXml() { XmlDataDocument doc = new XmlDataDocument(); doc.LoadXml("<NewDataSet><TestTable><TestRow><TestColumn>1</TestColumn></TestRow></TestTable></NewDataSet>"); doc = new XmlDataDocument(); doc.LoadXml("<test>value</test>"); }
internal static string GetSummary(string html) { XmlDataDocument x = new XmlDataDocument(); x.LoadXml(string.Concat("<div> ", html, "</div>")); var p = x.GetElementsByTagName("p"); return(string.Concat(p[0].InnerText, "...")); }
public void ProcessAssembly(string source) { XmlReaderSettings settings = new XmlReaderSettings(); settings.ConformanceLevel = ConformanceLevel.Fragment; settings.IgnoreWhitespace = true; settings.IgnoreComments = true; XmlReader reader = null; try { reader = XmlReader.Create(source, settings); } catch (Exception e) { Tools.Error("Can't open file " + source, e.Message); } ResourceDataCollection data = new ResourceDataCollection(); AssemblyName assemblyName = new AssemblyName(); resources.Add(assemblyName, data); using (reader) { if (ReadHeader(assemblyName, reader)) { try { while (!reader.EOF) { reader.Read(); if (reader.Name == "NewDataSet") { string xml = reader.ReadOuterXml(); XmlDataDocument xmlDoc = new XmlDataDocument(); ResourceData.PrepareDataSet(xmlDoc.DataSet); xmlDoc.LoadXml(xml); ResourceData rd = new ResourceData(); rd.DataSet = xmlDoc.DataSet.Copy(); rd.ResourceName = rd.DataSet.Tables["MetaData"].Rows[0]["Name"].ToString(); rd.ResourceType = rd.DataSet.Tables["MetaData"].Rows[0]["Type"].ToString(); data.Add(rd); } } } catch (Exception e) { Tools.Error("Corruption in resources XML", e.Message); } } } }
public void TestMultipleLoadError() { DataSet ds = new DataSet(); ds.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null)); // If there is already data element, Load() fails. XmlDataDocument doc = new XmlDataDocument(ds); doc.LoadXml(xml); }
public bool Resolve(string xmlData) { bool success = false; XmlDataDocument xmlDataDocument = new XmlDataDocument(); xmlDataDocument.LoadXml(xmlData); XmlNode xNode = xmlDataDocument.SelectSingleNode("mxGraphModel"); XmlNodeList xNodeList = xNode.ChildNodes; foreach (XmlNode cNode in xNodeList) { if (cNode.Name == "root") { ktGraphXmlRoot root = new ktGraphXmlRoot(); XmlNodeList xRootNodeList = cNode.ChildNodes; foreach (XmlNode mNode in xRootNodeList) { if (mNode.Name == "UserNode") { ktGraphXmlUserNode node = new ktGraphXmlUserNode(); node.sn = mNode.Attributes["sn"].Value; node.name = mNode.Attributes["name"].Value; node.flowsn = mNode.Attributes["flowsn"].Value; node.nodetype = mNode.Attributes["nodetype"].Value; node.nodeovertime = mNode.Attributes["nodeovertime"].Value; node.description = mNode.Attributes["description"].Value; node.userids = mNode.Attributes["userids"].Value; node.roleids = mNode.Attributes["roleids"].Value; node.isauto = mNode.Attributes["isauto"].Value; node.application = mNode.Attributes["application"].Value; node.extraproperty = mNode.Attributes["extraproperty"].Value; node.remark = mNode.Attributes["remark"].Value; root.FlowNodes.Add(node); } else if (mNode.Name == "UserEdge") { ktGraphXmlUserEdge edge = new ktGraphXmlUserEdge(); edge.sn = mNode.Attributes["sn"].Value; edge.name = mNode.Attributes["name"].Value; edge.flowsn = mNode.Attributes["flowsn"].Value; edge.description = mNode.Attributes["description"].Value; edge.extraproperty = mNode.Attributes["extraproperty"].Value; edge.value = mNode.Attributes["value"].Value; root.FlowTransaction.Add(edge); } } } } return(success); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (this.txt_observacion.Text.Trim() == "") { this.lbl_error.Text = "Debe ingresar una observacion"; return; } XmlTextWriter xml = new XmlTextWriter(me, System.Text.Encoding.UTF8); xml.Formatting = Formatting.Indented; xml.Namespaces = true; xml.WriteStartDocument(false); xml.WriteStartElement("Root"); nline = 10000; for (int i = 0; i < gr_dato.Rows.Count; i++) { operacion_nomina(Convert.ToInt32(gr_dato.DataKeys[i].Values[0].ToString()), Convert.ToInt32(gr_dato.DataKeys[i].Values[1].ToString()), Convert.ToInt16(gr_dato.DataKeys[i].Values[5].ToString()), xml); } xml.WriteEndElement(); xml.WriteEndDocument(); xml.Flush(); me.Position = 0; string r = new StreamReader(me).ReadToEnd(); xml.Close(); me.Close(); string strPath = System.Configuration.ConfigurationManager.AppSettings["DIARIO_GENERAL"]; string path = strPath + id_inventario + "-" + DateTime.Now.ToString("dd-MM-yy") + ".xml"; XmlDataDocument xmDoc = new XmlDataDocument(); xmDoc.LoadXml(r); xmDoc.Save(path); string mrendir = new chequesBC().rendir_cheque(Convert.ToInt32(id_inventario), this.txt_observacion.Text.Trim(), Convert.ToInt32(this.total.Text)); this.ImageButton1.Enabled = false; this.lbl_error.Text = "CONTROL DE EGRESO REALIZADO CON EXITO"; }
public void TestMultipleLoadNoError() { DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt.Columns.Add("col1"); ds.Tables.Add(dt); XmlDataDocument doc = new XmlDataDocument(ds); doc.LoadXml(xml); }
public void XMLToDataSet(string sXML) { DetDs.Tables.Clear(); if (sXML == String.Empty) { return; } XmlDocument doc = new XmlDataDocument(); doc.LoadXml(sXML); XmlNodeList ndl = doc.SelectNodes("tournamentprize/players"); GetTableParameters(ndl); }
public static SortedDictionary <string, string> ParseXml(string response) { SortedDictionary <string, string> resData = new SortedDictionary <string, string>(); XmlDataDocument xmldoc = new XmlDataDocument(); xmldoc.LoadXml(response); XmlNodeList listnode = xmldoc.SelectSingleNode("/root").ChildNodes; foreach (XmlNode node in listnode) { resData.Add(node.Name, node.InnerText); } return(resData); }
private static string GetNameSpace(string url) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url + "?WSDL"); SetWebRequest(request); WebResponse response = request.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8); XmlDocument doc = new XmlDataDocument(); doc.LoadXml(sr.ReadToEnd()); sr.Close(); return(doc.DocumentElement.Attributes["targetNamespace"].Value); //return doc.SelectSingleNode("//targetNamespace").Value; }
public override List <BankTransfer> GetBankTransfers() { BankFileOperation = new SieradzFileOperation(); #pragma warning disable 618 XmlDocument xmlFile = new XmlDataDocument(); #pragma warning restore 618 List <BankTransfer> mBankTransferList = new List <BankTransfer>(); xmlFile.LoadXml(BankFileOperation.GetFileContent(SieradzBankFilesPathHolder.TransferFilesPath + @"mBankTransfers.xml")); foreach (var childNode in xmlFile.DocumentElement.ChildNodes) { mBankTransferList.Add(GetTransferEntry(xmlFile.GetElementsByTagName((string)childNode.GetType().GetProperty("Name").GetValue(childNode)).Item(0).OuterXml)); } return(mBankTransferList); }
/// <summary> /// Schema validator /// </summary> /// <param name="documentAsString">document to validate</param> public void Validate(string documentAsString) { this.logger.Trace("Schema validate xml document."); try { if (documentAsString == null) { throw new SchemaValidationInterceptionEmptyBodyException(); } XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(documentAsString); // ny udfording, find documentType via XmlReader eller ren string ? DocumentTypeConfig documentType = searcher.FindUniqueDocumentType(xmlDoc); if (string.IsNullOrEmpty(documentType.SchemaPath)) { // Empty schema path equal no schema exist. } else { SchemaStore schemaStore = new SchemaStore(); XmlSchemaSet XmlSchemaSet = schemaStore.GetCompiledXmlSchemaSet(documentType); SchemaValidator schemaValidator = new SchemaValidator(); ValidationEventHandler validationEventHandler = new ValidationEventHandler(ValidationCallBack); schemaValidator.SchemaValidateXmlDocument(documentAsString, XmlSchemaSet, validationEventHandler); } } catch (SchemaValidateDocumentFailedException ex) { this.logger.Debug("Schema validate xml document.", ex); throw ex; } catch (SchemaValidationFailedException ex) { this.logger.Debug("Schema validate xml document.", ex); throw ex; } catch (Exception ex) { this.logger.Error("Schema validate xml document.", ex); throw new SchemaValidateDocumentFailedException(ex); } this.logger.Trace("Schema validate xml document - Finish."); }
public void CreateFragmentBefore(string xmlFragment, string xPathBefore) { XmlDataDocument newDoc = new XmlDataDocument(); newDoc.LoadXml(xmlFragment); XmlNode newNode = _document.CreateDocumentFragment(); newNode.InnerXml = xmlFragment; XmlNode beforeNode = _document.SelectSingleNode(xPathBefore); if (_document.DocumentElement != null) { _document.DocumentElement.InsertBefore(newNode, beforeNode); _document.Save(XmlFilePath); } }
[ValidateInput(false)]//允许html public ActionResult ResetItemSortNo() { string returnUrl = DoRequest.GetFormString("returnurl").Trim(); string xmlString = DoRequest.GetFormString("xml", false).Replace("<", "<").Replace(">", ">"); try { XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(xmlString); List <ModifyRecommendList> items = new List <ModifyRecommendList>(); XmlNodeList nodes = xmlDoc.SelectNodes("items/item"); if (nodes != null) { #region 新增分类 foreach (XmlNode item in nodes) { ModifyRecommendList iem = new ModifyRecommendList(); iem.ri_id = Utils.StrToInt(item.Attributes["ItemID"].Value).ToString(); iem.sort_no = (Utils.IsNumber(item.Attributes["SortNo"].Value) ? (int.Parse(item.Attributes["SortNo"].Value)) : 1000).ToString(); items.Add(iem); } #endregion } int returnValue = -1; var res = ModifyRecommendItemSortNo.Do(items); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "保存成功 ^_^" })); } } catch (Exception) { return(Json(new { error = true, message = "Xml解析失败..." })); } return(Json(new { error = true, message = "保存失败" })); }