public static int UserAuthCrmV3(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 string ExtendField) { 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 = ""; ExtendField = ""; string str = ""; string rStr = ""; 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; } #region ���ز��� /* switch (UAProvinceID) { case "02": //��ط��������� DstOrgID = "600102"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6001020001"; break; case "19": //��ط��������� DstOrgID = "600203"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6002030001"; break; case "05": //��ط��������� DstOrgID = "609906"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6099060001"; break; case "08": //��ط��������� DstOrgID = "609905"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6099050001"; break; case "30": //��ط��������� DstOrgID = "600404"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6004040001"; break; case "20": //��ط��������� DstOrgID = "600101"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6001010001"; break; default: ErrMsg = "ָ��ʡ������Ŧ��"; return -1; break; } **/ #endregion 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��Ŧ����:"); logger.Info(str); //��Crm������ѯ DEPService obj = new DEPService(); obj.Url = System.Configuration.ConfigurationManager.AppSettings["DEPServiceURL"]; rStr = obj.exchange(str); TestStr = rStr; logger.Info("crm��Ŧ���ر���:"); logger.Info(rStr); //����Crm���ؿͻ���Ϣ QryCustInfoReturn qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoXML(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) { ErrMsg = ex1.Message.ToString(); Result = -29999; } finally { LogCrmSSOPost(str); LogCrmSSOReturn(rStr); } return Result; }
public static int UserAuthCrm1(string UAProvinceID,string AreaCode, 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 ErrMsg, out string TestStr) { int Result = -19999; RealName = ""; UserName = ""; NickName = ""; OutID = ""; CustType = ""; CustID = ""; ErrMsg = ""; TestStr = ""; string str = ""; string rStr = ""; 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; } #region ���ز��� //TestStr = "DstOrgID" + DstOrgID + "DstSysID" + DstSysID; //return -1; /* switch (UAProvinceID) { case "02": //��ط��������� DstOrgID = "600102"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6001020001"; break; case "19": //��ط��������� DstOrgID = "600203"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6002030001"; break; case "05": //��ط��������� DstOrgID = "609906"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6099060001"; break; case "08": //��ط��������� DstOrgID = "609905"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6099050001"; break; case "30": //��ط��������� DstOrgID = "600404"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6004040001"; break; case "20": //��ط��������� DstOrgID = "600101"; //��ط�(ϵͳ/ƽ̨)���� DstSysID = "6001010001"; break; default: ErrMsg = "ָ��ʡ������Ŧ��"; return -1; break; } **/ #endregion 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" ) { //string[] alUsername = Username.Split('-'); CityCode = AreaCode; //CodeValue = alUsername[1]; if (Username.StartsWith(CityCode)) { //CodeValue = Username.TrimStart(CityCode); CodeValue = Username.Substring(CityCode.Length); } else { CodeValue = UserName; } } else { //��ʶ���� CodeValue = Username; //����ش��� CityCode = ""; } //�Ƿ��������� // 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); //Crm��ѯ DEPService obj = new DEPService(); obj.Url = System.Configuration.ConfigurationManager.AppSettings["DEPServiceURL"]; rStr = obj.exchange(str); TestStr = rStr; //����Crm���ؿͻ���Ϣ QryCustInfoReturn qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoXML(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; //�ͻ�����ת�� 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, //"021", 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) { //err_code.InnerHtml = ErrMsg; return Result; } CIP2BizRules.InsertCustInfoNotify(CustID, "2", ScoreBesttoneSPID, "", "0", out ErrMsg); } else { ErrMsg = "�������ͼ�����:" + qryCustInfoReturn.TcpCont.Response.RspType + "Ӧ�����:" + qryCustInfoReturn.TcpCont.Response.RspCode + "����:" + qryCustInfoReturn.TcpCont.Response.RspDesc; //return -1; int rspcode = -1; try { rspcode = int.Parse(qryCustInfoReturn.TcpCont.Response.RspCode); } catch { return rspcode; } return rspcode; } } catch (Exception ex1) { ErrMsg = ex1.Message.ToString(); Result = -29999; } finally { #region WriteLog StringBuilder msg = new StringBuilder(); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n"); msg.Append("��Ŧ�û���֤�ӿ� ���ͱ���" + DateTime.Now.ToString("u") + "\r\n"); msg.Append("XML - " + str); BTUCenterInterfaceLog.CenterForCRM("CrmSSOPost", msg); StringBuilder msgResult = new StringBuilder(); msgResult.Append("��Ŧ�û���֤�ӿ� ������" + DateTime.Now.ToString("u") + "\r\n"); msgResult.Append("XML - " + rStr); msgResult.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n"); BTUCenterInterfaceLog.CenterForCRM("CrmSSOReturn", msgResult); #endregion } return Result; }