Ejemplo n.º 1
0
        /// <summary>
        /// ��young�ͻ���֤v2
        /// </summary>
        /// <param name="UAProvinceID"></param>
        /// <param name="AuthenType"></param>
        /// <param name="UserName1"></param>
        /// <param name="RealName1"></param>
        /// <param name="PassWord"></param>
        /// <param name="PasswordFlag"></param>
        /// <param name="ScoreBesttoneSPID"></param>
        /// <param name="context"></param>
        /// <param name="RealName"></param>
        /// <param name="UserName1"></param>
        /// <param name="NickName"></param>
        /// <param name="OutID"></param>
        /// <param name="CustType"></param>
        /// <param name="CustID"></param>
        /// <param name="ErrMsg"></param>
        /// <param name="TestStr"></param>
        /// <returns></returns>
        public static int YoungUserAuthV2(string UAProvinceID, string Areaid, string AuthenType, string Username, string RealName1, string Password, string PasswdFlag, string ScoreBesttoneSPID, HttpContext context, out string RealName, out string UserName, out string NickName, out string OutID, out string CustType, out string CustID, out string PointType,out string PointValueSum,out string PointValue, out string ErrMsg, out string TestStr)
        {
            int Result = -19999;

            RealName = "";
            UserName = "";
            NickName = "";
            OutID = "";
            CustType = "";
            CustID = "";
            ErrMsg = "";
            TestStr = "";
            string str = "";
            string rStr = "";
            PointType = "";
            PointValueSum = "";
            PointValue = "";
            try
            {

                if (!String.IsNullOrEmpty(Areaid) && !Areaid.StartsWith("0"))
                {
                    Areaid = "0" + Areaid;
                }

                if (ScoreBesttoneSPID == "")
                {
                    ScoreBesttoneSPID = System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"];
                }

                string BusCode = "BUS17006";                                    //ҵ���ܱ���
                string ServiceCode = "SVC11001";                                //�ӿ�Э�����
                string ServiceContractVer = "SVC1100120110525";                 //Э�鵱ǰʹ�õİ汾��
                string ActionCode = "0";                                        //�����ʶ
                //������ˮ��
                string date = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                if (count >= 9)
                    count = 0;
                else
                    count = count + 1;
                string TransactionID = "1000000020" + date + count.ToString();

                string ServiceLevel = "1";                                      //����ȼ�,��������ȼ�
                string SrcOrgID = "100000";                                     //���𷽻�������
                string SrcSysID = "1000000020";                                 //����(ϵͳ/ƽ̨)����
                string SrcSysSign = System.Configuration.ConfigurationManager.AppSettings["SrcSysSign"];    //����(ϵͳ/ƽ̨)ǩ��
                //��ط���������
                string DstOrgID = "";
                DstOrgID = CommonBizRules.GetReginCodeByProvinceID(UAProvinceID, context);
                if (DstOrgID == "")
                {
                    ErrMsg = "ָ��ʡ��Ӧ������ط���������";
                    return -1;
                }
                //��ط�(ϵͳ/ƽ̨)����
                string DstSysID = "";
                DstSysID = CommonBizRules.GetSPOuterIDBySPID(UAProvinceID + "999999", context);
                if (DstSysID == "")
                {
                    ErrMsg = "ָ��ʡ��Ӧ������ط�(ϵͳ/ƽ̨)����";
                    return -1;
                }

                string ReqTime = DateTime.Now.ToString("yyyyMMddHHMMss");                       //����ʱ�䣬ʱ���ʽ�ַ�
                string InfoTypeID = "36";                                                       //�������ʹ���
                //��ʶ����
                string CodeType = "";
                //��ʶ���ͱ���װ��
                Result = ConvertCodeType(AuthenType, out CodeType, out ErrMsg);
                if (Result != 0)
                    return Result;

                //��ʶ����
                string CodeValue = "";
                //����ش���
                string CityCode = "";
                //�̻���С��ͨ����������⴦��
                if (AuthenType == "9" || AuthenType == "10" || AuthenType == "11")
                {
                    if (Username.IndexOf('-') > 0)
                    {
                        string[] alUsername = Username.Split('-');
                        CityCode = alUsername[0];
                        CodeValue = alUsername[1];
                    }
                    else
                    {
                        CityCode = Areaid;
                        CodeValue = Username;
                    }
                }
                else
                {
                    CityCode = Areaid;
                    CodeValue = Username;
                }

                //�Ƿ���������
                //string PasswdFlag = "1";
                //����
                string CCPasswd = Password;

                //����Crm��ѯxml
                XMLExchange xMLExchange = new XMLExchange();
                str = xMLExchange.BuildYoungQryCustInfoXML(BusCode, ServiceCode, ServiceContractVer, ActionCode, TransactionID,
                ServiceLevel, SrcOrgID, SrcSysID, SrcSysSign, DstOrgID, DstSysID, ReqTime,
                InfoTypeID, CodeType, CodeValue, CityCode, PasswdFlag, CCPasswd);

                BTUCenterInterfaceLog.CenterForBizTourLog("YoungUserAuthV2", new StringBuilder(str));

                //��Crm������ѯ
                DEPService obj = new DEPService();
                obj.Url = System.Configuration.ConfigurationManager.AppSettings["DEPServiceURL"];
                rStr = obj.exchange(str);
                TestStr = rStr;

                LogCrmSSOPost(str);
                LogCrmSSOReturn(rStr);

                QryCustInfoReturn qryCustInfoReturn = new QryCustInfoReturn();
                AuthenYoungInfoReturn authYoungReturn = xMLExchange.AnalysisAuthYoungInfoXML(rStr);

                if (String.IsNullOrEmpty(authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName)  || String.IsNullOrEmpty(authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup))
                {

                    //������ˮ��
                    date = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    if (count >= 9)
                        count = 0;
                    else
                        count = count + 1;
                    TransactionID = "1000000020" + date + count.ToString();

                    BusCode = "BUS17002";                                            //ҵ���ܱ���
                    ServiceCode = "SVC11001";                                        //�ӿ�Э�����
                    ServiceContractVer = "SVC1100120091002";                         //Э�鵱ǰʹ�õİ汾��

                    InfoTypeID = "31";
                    str = xMLExchange.BuildYoungQryCustInfoXML(BusCode, ServiceCode, ServiceContractVer, ActionCode, TransactionID,
                    ServiceLevel, SrcOrgID, SrcSysID, SrcSysSign, DstOrgID, DstSysID, ReqTime,
                    InfoTypeID, CodeType, CodeValue, CityCode, PasswdFlag, CCPasswd);

                    rStr = obj.exchange(str);
                    qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoXML(rStr);

                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustBrand = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustBrand;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityName;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceCode = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceCode;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceName;

                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CityCode = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CityCode;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeType = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeType;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue;

                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum;
                    authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType;
                }
                if (authYoungReturn.TcpCont.Response.RspType == "0")
                {
                    RealName = authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName;
                    UserName = "";
                    NickName = "";
                    CustID = "";
                    OutID = authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue;

                    //�ͻ�����ת��
                    CustType = ConvertCustType(authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup);

                    //֤������ת��
                    string IdentType = ConvertIdentType(authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType);

                    //��Ա����ת��
                    string CustServiceLevel = ConvertCustServiceLevel(authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel);

                    PointType = authYoungReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointType;
                    PointValueSum = authYoungReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValueSum;
                    PointValue = authYoungReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValue;

                    if (RealName1 != "")
                        RealName = RealName1;

                    //ȫ��CRM�û�ע�ᵽ�Ű�
                    Result = UserRegistry.getUserRegistryCrm(UAProvinceID,
                        authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode,
                        CustType,               //�ͻ�����
                        IdentType,
                        authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum,
                        RealName,
                        CustServiceLevel,
                        "2",                    //δ֪
                        OutID,
                        ScoreBesttoneSPID,
                        authYoungReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress,
                        out CustID,
                        out ErrMsg);

                    if (Result != 0)
                    {
                        return Result;
                    }
                    CIP2BizRules.InsertCustInfoNotify(CustID, "2", ScoreBesttoneSPID, "", "0", out ErrMsg);
                }
                else
                {
                    ErrMsg = "�������ͼ�����:" + authYoungReturn.TcpCont.Response.RspType
                             + "Ӧ�����:" + authYoungReturn.TcpCont.Response.RspCode
                             + "����:" + authYoungReturn.TcpCont.Response.RspDesc;
                    int rspcode = -1;
                    try
                    {
                        rspcode = int.Parse(authYoungReturn.TcpCont.Response.RspCode);
                    }
                    catch
                    {
                        return rspcode;
                    }
                    return rspcode;
                }
            }
            catch (Exception ex1)
            {
                ErrMsg = ex1.Message.ToString();
                Result = -29999;
                //str = ErrMsg;
                BTUCenterInterfaceLog.CenterForBizTourLog("YoungUserAuthV2", new StringBuilder(ErrMsg));
            }
            finally
            {
                LogCrmSSOPost(str);
                LogCrmSSOReturn(rStr);
            }
            return Result;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 解析向Crm查询客户信息时返回的XML
        /// </summary>
        /// <param name="QryUserStatusXMLText"></param>
        /// <returns></returns>
        public QryCustInfoReturn AnalysisQryCustInfoXML(string QryCustInfoXMLText)
        {
            QryCustInfoReturn qryReturn = new QryCustInfoReturn();
            System.Xml.XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.InnerXml = QryCustInfoXMLText;

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

                    XmlNodeList nodelist = element.ChildNodes;

                    foreach (XmlElement childnodelist in nodelist)
                    {
                        switch (childnodelist.Name.ToLower())
                        {
                            case "actioncode":
                                qryReturn.TcpCont.ActionCode = childnodelist.InnerText;
                                break;
                            case "transactionid":
                                qryReturn.TcpCont.TransactionID = childnodelist.InnerText;
                                break;
                            case "rsptime":
                                qryReturn.TcpCont.RspTime = childnodelist.InnerText;
                                break;
                            case "response":
                                //得到该节点的子节点

                                XmlNodeList nodelistResponse = childnodelist.ChildNodes;

                                foreach (XmlElement nodelistResponseEle in nodelistResponse)
                                {
                                    switch (nodelistResponseEle.Name.ToLower())
                                    {
                                        case "rsptype":
                                            qryReturn.TcpCont.Response.RspType = nodelistResponseEle.InnerText;
                                            break;
                                        case "rspcode":
                                            qryReturn.TcpCont.Response.RspCode = nodelistResponseEle.InnerText;
                                            break;
                                        case "rspdesc":
                                            qryReturn.TcpCont.Response.RspDesc = nodelistResponseEle.InnerText;
                                            break;
                                    }
                                }
                                break;

                        }
                    }
                }
                if (element.Name.ToLower() == "svccont")
                {
                    //得到该节点的子节点

                    XmlNodeList nodelist = element.ChildNodes;

                    foreach (XmlElement childnodelist in nodelist)
                    {
                        switch (childnodelist.Name.ToLower())
                        {
                            case "qryinforsp":
                                //得到该节点的子节点

                                XmlNodeList nodelistQryInfoRsp = childnodelist.ChildNodes;

                                foreach (XmlElement nodelistQryInfoRspEle in nodelistQryInfoRsp)
                                {
                                    switch (nodelistQryInfoRspEle.Name.ToLower())
                                    {
                                        case "infotypeid":
                                            qryReturn.SvcCont.QryInfoRsp.InfoTypeID = nodelistQryInfoRspEle.InnerText;
                                            break;
                                        case "infocont":
                                            //得到该节点的子节点

                                            XmlNodeList nodelistInfoCont = nodelistQryInfoRspEle.ChildNodes;

                                            foreach (XmlElement nodelistInfoContEle in nodelistInfoCont)
                                            {
                                                switch (nodelistInfoContEle.Name.ToLower())
                                                {
                                                    case "custinfo":
                                                        //得到该节点的子节点

                                                        XmlNodeList nodelistCustInfo = nodelistInfoContEle.ChildNodes;
                                                        foreach (XmlElement nodelistCustInfoEle in nodelistCustInfo)
                                                        {
                                                            switch (nodelistCustInfoEle.Name.ToLower())
                                                            {

                                                                case "belonginfo":
                                                                    XmlNodeList nodelistBelongInfo = nodelistCustInfoEle.ChildNodes;
                                                                    foreach (XmlElement nodelistBelongInfoEle in nodelistBelongInfo)
                                                                    {
                                                                        switch (nodelistBelongInfoEle.Name.ToLower())
                                                                        {
                                                                            case "provincecode":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceCode = nodelistBelongInfoEle.InnerText;
                                                                                break;
                                                                            case "provincename":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceName = nodelistBelongInfoEle.InnerText;
                                                                                break;
                                                                            case "citycode":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode = nodelistBelongInfoEle.InnerText;
                                                                                break;
                                                                            case "cityname":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityName = nodelistBelongInfoEle.InnerText;
                                                                                break;
                                                                            default:
                                                                                break;
                                                                        }
                                                                    }
                                                                    break;

                                                                case "partycodeinfo":
                                                                    XmlNodeList nodelistPartyCodeInfo = nodelistCustInfoEle.ChildNodes;
                                                                    foreach (XmlElement nodelistPartyCodeInfoEle in nodelistPartyCodeInfo)
                                                                    {
                                                                        switch (nodelistPartyCodeInfoEle.Name.ToLower())
                                                                        {
                                                                            case "codetype":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeType = nodelistPartyCodeInfoEle.InnerText;
                                                                                break;
                                                                            case "codevalue":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue = nodelistPartyCodeInfoEle.InnerText;
                                                                                break;
                                                                            case "citycode":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CityCode = nodelistPartyCodeInfoEle.InnerText;
                                                                                break;
                                                                            default:
                                                                                break;
                                                                        }
                                                                    }
                                                                    break;
                                                                case "identityinfo":
                                                                    XmlNodeList IdentityInfoNodeList = nodelistCustInfoEle.ChildNodes;
                                                                    foreach (XmlElement IdentityInfoEle in IdentityInfoNodeList)
                                                                    {
                                                                        switch (IdentityInfoEle.Name.ToLower())
                                                                        {
                                                                            case "identtype":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType = IdentityInfoEle.InnerText;
                                                                                break;
                                                                            case "identnum":
                                                                                qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum = IdentityInfoEle.InnerText;
                                                                                break;

                                                                            default:
                                                                                break;
                                                                        }
                                                                    }
                                                                    break;
                                                                case "custname":
                                                                    qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName = nodelistCustInfoEle.InnerText;
                                                                    break;
                                                                case "custbrand":
                                                                    qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustBrand = nodelistCustInfoEle.InnerText;
                                                                    break;
                                                                case "custgroup":
                                                                    qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup = nodelistCustInfoEle.InnerText;
                                                                    break;
                                                                case "custservicelevel":
                                                                    qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel = nodelistCustInfoEle.InnerText;
                                                                    break;
                                                                case "custaddress":
                                                                    qryReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress = nodelistCustInfoEle.InnerText;
                                                                    break;

                                                            }
                                                        }
                                                        break;
                                                }
                                            }
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                break;
                        }
                    }
                }
            }
            return qryReturn;
        }