public static bool UpdateStaut(string name, bool Staut) { try { bool result = false; XmlDocument xmlNode = ExpressHelper.GetXmlNode(); XmlNode xmlNode2 = xmlNode.SelectSingleNode("companys"); foreach (XmlNode childNode in xmlNode2.ChildNodes) { if (childNode.Attributes["name"].Value == name) { if (childNode.Attributes["CloseStatus"] != null) { childNode.Attributes["CloseStatus"].Value = (Staut ? "1" : "0"); } else { childNode.Attributes.Append(ExpressHelper.CreateAttribute(childNode, "CloseStatus", Staut ? "1" : "0")); } result = true; break; } } xmlNode.Save(ExpressHelper.path); return(result); } catch (Exception) { return(false); } }
public static void UpdateExpress(string oldcompanyname, string name, string kuaidi100Code, string taobaoCode, string JDCode) { XmlDocument xmlNode = ExpressHelper.GetXmlNode(); XmlNode xmlNode2 = xmlNode.SelectSingleNode("companys"); foreach (XmlNode childNode in xmlNode2.ChildNodes) { if (childNode.Attributes["name"].Value == oldcompanyname) { childNode.Attributes["name"].Value = name; childNode.Attributes["Kuaidi100Code"].Value = kuaidi100Code; childNode.Attributes["TaobaoCode"].Value = taobaoCode; if (childNode.Attributes["JDCode"] != null) { childNode.Attributes["JDCode"].Value = JDCode; } else { childNode.Attributes.Append(ExpressHelper.CreateAttribute(childNode, "JDCode", JDCode)); } break; } } xmlNode.Save(ExpressHelper.path); }