Exemple #1
0
        /// <summary>
        /// 读取车驾管信息
        /// </summary>
        /// <param name="hpzl"></param>
        /// <param name="hphm"></param>
        /// <returns></returns>
        public VehicleInfo GetVehicleInfo(string hpzl, string hphm)
        {
            VehicleInfo vehinfo = new VehicleInfo();
            XmlDocument doc     = new XmlDocument();
            string      xmlbody = "<?xml version='1.0' encoding='GBK'?>";

            xmlbody = xmlbody + "<root>";
            xmlbody = xmlbody + "<QueryCondition>";
            xmlbody = xmlbody + "<hpzl>" + hpzl + "</hpzl>";
            xmlbody = xmlbody + "<hphm>" + hphm + "</hphm>";
            xmlbody = xmlbody + "</QueryCondition>";
            xmlbody = xmlbody + "</root>";
            string xmlReturn = "";

            try
            {
                xmlReturn = service.QueryObjectOut("01C21", xmlbody);
                //xmlReturn = GetTestXml();
            }
            catch (Exception)
            {
                ILog.WriteErrorLog(xmlReturn);
                return(null);
            }
            doc = new XmlDocument();
            doc.LoadXml(xmlReturn);
            if (string.IsNullOrEmpty(GetSingleValueByXPath(doc, "root/body")))
            {
                ILog.WriteErrorLog(xmlReturn);
                return(null);
            }
            if (!string.IsNullOrEmpty(xmlReturn))
            {
                Hashtable ht = xmlRead.XmltoHashtable(xmlReturn, "veh");
                if (ht.Count > 2)
                {
                    try
                    {
                        vehinfo.Hphm   = hphm;
                        vehinfo.Hpzl   = hpzl;
                        vehinfo.Clpp1  = ht["clpp1"].ToString();
                        vehinfo.Clxh   = ht["clxh"].ToString();
                        vehinfo.Clsbdh = ht["clsbdh"].ToString();
                        vehinfo.Fdjh   = ht["fdjh"].ToString();
                        try
                        {
                            vehinfo.Csys = GetCsys(ht["csys"].ToString());
                        }
                        catch
                        {
                            vehinfo.Csys = ht["csys"].ToString();
                        }
                        vehinfo.Csysbh = ht["csys"].ToString();
                        vehinfo.Syr    = ht["syr"].ToString();
                        vehinfo.Ccdjrq = ht["ccdjrq"].ToString();
                        string qzbfqz = ht["qzbfqz"].ToString();
                        if (!string.IsNullOrEmpty(qzbfqz))
                        {
                            vehinfo.Qzbfqz = qzbfqz.Substring(0, qzbfqz.Length - 2);
                        }
                        string yxqz = ht["yxqz"].ToString();
                        if (!string.IsNullOrEmpty(yxqz))
                        {
                            vehinfo.Yxqz   = yxqz.Substring(0, yxqz.Length - 2);
                            vehinfo.Jyyxqz = yxqz.Substring(0, yxqz.Length - 2);
                        }
                        vehinfo.Fzjg   = ht["fzjg"].ToString();
                        vehinfo.Yzbm1  = ht["yzbm1"].ToString();
                        vehinfo.Lxdh   = ht["sjhm"].ToString();
                        vehinfo.Fzjg   = ht["fzjg"].ToString();
                        vehinfo.Zsxxdz = ht["zzxxdz"].ToString();
                        vehinfo.Xzqh   = ht["xzqh"].ToString();
                        try
                        {
                            vehinfo.Cllx = GetCllx(ht["cllx"].ToString());
                        }
                        catch
                        {
                            vehinfo.Cllx = ht["cllx"].ToString();
                        }

                        vehinfo.Cllxbh = ht["cllx"].ToString();

                        // 方正修改结束
                        try
                        {
                            vehinfo.Zt = GetZt(ht["zt"].ToString());
                        }
                        catch
                        {
                            vehinfo.Zt = ht["zt"].ToString();
                        }
                        vehinfo.Ztbh   = ht["zt"].ToString();
                        vehinfo.Sfzmhm = ht["sfzmhm"].ToString();

                        vehinfo.Dabh = ht["dabh"].ToString();
                        if (!string.IsNullOrEmpty(ht["syxz"].ToString()))
                        {
                            vehinfo.Syxz   = ht["syxz"].ToString();
                            vehinfo.Syxzms = GetSyxz(ht["syxz"].ToString());
                        }
                        return(vehinfo);
                    }
                    catch (Exception ex)
                    {
                        ILog.WriteErrorLog(ex.Message);
                        return(null);
                    }
                }
            }
            return(null);
        }