Esempio n. 1
0
        public PhoenPostionQueryReturn AnalysisPhoenPostionQueryXML(string PhoenPostionQueryXML)
        {
            System.Xml.XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.InnerXml = PhoenPostionQueryXML;

            XmlNodeList             nodeTemplet             = XmlDoc.DocumentElement.ChildNodes;
            PhoenPostionQueryReturn phoenPostionQueryReturn = new PhoenPostionQueryReturn();

            //XmlNodeList nodeTemplet = XmlDoc.DocumentElement.ChildNodes;
            foreach (XmlElement element in nodeTemplet)
            {
                if (element.Name.ToUpper() == "LIA")
                {
                    //得到该节点的子节点
                    XmlNodeList nodelist = element.ChildNodes;

                    foreach (XmlElement childnodelist in nodelist)
                    {
                        switch (childnodelist.Name.ToUpper())
                        {
                        case "RESULT":
                            phoenPostionQueryReturn.RESULT = childnodelist.InnerText;
                            break;

                        case "POSINFOS":
                            //得到该节点的子节点
                            XmlNodeList POSINFOSnodelist = childnodelist.ChildNodes;

                            foreach (XmlElement POSINFOSnodelistEle in POSINFOSnodelist)
                            {
                                switch (POSINFOSnodelistEle.Name.ToUpper())
                                {
                                case "POSINFO":
                                    XmlNodeList POSINFOnodelist = POSINFOSnodelistEle.ChildNodes;
                                    foreach (XmlElement POSINFOnodelistEle in POSINFOnodelist)
                                    {
                                        switch (POSINFOnodelistEle.Name.ToUpper())
                                        {
                                        case "ROAMCITY":
                                            phoenPostionQueryReturn.ROAMCITY = POSINFOnodelistEle.InnerText;
                                            break;

                                        case "LATITUDETYPE":
                                            phoenPostionQueryReturn.LATITUDETYPE = POSINFOnodelistEle.InnerText;
                                            break;

                                        case "LATITUDE":
                                            phoenPostionQueryReturn.LATITUDE = POSINFOnodelistEle.InnerText;
                                            break;

                                        case "LONGITUDETYPE":
                                            phoenPostionQueryReturn.LONGITUDETYPE = POSINFOnodelistEle.InnerText;
                                            break;

                                        case "LONGITUDE":
                                            phoenPostionQueryReturn.LONGITUDE = POSINFOnodelistEle.InnerText;
                                            break;

                                        default:
                                            break;
                                        }
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }
            }


            return(phoenPostionQueryReturn);
        }
Esempio n. 2
0
        public PhoenPostionQueryReturn AnalysisPhoenPostionQueryXML(string PhoenPostionQueryXML)
        {
            System.Xml.XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.InnerXml = PhoenPostionQueryXML;

            XmlNodeList nodeTemplet = XmlDoc.DocumentElement.ChildNodes;
            PhoenPostionQueryReturn phoenPostionQueryReturn = new PhoenPostionQueryReturn();
            //XmlNodeList nodeTemplet = XmlDoc.DocumentElement.ChildNodes;
            foreach (XmlElement element in nodeTemplet)
            {
                if (element.Name.ToUpper() == "LIA")
                {
                    //得到该节点的子节点
                    XmlNodeList nodelist = element.ChildNodes;

                    foreach (XmlElement childnodelist in nodelist)
                    {
                        switch (childnodelist.Name.ToUpper())
                        {
                            case "RESULT":
                                phoenPostionQueryReturn.RESULT = childnodelist.InnerText;
                                break;
                            case "POSINFOS":
                                //得到该节点的子节点
                                XmlNodeList POSINFOSnodelist = childnodelist.ChildNodes;

                                foreach (XmlElement POSINFOSnodelistEle in POSINFOSnodelist)
                                {
                                    switch (POSINFOSnodelistEle.Name.ToUpper())
                                    {
                                        case "POSINFO":
                                            XmlNodeList POSINFOnodelist = POSINFOSnodelistEle.ChildNodes;
                                            foreach (XmlElement POSINFOnodelistEle in POSINFOnodelist)
                                            {
                                                switch (POSINFOnodelistEle.Name.ToUpper())
                                                {
                                                    case "ROAMCITY":
                                                        phoenPostionQueryReturn.ROAMCITY = POSINFOnodelistEle.InnerText;
                                                        break;
                                                    case "LATITUDETYPE":
                                                        phoenPostionQueryReturn.LATITUDETYPE = POSINFOnodelistEle.InnerText;
                                                        break;
                                                    case "LATITUDE":
                                                        phoenPostionQueryReturn.LATITUDE = POSINFOnodelistEle.InnerText;
                                                        break;
                                                    case "LONGITUDETYPE":
                                                        phoenPostionQueryReturn.LONGITUDETYPE = POSINFOnodelistEle.InnerText;
                                                        break;
                                                    case "LONGITUDE":
                                                        phoenPostionQueryReturn.LONGITUDE = POSINFOnodelistEle.InnerText;
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                break;
                            default:
                                break;
                        }

                    }
                }
            }

            return phoenPostionQueryReturn;
        }
Esempio n. 3
0
        /// <summary>
        /// 手机初定位查询
        /// </summary>
        /// <returns></returns>
        public static int PhonePositionQuery(string SPID, string PhoneID, string PhoneType, string ResultLevel, string MaxAge, System.DateTime startTime, string ExtendField, out string ActiveTime, out string AreaID, out string Area,
             out string LatitudeType, out string Latitude, out string LongitudeType, out string Longitude, out string outExtendField, out string ErrMsg)
        {
            int Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

            AreaID = "";
            Area = "";
            ActiveTime = "";
            outExtendField = "";
            LatitudeType = "";
            Latitude = "";
            LongitudeType = "";
            Longitude = "";

            System.DateTime endTime = System.DateTime.Now;
            System.TimeSpan ts = endTime - startTime;

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "up_Customer_V3_Interface_PhonePostionQuery";
            try
            {
                SqlParameter sPID = new SqlParameter("@SPID", SqlDbType.VarChar, 8);
                sPID.Value = SPID;
                cmd.Parameters.Add(sPID);

                SqlParameter phoneID = new SqlParameter("@PhoneID", SqlDbType.VarChar, 48);
                phoneID.Value = PhoneID;
                cmd.Parameters.Add(phoneID);

                SqlParameter phoneType = new SqlParameter("@PhoneType", SqlDbType.VarChar, 2);
                phoneType.Value = PhoneType;
                cmd.Parameters.Add(phoneType);

                SqlParameter maxAge = new SqlParameter("@MaxAge", SqlDbType.Int);
                maxAge.Value = MaxAge;
                cmd.Parameters.Add(maxAge);

                SqlParameter timeDiff = new SqlParameter("@TimeDiff", SqlDbType.Int);
                timeDiff.Value = ts.Milliseconds;
                cmd.Parameters.Add(timeDiff);

                SqlParameter resultLevel = new SqlParameter("@ResultLevel", SqlDbType.VarChar, 2);
                resultLevel.Value = ResultLevel;
                cmd.Parameters.Add(resultLevel);

                SqlParameter parActiveTime = new SqlParameter("@ActiveTime", SqlDbType.DateTime);
                parActiveTime.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parActiveTime);

                SqlParameter parAreaID = new SqlParameter("@AreaID", SqlDbType.VarChar, 3);
                parAreaID.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parAreaID);

                SqlParameter parArea = new SqlParameter("@Area", SqlDbType.VarChar, 50);
                parArea.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parArea);

                SqlParameter parLatitudeType = new SqlParameter("@LatitudeType", SqlDbType.VarChar, 2);
                parLatitudeType.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parLatitudeType);

                SqlParameter parLatitude = new SqlParameter("@Latitude", SqlDbType.VarChar, 20);
                parLatitude.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parLatitude);

                SqlParameter parLongitudeType = new SqlParameter("@LongitudeType", SqlDbType.VarChar, 2);
                parLongitudeType.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parLongitudeType);

                SqlParameter parLongitude = new SqlParameter("@Longitude", SqlDbType.VarChar, 20);
                parLongitude.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parLongitude);

                //SqlParameter parID = new SqlParameter("@ID", SqlDbType.BigInt);
                //parResult.Direction = ParameterDirection.Output;
                //cmd.Parameters.Add(parID);

                SqlParameter parResult = new SqlParameter("@Result", SqlDbType.Int);
                parResult.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parResult);

                SqlParameter parErrMsg = new SqlParameter("@ErrMsg ", SqlDbType.VarChar, 256);
                parErrMsg.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parErrMsg);

                DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

                AreaID = parAreaID.Value.ToString();
                Area = parArea.Value.ToString();
                LatitudeType = parLatitudeType.Value.ToString();
                Latitude = parLatitude.Value.ToString();
                LongitudeType = parLongitudeType.Value.ToString();
                Longitude = parLongitude.Value.ToString();

                //iD = Int64.Parse(parID.Value.ToString());
                Result = int.Parse(parResult.Value.ToString());

                ActiveTime = parActiveTime.Value.ToString();

                ErrMsg = parErrMsg.Value.ToString();

            }
            catch (Exception ex)
            {
                Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
                ErrMsg = ErrorDefinition.BT_IError_Result_System_UnknowError_Msg + ex.Message;
            }

            if (Result != 0)
            {
                try
                {
                    L1XMLExchange l1XMLExchange = new L1XMLExchange();
                    string ReqXml = l1XMLExchange.BuildQryCustInfoXML(PhoneID, ResultLevel);

                    StringBuilder msg_L1XML = new StringBuilder();
                    msg_L1XML.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n");
                    msg_L1XML.Append("手机粗定位请求参数++++++++++++++++++++++\r\n\r\n");
                    msg_L1XML.Append(ReqXml + "\r\n");
                    msg_L1XML.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

                    BTUCenterInterfaceLog.CenterForBizTourLog("PhonePosition", msg_L1XML);

                    string strUrl = System.Configuration.ConfigurationManager.AppSettings["PhonePostionQueryUrl"];

                    string returnValue = "";

                    if ("1".Equals(ResultLevel))
                    {
                        returnValue = HttpClient.PostMyData(strUrl, ReqXml, 10000);
                    }
                    else
                    {
                        returnValue = HttpClient.PostMyData(strUrl, ReqXml, 3000);
                    }
                    PhoenPostionQueryReturn phoenPostionQueryReturn = new PhoenPostionQueryReturn();

                    if (!"".Equals(returnValue))
                    {
                        phoenPostionQueryReturn = l1XMLExchange.AnalysisPhoenPostionQueryXML(returnValue);
                    }
                    else
                    {
                        Result = ErrorDefinition.BT_IError_Result_PhoenPostionError_Code;
                        ErrMsg = "落地方系统没有响应或超时";
                    }

                    LatitudeType = phoenPostionQueryReturn.LATITUDETYPE;
                    Latitude = phoenPostionQueryReturn.LATITUDE;
                    LongitudeType = phoenPostionQueryReturn.LONGITUDETYPE;
                    Longitude = phoenPostionQueryReturn.LONGITUDE;

                    System.DateTime endTime2 = System.DateTime.Now;
                    System.TimeSpan ts2 = endTime2 - endTime;

                    SqlCommand cmd2 = new SqlCommand();
                    cmd2.CommandType = CommandType.StoredProcedure;

                    cmd2.CommandText = "up_Customer_V3_Interface_PhonePostionL1Query";

                    SqlParameter sPID = new SqlParameter("@SPID", SqlDbType.VarChar, 8);
                    sPID.Value = SPID;
                    cmd2.Parameters.Add(sPID);

                    SqlParameter phoneID = new SqlParameter("@PhoneID", SqlDbType.VarChar, 48);
                    phoneID.Value = PhoneID;
                    cmd2.Parameters.Add(phoneID);

                    SqlParameter phoneType = new SqlParameter("@PhoneType", SqlDbType.VarChar, 2);
                    phoneType.Value = PhoneType;
                    cmd2.Parameters.Add(phoneType);

                    SqlParameter maxAge = new SqlParameter("@MaxAge", SqlDbType.Int);
                    maxAge.Value = MaxAge;
                    cmd2.Parameters.Add(maxAge);

                    SqlParameter timeDiff = new SqlParameter("@TimeDiff", SqlDbType.Int);
                    timeDiff.Value = ts.Milliseconds;
                    cmd2.Parameters.Add(timeDiff);

                    SqlParameter l1TimeDiff = new SqlParameter("@L1TimeDiff", SqlDbType.Int);
                    l1TimeDiff.Value = ts2.Milliseconds;
                    cmd2.Parameters.Add(l1TimeDiff);

                    SqlParameter areaID = new SqlParameter("@AreaID", SqlDbType.VarChar, 3);
                    areaID.Value = phoenPostionQueryReturn.ROAMCITY;
                    cmd2.Parameters.Add(areaID);

                    SqlParameter reqXml = new SqlParameter("@ReqXml", SqlDbType.Text);
                    reqXml.Value = ReqXml;
                    cmd2.Parameters.Add(reqXml);

                    SqlParameter rspXml = new SqlParameter("@RspXml", SqlDbType.Text);
                    rspXml.Value = returnValue;
                    cmd2.Parameters.Add(rspXml);

                    SqlParameter l1Result = new SqlParameter("@L1Result", SqlDbType.Int);
                    if (Result != 0 && Result != -1)
                    {
                        l1Result.Value = Result;
                    }
                    else
                    {
                        l1Result.Value = phoenPostionQueryReturn.RESULT;
                    }

                    cmd2.Parameters.Add(l1Result);

                    SqlParameter resultLevel = new SqlParameter("@ResultLevel", SqlDbType.VarChar, 2);
                    resultLevel.Value = ResultLevel;
                    cmd2.Parameters.Add(resultLevel);

                    SqlParameter latitudeType = new SqlParameter("@LatitudeType", SqlDbType.VarChar, 2);
                    latitudeType.Value = LatitudeType;
                    cmd2.Parameters.Add(latitudeType);

                    SqlParameter latitude = new SqlParameter("@Latitude", SqlDbType.VarChar, 20);
                    latitude.Value = Latitude;
                    cmd2.Parameters.Add(latitude);

                    SqlParameter longitudeType = new SqlParameter("@LongitudeType", SqlDbType.VarChar, 2);
                    longitudeType.Value = LongitudeType;
                    cmd2.Parameters.Add(longitudeType);

                    SqlParameter longitude = new SqlParameter("@Longitude", SqlDbType.VarChar, 20);
                    longitude.Value = Longitude;
                    cmd2.Parameters.Add(longitude);

                    SqlParameter parActiveTime = new SqlParameter("@ActiveTime", SqlDbType.DateTime);
                    parActiveTime.Direction = ParameterDirection.Output;
                    cmd2.Parameters.Add(parActiveTime);

                    SqlParameter parArea = new SqlParameter("@Area", SqlDbType.VarChar, 50);
                    parArea.Direction = ParameterDirection.Output;
                    cmd2.Parameters.Add(parArea);

                    SqlParameter parResult = new SqlParameter("@Result", SqlDbType.Int);
                    parResult.Direction = ParameterDirection.Output;
                    cmd2.Parameters.Add(parResult);

                    SqlParameter parErrMsg = new SqlParameter("@ErrMsg ", SqlDbType.VarChar, 256);
                    parErrMsg.Direction = ParameterDirection.Output;
                    cmd2.Parameters.Add(parErrMsg);

                    DBUtility.Execute(cmd2, DBUtility.BestToneCenterConStr);

                    AreaID = phoenPostionQueryReturn.ROAMCITY;
                    Area = parArea.Value.ToString();

                    ActiveTime = parActiveTime.Value.ToString();
                    if (Result == 0 || Result == -1)
                    {
                        Result = int.Parse(parResult.Value.ToString());
                        ErrMsg = parErrMsg.Value.ToString();
                    }

                }
                catch (Exception ex)
                {
                    Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
                    ErrMsg = ErrorDefinition.BT_IError_Result_System_UnknowError_Msg + ex.Message;
                }
                return Result;

            }
            return Result;
        }