public static void InsertListModel(SMSModel_QueryReceive item, ref List<SMSModel_QueryReceive> list, ref PMS.Model.Enum.MatchCondition_Enum state) { if(item != null) { //将拥有符合条件的msgid的item存入list list.Add(item); state = PMS.Model.Enum.MatchCondition_Enum.conform; } else { } }
/// <summary> /// 10-13:此方法需要重写 /// </summary> /// <param name="returnMsg"></param> /// <returns></returns> public static List<SMSModel_QueryReceive> Xml2Model_queryReceiveMsg(string returnMsg) { List<SMSModel_QueryReceive> list_r = new List<SMSModel_QueryReceive>(); //解析前一部分 var result = Xml2StrHelper.Xml2Str(returnMsg, "response/result"); var desc = Xml2StrHelper.Xml2Str(returnMsg, "response/desc"); //前一部分没有问题再解析后一部分 //先尝试解析第一个值 //6月27日 此方法无法取出xml节点中的值 var _status = Xml2StrHelper.xml2strList(returnMsg, "response/report/status"); //如果第一个值有内容则继续,否则说明没有后续内容 if (_status != null) { var _msgid = Xml2StrHelper.xml2strList(returnMsg, "response/report/msgid"); var _phone = Xml2StrHelper.xml2strList(returnMsg, "response/report/phone"); var _desc = Xml2StrHelper.xml2strList(returnMsg, "response/report/desc"); var _wgcode = Xml2StrHelper.xml2strList(returnMsg, "response/report/wgcode"); var _time = Xml2StrHelper.xml2strList(returnMsg, "response/report/time"); var _smsCount = Xml2StrHelper.xml2strList(returnMsg, "response/report/smsCount"); var _smsIndex = Xml2StrHelper.xml2strList(returnMsg, "response/report/smsIndex"); for (int i = 0; i < _status.Length; i++) { if (int.Parse(_smsIndex[i]) == 1) { SMSModel_QueryReceive r = new SMSModel_QueryReceive() //封装语句 { msgId= _msgid[i], phoneNumber = _phone[i], status = _status[i], desc = _desc[i], wgcode = _wgcode[i], time = _time[i], smsCount = int.Parse(_smsCount[i]) }; list_r.Add(r); } } } //9月7日 //若response/report/status节点中没有元素 else { //则说明返回的是ok等状态,对其进行封装 SMSModel_QueryReceive r = new SMSModel_QueryReceive() //封装语句 { desc = desc, }; list_r.Add(r); } return list_r; }