예제 #1
0
        private string GetRiskData(string verifyCode)
        {
            string      data        = "";
            XmlDocument xmlDocument = new XmlDocument();

            if (File.Exists(risksFile))
            {
                RiskList rl = new RiskList();
                rl.verifyCode = verifyCode;
                List <RiskData> riskDataList = new List <RiskData>();
                xmlDocument.Load(risksFile);
                XmlElement  xmlElement = xmlDocument.DocumentElement;
                XmlNodeList nodeList   = xmlElement.ChildNodes;
                XmlNodeList nodeList2  = nodeList[1].ChildNodes;
                foreach (XmlNode item in nodeList2)
                {
                    RiskData rd = new RiskData();
                    rd.name  = item.Attributes["Name"].Value;
                    rd.no    = item.Attributes["No"].Value;
                    rd.value = item.Attributes["Value"].Value;
                    riskDataList.Add(rd);
                }
                rl.riskDatas = riskDataList;
                data         = JsonConvert.SerializeObject(rl);
            }
            return(data);
        }
예제 #2
0
        public string GetInfoData(string verifyCode)
        {
            string      data        = "";
            XmlDocument xmlDocument = new XmlDocument();
            RiskList    rl          = new RiskList();

            rl.verifyCode = verifyCode;
            List <RiskData> riskDataList = new List <RiskData>();

            if (File.Exists(infoFile))
            {
                xmlDocument = new XmlDocument();
                xmlDocument.Load(infoFile);
                XmlElement  xmlElement = xmlDocument.DocumentElement;
                XmlNodeList nodeList   = xmlElement.ChildNodes;
                XmlNodeList nodeList2  = nodeList[1].ChildNodes;
                foreach (XmlNode item in nodeList2)
                {
                    RiskData rd = new RiskData();
                    rd.name = item.Attributes["Name"].Value;
                    rd.no   = item.Attributes["No"].Value;
                    string value = "";
                    try
                    {
                        value = item.Attributes["Value"].Value;
                    }
                    catch (Exception ex)
                    {
                        value = "";
                    }
                    rd.value = value;
                    riskDataList.Add(rd);
                }
            }
            int count = riskDataList.Count + 2;

            if (File.Exists(risksFile))
            {
                xmlDocument = new XmlDocument();
                xmlDocument.Load(risksFile);
                XmlElement  xmlElement = xmlDocument.DocumentElement;
                XmlNodeList nodeList   = xmlElement.ChildNodes;
                XmlNodeList nodeList2  = nodeList[1].ChildNodes;
                foreach (XmlNode item in nodeList2)
                {
                    RiskData rd = new RiskData();
                    rd.name  = item.Attributes["Name"].Value;
                    rd.no    = count + "";
                    rd.value = item.Attributes["Value"].Value;
                    riskDataList.Add(rd);
                    count++;
                }
            }
            rl.riskDatas = riskDataList;
            data         = JsonConvert.SerializeObject(rl);
            return(data);
        }