public static int UserAuthCrmV2(string UAProvinceID, 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 CustAddress, out string ErrMsg, out string TestStr, out QryCustInfoV2Return qryCustInfoReturn) { logger.Info("UserAuthCrmV2"); logger.Info("UAProvinceID=" + UAProvinceID + ";AuthenType=" + AuthenType + ";Username="******";RealName1=" + RealName1 + ";Password="******";PasswdFlag=" + PasswdFlag + ";ScoreBesttoneSPID=" + ScoreBesttoneSPID); int Result = -19999; RealName = ""; UserName = ""; NickName = ""; OutID = ""; CustAddress = ""; CustType = ""; CustID = ""; ErrMsg = ""; TestStr = ""; string str = ""; string rStr = ""; qryCustInfoReturn = null; try { if (ScoreBesttoneSPID == "") { ScoreBesttoneSPID = System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"]; } string BusCode = "BUS17002"; //ҵ���ܱ��� string ServiceCode = "SVC11001"; //�ӿ�Э����� string ServiceContractVer = "SVC1100120091002"; //Э�鵱ǰʹ�õİ汾�� 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 = "31"; //�������ʹ��� //��ʶ���� 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 = ""; CodeValue = Username; } } else { CityCode = ""; CodeValue = Username; } //�Ƿ��������� //string PasswdFlag = "1"; //���� string CCPasswd = Password; //����Crm��ѯxml XMLExchange xMLExchange = new XMLExchange(); str = xMLExchange.BuildQryCustInfoXML(BusCode, ServiceCode, ServiceContractVer, ActionCode, TransactionID, ServiceLevel, SrcOrgID, SrcSysID, SrcSysSign, DstOrgID, DstSysID, ReqTime, InfoTypeID, CodeType, CodeValue, CityCode, PasswdFlag, CCPasswd); logger.Info("����crm-v4��Ŧ����:"); logger.Info(str); //��Crm������ѯ DEPService obj = new DEPService(); obj.Url = System.Configuration.ConfigurationManager.AppSettings["DEPServiceURL"]; rStr = obj.exchange(str); TestStr = rStr; logger.Info("crm-v4��Ŧ���ر���:"); logger.Info(rStr); //����Crm���ؿͻ���Ϣ qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoV2XML(rStr); if (qryCustInfoReturn.TcpCont.Response.RspType == "0") { RealName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName; UserName = ""; NickName = ""; CustID = ""; OutID = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue; CustAddress = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress; //�ͻ�����ת�� CustType = ConvertCustType(qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup); //֤������ת�� string IdentType = ConvertIdentType(qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType); //��Ա����ת�� string CustServiceLevel = ConvertCustServiceLevel(qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel); if (RealName1 != "") RealName = RealName1; //ȫ��CRM�û�ע�ᵽ�Ű� Result = UserRegistry.getUserRegistryCrm(UAProvinceID, qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode, CustType, //�ͻ����� IdentType, qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum, RealName, CustServiceLevel, "2", //δ֪ OutID, ScoreBesttoneSPID, qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress, out CustID, out ErrMsg); if (Result != 0) { return Result; } CIP2BizRules.InsertCustInfoNotify(CustID, "2", ScoreBesttoneSPID, "", "0", out ErrMsg); } else { ErrMsg = "�������ͼ�����:" + qryCustInfoReturn.TcpCont.Response.RspType + "Ӧ�����:" + qryCustInfoReturn.TcpCont.Response.RspCode + "����:" + qryCustInfoReturn.TcpCont.Response.RspDesc; int rspcode = -1; try { rspcode = int.Parse(qryCustInfoReturn.TcpCont.Response.RspCode); } catch { return rspcode; } return rspcode; } } catch (Exception ex1) { logger.Info(ex1.StackTrace); ErrMsg = ex1.Message.ToString(); Result = -29999; } finally { LogCrmSSOPost(str); LogCrmSSOReturn(rStr); } return Result; }
public static string GenerateOuterIDXmlV3(string OuterID, string ProvinceID, string LoginTicket,string CustAddress, string ResType, string RspCode, string RspDesc, string AuthenticationKey, QryCustInfoV2Return qryCustInfoReturn) { string Result = ""; StringBuilder xmlDoc = new StringBuilder(); try { XmlElement XmlRoot = null; XmlDocument XmlDom = new XmlDocument(); Result = "<Root></Root>"; // XmlDom.LoadXml(Result); XmlRoot = XmlDom.DocumentElement; VNetXml.XMLSetChild(XmlDom, XmlRoot, "OuterID", OuterID); VNetXml.XMLSetChild(XmlDom, XmlRoot, "ProvinceID", ProvinceID); VNetXml.XMLSetChild(XmlDom, XmlRoot, "LoginTicket", LoginTicket); VNetXml.XMLSetChild(XmlDom, XmlRoot, "CustAddress", CustAddress); VNetXml.XMLSetChild(XmlDom, XmlRoot, "ResType", ResType); VNetXml.XMLSetChild(XmlDom, XmlRoot, "RspCode", RspCode); VNetXml.XMLSetChild(XmlDom, XmlRoot, "RspDesc", RspDesc); VNetXml.XMLSetChild(XmlDom, XmlRoot, "AuthenticationKey", AuthenticationKey); //Result = @"<?xml version='1.0' encoding='gb2312' standalone='yes'?>" + XmlRoot.OuterXml; Result = Result + XmlRoot.OuterXml; xmlDoc.Append("<ContractRoot>"); xmlDoc.Append("<SvcCont>"); if (qryCustInfoReturn != null) { xmlDoc.Append("<QryInfoRsp>"); xmlDoc.AppendFormat("<InfoTypeID>{0}</InfoTypeID>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoTypeID); xmlDoc.Append("<InfoCont>"); xmlDoc.Append("<CustInfo>"); xmlDoc.Append("<BelongInfo>"); xmlDoc.AppendFormat("<ProvinceCode>{0}</ProvinceCode>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceCode); xmlDoc.AppendFormat("<ProvinceName>{0}</ProvinceName>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.ProvinceName); xmlDoc.AppendFormat("<CityCode>{0}</CityCode>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode); xmlDoc.AppendFormat("<CityName>{0}</CityName>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityName); xmlDoc.Append("</BelongInfo>"); xmlDoc.Append("<PartyCodeInfo>"); xmlDoc.AppendFormat("<CodeType>{0}</CodeType>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeType); xmlDoc.AppendFormat("<CodeValue>{0}</CodeValue>", qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue); xmlDoc.AppendFormat("<CityCode>{0}</CityCode>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CityCode); xmlDoc.Append("</PartyCodeInfo>"); xmlDoc.Append("<IdentityInfo>"); xmlDoc.AppendFormat("<IdentNum>{0}</IdentNum>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum); xmlDoc.AppendFormat("<IdentType>{0}</IdentType>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType); xmlDoc.Append("</IdentityInfo>"); xmlDoc.AppendFormat("<CustName>{0}</CustName>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName); xmlDoc.AppendFormat("<CustBrand>{0}</CustBrand>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustBrand); xmlDoc.AppendFormat("<CustGroup>{0}</CustGroup>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup); xmlDoc.AppendFormat("<CustServiceLevel>{0}</CustServiceLevel>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel); xmlDoc.AppendFormat("<CustAddress>{0}</CustAddress>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress); xmlDoc.Append("</CustInfo>"); //������Ϣ xmlDoc.Append("<PointInfo>"); xmlDoc.AppendFormat("<PointType>{0}</PointType>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointType); xmlDoc.AppendFormat("<PointValueSum>{0}</PointValueSum>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValueSum); xmlDoc.AppendFormat("<PointValue>{0}</PointValue>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValue); xmlDoc.AppendFormat("<PointTime>{0}</PointTime>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointTime); xmlDoc.AppendFormat("<PointValueEndOfYear>{0}</PointValueEndOfYear>",qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValueEndOfYear); foreach (QryCustInfoV2Return.SvcContResult.QryInfoRspResult.InfoContResult.PointInfoResult.PointItem item in qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointItems) { xmlDoc.Append("<PointItems>"); xmlDoc.AppendFormat("<PointItemID>{0}</PointItemID>",item.PointItemID); xmlDoc.AppendFormat("<PointItemName>{0}</PointItemName>",item.PointItemName); xmlDoc.AppendFormat("<PointItemValue>{0}</PointItemValue>",item.PointItemValue); xmlDoc.AppendFormat("<PointItemTime>{0}</PointItemTime>",item.PointItemTime); xmlDoc.Append("</PointItems>"); } xmlDoc.Append("</PointInfo>"); xmlDoc.Append("</InfoCont>"); xmlDoc.Append("</QryInfoRsp>"); } xmlDoc.Append("</SvcCont>"); xmlDoc.Append("</ContractRoot>"); Result = Result + xmlDoc.ToString(); } catch (Exception e) { } finally { } return Result; }
/// <summary> /// 解析向Crm查询客户信息时返回的XML /// </summary> /// <param name="QryUserStatusXMLText"></param> /// <returns></returns> public QryCustInfoV2Return AnalysisQryCustInfoV2XML(string QryCustInfoXMLText) { QryCustInfoV2Return qryReturn = new QryCustInfoV2Return(); 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; case "pointinfo": XmlNodeList nodelistpointInfo = nodelistInfoContEle.ChildNodes; List<QryCustInfoV2Return.SvcContResult.QryInfoRspResult.InfoContResult.PointInfoResult.PointItem> pointItems = new List<QryCustInfoV2Return.SvcContResult.QryInfoRspResult.InfoContResult.PointInfoResult.PointItem>(); QryCustInfoV2Return.SvcContResult.QryInfoRspResult.InfoContResult.PointInfoResult.PointItem pointitem = null; foreach (XmlElement nodelistpointInfoEle in nodelistpointInfo) { switch (nodelistpointInfoEle.Name.ToLower()) { case "pointtype": qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointType = nodelistpointInfoEle.InnerText; break; case "pointvalue": qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValue = nodelistpointInfoEle.InnerText; break; case "pointvaluesum": qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValueSum = nodelistpointInfoEle.InnerText; break; case "pointtime": qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointTime = nodelistpointInfoEle.InnerText; break; case "pointvalueendofyear": qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointValueEndOfYear = nodelistpointInfoEle.InnerText; break; case "pointitems": XmlNodeList nodelistpointitems = nodelistpointInfoEle.ChildNodes; pointitem = new QryCustInfoV2Return.SvcContResult.QryInfoRspResult.InfoContResult.PointInfoResult.PointItem(); foreach (XmlElement nodelistpointitemsEle in nodelistpointitems) { if ("pointitemid".Equals(nodelistpointitemsEle.Name.ToLower())) { pointitem.PointItemID = nodelistpointitemsEle.InnerText; } else if ("pointitemname".Equals(nodelistpointitemsEle.Name.ToLower())) { pointitem.PointItemName = nodelistpointitemsEle.InnerText; } else if ("pointitemvalue".Equals(nodelistpointitemsEle.Name.ToLower())) { pointitem.PointItemValue = nodelistpointitemsEle.InnerText; } else if ("pointitemtime".Equals(nodelistpointitemsEle.Name.ToLower())) { pointitem.PointItemTime = nodelistpointitemsEle.InnerText; } } pointItems.Add(pointitem); break; } } qryReturn.SvcCont.QryInfoRsp.InfoCont.PointInfo.PointItems = pointItems; break; } } break; default: break; } } break; } } } } return qryReturn; }
/// <summary> /// ������֤v4 out ResType, out RspCode, out RspDesc, out AuthenticationKey /// ���ߣ�lihongtu ʱ�䣺2013-9-1 /// </summary> public static int UserAuthV4(string SPID, string AuthenName, string AuthenType, string Password, HttpContext Context, string ProvinceID, string IsQuery, string PwdType, out string ErrMsg, out string CustID, out string UserAccount, out string CustType, out string outerid, out string ProvinceID1, out string RealName, out string UserName, out string NickName, out string CustAddress, out string ResType, out string RspCode, out string RspDesc, out string AuthenticationKey, out string TestStr, out QryCustInfoV2Return qryCustInfoReturn) { StringBuilder msg_inbound = new StringBuilder(); msg_inbound.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); msg_inbound.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n"); msg_inbound.Append("��login2����\r\n"); msg_inbound.Append("ProvinceID=" + ProvinceID + "\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("SSO", msg_inbound); qryCustInfoReturn = null; int Result = ErrorDefinition.IError_Result_UnknowError_Code; ErrMsg = ""; CustID = ""; UserAccount = ""; CustType = ""; TestStr = ""; string UProvinceID = ""; string SysID = ""; string AreaID = ""; int CrmResult = ErrorDefinition.IError_Result_UnknowError_Code; outerid = ""; CustAddress = ""; string ProvinceID2 = ""; string Areaid = ""; int result1 = -1; //�ֻ� if (AuthenType == "7") { result1 = GetPhoneTOArea(AuthenName, out ProvinceID2, out Areaid, out ErrMsg); } ProvinceID1 = ProvinceID; RealName = ""; UserName = ""; NickName = ""; string AuthenTypes = "3"; string ProvinceID3 = System.Configuration.ConfigurationManager.AppSettings["ProvinceID3"]; logger.Info("UserAuthV4 ProvinceID3=" + ProvinceID3); string ProvinceID3_1 = System.Configuration.ConfigurationManager.AppSettings["ProvinceID3_1"]; logger.Info("UserAuthV4 ProvinceID3_1=" + ProvinceID3_1); string POSSPID = System.Configuration.ConfigurationManager.AppSettings["POSSPID"]; logger.Info("UserAuthV4 POSSPID=" + POSSPID); msg_inbound.Append("ProvinceID3=" + ProvinceID3 + "\r\n"); msg_inbound.Append("ProvinceID3_1=" + ProvinceID3_1 + "\r\n"); if (ProvinceID == "") { if (result1 == 0) { if (ProvinceID3.IndexOf(ProvinceID2) >= 0 && AuthenTypes != AuthenType) { ProvinceID1 = ProvinceID2; ProvinceID = ProvinceID2; } else if (ProvinceID3_1.IndexOf(ProvinceID) >= 0 && AuthenTypes != AuthenType) { ProvinceID1 = ProvinceID2; ProvinceID = ProvinceID2; } } } logger.Info("UserAuthV4 ProvinceID=" + ProvinceID); logger.Info("UserAuthV4 ProvinceID1=" + ProvinceID1); logger.Info("UserAuthV4 ProvinceID2=" + ProvinceID2); ResType = ""; RspCode = ""; RspDesc = ""; AuthenticationKey = ""; //POS��¼ try { if (ProvinceID != "" && POSSPID.IndexOf(SPID) > 0 && ProvinceID3_1.IndexOf(ProvinceID) >= 0 && AuthenTypes != AuthenType && AuthenType != "18") { logger.Info("UserAuthV4 POS��¼"); string dealType = "0"; msg_inbound.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); msg_inbound.Append("������pos��½crm��֤\r\n"); Result = CrmSSO.UserAuthCrm(ProvinceID, AuthenType, AuthenName, "", Password, "0", "", Context, out RealName, out UserName, out NickName, out outerid, out CustType, out CustID, out ErrMsg, out TestStr); msg_inbound.Append("��pos��½crm��֤����:result" + Result + "\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("REVERSE-SSO", msg_inbound); if (Result == 0) { msg_inbound.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); msg_inbound.Append("��pos��½��֤��������֪ͨ����Ϣϵͳ\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("REVERSE-SSO", msg_inbound); //֪ͨ����ϵͳ // CommonBizRules.CustInfoNotify(CustID, CustID, "", dealType, "", "", CustType, ProvinceID, SPID); CIP2BizRules.InsertCustInfoNotify(CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], Password, "0", out ErrMsg); } return Result; } else if (ProvinceID != "" && ProvinceID3_1.IndexOf(ProvinceID) >= 0 && AuthenTypes != AuthenType) { logger.Info("UserAuthV4 ��pos��½����UserAuthCrm:ProvinceID=" + ProvinceID + ";Authentypes=" + AuthenTypes); StringBuilder msg1 = new StringBuilder(); msg1.Append("UserAuthV4 ��pos��½����UserAuthCrm:ProvinceID=" + ProvinceID + "\r\n"); msg1.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BTUCenterInterfaceLog.CenterForBizTourLog("CRMversessoUserAuth", msg1); string dealType = "0"; //����Ҫ���룬ȡ��Ϣ if (IsQuery == "1") { logger.Info("UserAuthV4 ����Ҫ���룬ȡ��Ϣ"); Result = CrmSSO.UserAuthCrmV2(ProvinceID, AuthenType, AuthenName, "", Password, "0", "", Context, out RealName, out UserName, out NickName, out outerid, out CustType, out CustID, out CustAddress, out ErrMsg, out TestStr, out qryCustInfoReturn); } //��Ҫ���������֤ else if (ProvinceID != "" && ProvinceID3.IndexOf(ProvinceID) >= 0 && AuthenTypes != AuthenType) { logger.Info("UserAuthV4 ��Ҫ���������֤"); StringBuilder msg2 = new StringBuilder(); msg2.Append("��ʼ��crm������"); msg2.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BTUCenterInterfaceLog.CenterForBizTourLog("CRMversessoUserAuth", msg2); //Result = CrmSSO.UserAuthCrm(ProvinceID, AuthenType, AuthenName, "", Password, "1", "", Context, out RealName, out UserName, // out NickName, out outerid, out CustType, out CustID, out ErrMsg, out TestStr); Result = UamAuthen(SPID, AuthenName, AuthenType, Password, Context, ProvinceID, IsQuery, "1", out ErrMsg, out ResType, out RspCode, out RspDesc, out AuthenticationKey); if (Result != 0) { return Result; } else { Result = CrmSSO.UserAuthCrmV2(ProvinceID, AuthenType, AuthenName, "", Password, "0", "", Context, out RealName, out UserName, out NickName, out outerid, out CustType, out CustID, out CustAddress, out ErrMsg, out TestStr, out qryCustInfoReturn); } msg2.Append("�������result" + Result); msg2.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BTUCenterInterfaceLog.CenterForBizTourLog("CRMversessoUserAuth", msg2); } else if (AuthenType == "18") { Result = CrmSSO.UserAuthCrmV2(ProvinceID, AuthenType, AuthenName, "", Password, "1", "", Context, out RealName, out UserName, out NickName, out outerid, out CustType, out CustID, out CustAddress,out ErrMsg, out TestStr, out qryCustInfoReturn); } if (Result == 0) { StringBuilder msg3 = new StringBuilder(); msg3.Append("��֪ͨ�����̳�"); msg3.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BTUCenterInterfaceLog.CenterForBizTourLog("CRMversessoUserAuth", msg3); //֪ͨ����ϵͳ // CommonBizRules.CustInfoNotify(CustID, CustID, "", dealType, "", "", CustType, ProvinceID, SPID); CIP2BizRules.InsertCustInfoNotify(CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], Password, "0", out ErrMsg); msg3.Append("֪ͨ�����̳����"); msg3.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BTUCenterInterfaceLog.CenterForBizTourLog("CRMversessoUserAuth", msg3); } return Result; } } catch (Exception e) { logger.Info(e.StackTrace); } /////////// int lenRep = AuthenName.IndexOf("-"); if (lenRep < 7) AuthenName = AuthenName.Replace("-", ""); try { #region �������ݲ�ѯ��֤ SqlCommand cmd = new SqlCommand(); cmd.CommandTimeout = 15; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "dbo.up_Customer_OV3_Interface_UserAuthV2"; SqlParameter parSPID = new SqlParameter("@SPID", SqlDbType.VarChar, 8); parSPID.Value = SPID; cmd.Parameters.Add(parSPID); SqlParameter parAuthenName = new SqlParameter("@AuthenName", SqlDbType.VarChar, 256); parAuthenName.Value = AuthenName; cmd.Parameters.Add(parAuthenName); SqlParameter parAuthenType = new SqlParameter("@AuthenType", SqlDbType.VarChar, 2); parAuthenType.Value = AuthenType; cmd.Parameters.Add(parAuthenType); SqlParameter parPwd = new SqlParameter("@Pwd", SqlDbType.VarChar, 100); parPwd.Value = CryptographyUtil.Encrypt(Password); cmd.Parameters.Add(parPwd); SqlParameter parPwdType = new SqlParameter("@PwdType", SqlDbType.VarChar, 100); parPwdType.Value = PwdType; cmd.Parameters.Add(parPwdType); 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); SqlParameter parCustID = new SqlParameter("@CustID ", SqlDbType.VarChar, 16); parCustID.Direction = ParameterDirection.Output; cmd.Parameters.Add(parCustID); SqlParameter parUserAccount = new SqlParameter("@UserAccount ", SqlDbType.VarChar, 16); parUserAccount.Direction = ParameterDirection.Output; cmd.Parameters.Add(parUserAccount); SqlParameter parCustType = new SqlParameter("@CustType ", SqlDbType.VarChar, 2); parCustType.Direction = ParameterDirection.Output; cmd.Parameters.Add(parCustType); SqlParameter parUProvinceID = new SqlParameter("@UProvinceID ", SqlDbType.VarChar, 2); parUProvinceID.Direction = ParameterDirection.Output; cmd.Parameters.Add(parUProvinceID); SqlParameter parSysID = new SqlParameter("@SysID ", SqlDbType.VarChar, 8); parSysID.Direction = ParameterDirection.Output; cmd.Parameters.Add(parSysID); SqlParameter parAreaID = new SqlParameter("@AreaID ", SqlDbType.VarChar, 3); parAreaID.Direction = ParameterDirection.Output; cmd.Parameters.Add(parAreaID); SqlParameter parOuterID = new SqlParameter("@outerid ", SqlDbType.VarChar, 30); parOuterID.Direction = ParameterDirection.Output; cmd.Parameters.Add(parOuterID); SqlParameter parUserName = new SqlParameter("@UserName ", SqlDbType.VarChar, 30); parUserName.Direction = ParameterDirection.Output; cmd.Parameters.Add(parUserName); SqlParameter parRealName = new SqlParameter("@RealName ", SqlDbType.VarChar, 30); parRealName.Direction = ParameterDirection.Output; cmd.Parameters.Add(parRealName); SqlParameter parNickName = new SqlParameter("@NickName ", SqlDbType.VarChar, 30); parNickName.Direction = ParameterDirection.Output; cmd.Parameters.Add(parNickName); DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr); Result = int.Parse(parResult.Value.ToString()); ErrMsg = parErrMsg.Value.ToString(); CustID = parCustID.Value.ToString(); UserAccount = parUserAccount.Value.ToString(); CustType = parCustType.Value.ToString(); UProvinceID = parUProvinceID.Value.ToString(); SysID = parSysID.Value.ToString(); AreaID = parAreaID.Value.ToString(); outerid = parOuterID.Value.ToString(); ProvinceID1 = UProvinceID; RealName = parRealName.Value.ToString(); UserName = parUserName.Value.ToString(); NickName = parNickName.Value.ToString(); #endregion //�������e�ҿ���c���û���ֱ�ӷ��ؽ�� if (CustType == "41" || CustType == "42" || CustType == "50" || CustType == "70") { return Result; } if (Result != 0) return Result; #region �����ÿ�����Զ����֤ string ExtendField = ""; SysInfoManager sm = new SysInfoManager(); Object sysData = sm.GetSysData(Context); string url = sm.GetPropertyBySysID(SysID, SysData.Field_InterfaceUrl, sysData); string str = ""; try { if (SysID == "15999999") { BTUCenter.Proxy.JX.CRMUserAuthResult resultObj = new BTUCenter.Proxy.JX.CRMUserAuthResult(); BTUCenter.Proxy.JX.JXCRMForBTUCenter obj = new BTUCenter.Proxy.JX.JXCRMForBTUCenter(); obj.Url = url; resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, Password, AreaID, ExtendField); if (resultObj.ErrorDescription == null) ErrMsg = ""; else ErrMsg = "" + resultObj.ErrorDescription; CrmResult = resultObj.Result; } else if (SysID == "13999999") { BTUCenter.Proxy.AH.CRMUserAuthResult resultObj = new BTUCenter.Proxy.AH.CRMUserAuthResult(); BTUCenter.Proxy.AH.CRMForBTUCenter obj = new BTUCenter.Proxy.AH.CRMForBTUCenter(); obj.Url = url; resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, Password, AreaID, ExtendField); ErrMsg = resultObj.ErrorDescription; CrmResult = resultObj.Result; } else if (SysID == "14999999") { BTUCenter.Proxy.FJ.IntegralApplyWSFactory obj = new BTUCenter.Proxy.FJ.IntegralApplyWSFactory(); BTUCenter.Proxy.FJ.CRMUserAuthResponse resultObj = new BTUCenter.Proxy.FJ.CRMUserAuthResponse(); obj.Url = url; resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, AreaID, Password, ExtendField); ErrMsg = resultObj.errorDescription; CrmResult = resultObj.result; } else if (SysID == "22999999") { BTUCenter.Proxy.HN.EaiWebService obj = new BTUCenter.Proxy.HN.EaiWebService(); BTUCenter.Proxy.HN.CRMUserAuthResult resultObj = new BTUCenter.Proxy.HN.CRMUserAuthResult(); obj.Url = url; resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, Password, AreaID, ExtendField); // resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, AreaID, Password, ExtendField); ErrMsg = resultObj.errorDescription; CrmResult = resultObj.result; } else { BTUCenter.Proxy.CRMUserAuthResult resultObj = new BTUCenter.Proxy.CRMUserAuthResult(); BTUCenter.Proxy.CRMForBTUCenter obj = new BTUCenter.Proxy.CRMForBTUCenter(); obj.Url = url; resultObj = obj.CRMUserAuth("3501", AuthenName, AuthenType, CustType, Password, AreaID, ExtendField); ErrMsg = resultObj.ErrorDescription; CrmResult = resultObj.Result; } } catch (Exception e) { logger.Info(e.ToString()); CrmResult = ErrorDefinition.IError_Result_System_UnknowError_Code; ErrMsg = str + "+++" + url + "==" + e.Message; } finally { #region WriteLog StringBuilder msg = new StringBuilder(); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n"); msg.Append("CRM������֤�ӿ� " + DateTime.Now.ToString("u") + "\r\n"); msg.Append(";SysID - " + SysID); msg.Append(";AuthenName - " + AuthenName); msg.Append(";AuthenType - " + AuthenType); msg.Append(";Password - " + Password); msg.Append(";CustType - " + CustType); msg.Append(";AreaID - " + AreaID); msg.Append(";ExtendField - " + ExtendField); msg.Append("\r\n"); msg.Append("������ - " + Result); msg.Append("CrmResult - " + CrmResult); msg.Append("; �������� - " + ErrMsg + "\r\n"); msg.Append("; ExtendField - " + ExtendField + "\r\n"); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("CRMUserAuth", msg); #endregion } #endregion } catch (Exception ex) { Result = ErrorDefinition.IError_Result_System_UnknowError_Code; ErrMsg = ex.Message; } if (CrmResult == -20505 & Result == 0) { Result = -20505; } else if (CrmResult != 0 & Result == 0) //��rusult ֵΪ1ʱ������ݶ�λ�ɹ��� ������֤ʧ�ܣ� { if (POSSPID.IndexOf(SPID) >= 0) { Result = 1; } else { Result = CrmResult; } } if (CrmResult == 0) if (CrmResult == 0 & Result == 0) Result = 0; return Result; }