Exemple #1
0
        private static ReturnObj BuildSubmitResponse(string subPackage, IList<ParamList> paramLists)
        {
            ReturnObj obj = null;
            try
            {
                StringBuilder sb = new StringBuilder();
                XmlDocument xmlDoc = new XmlDocument();

                sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                sb.Append("<cpXML cName=\"销售记录提交应答\" name=\"lsj_submit_response\" version=\"CP2013\">");

                xmlDoc.LoadXml(subPackage);
                //note:the subPackage is not defined with explicit namespace
                //so XPath does not need a XmlNameSpaceManager

                LsjHelper lsjHelper = new LsjHelper();
                obj = lsjHelper.BuildEntity(paramLists, xmlDoc);
                sb.Append("<xsjls>").Append(obj.Content).Append("</xsjls></cpXML>");
                obj.Content = sb.ToString();
            }
            catch (Exception ex)
            {
                obj = new ReturnObj
                {
                    State = -1,
                    Msg = "服务程序错误:" + ex.Message,
                    Content =
                        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><cpXML cName=\"销售记录提交应答\" name=\"lsj_submit_response\" version=\"CP2013\"></cpXML>"
                };
            }
            return obj;
        }
Exemple #2
0
        private static ReturnObj BuildQueryResponse(string subPackage, IList<ParamList> paramLists, string channelId)
        {
            ReturnObj obj = null;
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                StringBuilder sb = new StringBuilder();
                //sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                //sb.Append("<cpXML cName=\"lsj价格查询应答\" name=\"lsj_query_response\" version=\"CP2013\">");

                //xmlDoc.LoadXml(subPackage);
                LsjHelper pisHelper = new LsjHelper();
                obj = pisHelper.BuildXml(paramLists, channelId);
                if (obj.State == 1)
                {
                    sb.Append(obj.Content).Append("");
                    obj.Content = sb.ToString();
                }
                else //可能有各种错误
                {
                    obj.Content =
                        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><cpXML cName=\"lsj价格查询应答\" name=\"lsj_query_response\" version=\"CP2013\"></cpXML>";
                }
            }
            catch (Exception ex)
            {
                obj = new ReturnObj
                {
                    State = -1,
                    Msg = "服务程序错误:" + ex.Message,
                    Content =
                        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><cpXML cName=\"lsj价格查询应答\" name=\"lsj_query_response\" version=\"CP2013\"></cpXML>"
                };
            }
            return obj;
        }