예제 #1
0
    public CustInfoUploadResult CustInfoUpload(string ProvinceID, string ID, string CustType, string CustAccount, string CustLevel,
                                               string RealName, string ContactTel, string Address, string ZipCode, string CertificateCode,
                                               string CertificateType, string AreaID, string Sex, string Email, string dealType, AuthenRecord[] AuthenRecords, string ExtendField)
    {
        CustInfoUploadResult Result = new CustInfoUploadResult();
        string SPID = "";

        Result.Result           = ErrorDefinition.IError_Result_UnknowError_Code;
        Result.ErrorDescription = "";
        Result.ID          = ID;
        Result.ExtendField = "";
        Result.CustID      = "";
        string strXML = "";



        try
        {
            #region 数据校验

            if (CommonUtility.IsEmpty(ProvinceID))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                Result.ErrorDescription = "ProvinceID不能为空";
                return(Result);
            }


            if (CommonUtility.IsEmpty(CustType))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CUstType不能为空";
                return(Result);
            }


            if (CommonUtility.IsEmpty(CustLevel))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidCustLevel_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustLevel_Msg + ",不能为空";
                return(Result);
            }
            if (CustType.Length != 2)
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CustType无效,长度不为2";
                return(Result);
            }

            if (CommonUtility.IsEmpty(RealName))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidPassword_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRealName_Msg + ",不能为空";
                return(Result);
            }


            if (!CommonUtility.IsEmpty(ExtendField))
            {
                SPID = CommonBizRules.GetValueFromXmlStr(ExtendField, "SPID");
            }

            switch (CustType)
            {
            case "01":
                CustType = "14";
                break;

            case "02":
                CustType = "20";
                break;

            case "03":
                CustType = "12";
                break;

            case "09":
                CustType = "90";
                break;

            case "11":
                CustType = "30";
                break;

            case "00":
                CustType = "42";
                break;
            }


            Result.Result = BTForCrmBizRules.CustInfoUpload(ProvinceID, ID, CustType, CustAccount, CustLevel,
                                                            RealName, ContactTel, Address, ZipCode, CertificateCode,
                                                            CertificateType, AreaID, Sex, Email, dealType, ExtendField, AuthenRecords, SPID, out Result.CustID, out Result.ErrorDescription);

            if (Result.Result == 0)
            {
                //通知积分系统
                CIP2BizRules.InsertCustInfoNotify(Result.CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", dealType, out Result.ErrorDescription);
            }
            strXML = BTBizRules.GenerateResultXml(Result.Result.ToString(), Result.ErrorDescription);
            #endregion
        }
        catch (Exception ex)
        {
            Result.Result           = ErrorDefinition.IError_Result_System_UnknowError_Code;
            Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + "," + ex.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(";ProvinceID - " + ProvinceID);
            msg.Append(";ID - " + ID);
            msg.Append(";CustType - " + CustType);
            msg.Append(";CustAccount - " + CustAccount);
            msg.Append(";CustLevel - " + CustLevel);
            msg.Append(";RealName - " + RealName);
            msg.Append(";ContactTel - " + ContactTel);
            msg.Append(";Address - " + Address);
            msg.Append(";ZipCode - " + ZipCode);
            msg.Append(";CertificateCode - " + CertificateCode);
            msg.Append(";CertificateType - " + CertificateType);
            msg.Append(";AreaID - " + AreaID);
            msg.Append(";Sex - " + Sex);
            msg.Append(";Email - " + Email);
            msg.Append(";dealType - " + dealType);
            msg.Append(";ExtendField - " + ExtendField);
            msg.Append(";strXML - " + strXML);

            if (AuthenRecords != null)
            {
                if (AuthenRecords.Length > 0)
                {
                    for (int i = 0; i < AuthenRecords.Length; i++)
                    {
                        msg.Append(";AuthenType - " + AuthenRecords[i].AuthenType);
                        msg.Append(";AuthenName - " + AuthenRecords[i].AuthenName);
                    }
                }
            }
            msg.Append(";ExtendField - " + ExtendField);
            msg.Append("\r\n");
            msg.Append("处理结果 - " + Result.Result);
            msg.Append("; 错误描述 - " + Result.ErrorDescription);
            msg.Append("; CustID - " + Result.CustID);
            msg.Append("; ID - " + Result.ID);
            msg.Append("; ErrorDescription - " + Result.ErrorDescription);
            msg.Append("; ExtendField - " + Result.ExtendField + "\r\n");
            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

            BTUCenterInterfaceLog.CenterForCRM("CustInfoUpload", msg);
            #endregion
        }

        return(Result);
    }
예제 #2
0
    public CustInfoUploadResult CustInfoUpload(string ProvinceID, string ID, string CustType, string CustAccount, string CustLevel,
         string RealName, string ContactTel, string Address, string ZipCode, string CertificateCode,
         string CertificateType, string AreaID, string Sex, string Email, string dealType,AuthenRecord[] AuthenRecords, string ExtendField)
    {
        CustInfoUploadResult Result = new CustInfoUploadResult();
        string SPID = "";
        Result.Result = ErrorDefinition.IError_Result_UnknowError_Code;
        Result.ErrorDescription = "";
        Result.ID = ID;
        Result.ExtendField = "";
        Result.CustID = "";
        string strXML = "";

        try
        {
            #region 数据校验

            if (CommonUtility.IsEmpty(ProvinceID))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                Result.ErrorDescription = "ProvinceID不能为空";
                return Result;
            }

            if (CommonUtility.IsEmpty(CustType))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CUstType不能为空";
                return Result;
            }

            if (CommonUtility.IsEmpty(CustLevel))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidCustLevel_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustLevel_Msg + ",不能为空";
                return Result;
            }
            if (CustType.Length != 2)
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CustType无效,长度不为2";
                return Result;
            }

            if (CommonUtility.IsEmpty(RealName))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidPassword_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRealName_Msg + ",不能为空";
                return Result;
            }

            if (!CommonUtility.IsEmpty(ExtendField))
            {
                SPID = CommonBizRules.GetValueFromXmlStr(ExtendField, "SPID");
            }

            switch(CustType)
            {
                case "01":
                    CustType = "14";
                    break;
                case "02":
                    CustType = "20";
                    break;
                case "03":
                    CustType = "12";
                    break;
                case "09":
                    CustType = "90";
                    break;
                case "11":
                    CustType = "30";
                    break;
                case "00":
                    CustType = "42";
                    break;
            }

            Result.Result = BTForCrmBizRules.CustInfoUpload(ProvinceID, ID, CustType, CustAccount, CustLevel,
              RealName, ContactTel, Address, ZipCode, CertificateCode,
              CertificateType, AreaID, Sex, Email, dealType, ExtendField, AuthenRecords,SPID, out Result.CustID,out Result.ErrorDescription);

            if (Result.Result == 0)
            {
                //通知积分系统
                CIP2BizRules.InsertCustInfoNotify(Result.CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", dealType, out Result.ErrorDescription);

            }
           strXML = BTBizRules.GenerateResultXml(Result.Result.ToString(), Result.ErrorDescription);
            #endregion
        }
        catch (Exception ex)
        {
            Result.Result = ErrorDefinition.IError_Result_System_UnknowError_Code;
            Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + "," + ex.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(";ProvinceID - " + ProvinceID);
            msg.Append(";ID - " + ID);
            msg.Append(";CustType - " + CustType);
             msg.Append(";CustAccount - " + CustAccount);
             msg.Append(";CustLevel - " + CustLevel);
             msg.Append(";RealName - " + RealName);
             msg.Append(";ContactTel - " + ContactTel);
             msg.Append(";Address - " + Address);
             msg.Append(";ZipCode - " + ZipCode);
             msg.Append(";CertificateCode - " + CertificateCode);
             msg.Append(";CertificateType - " + CertificateType);
             msg.Append(";AreaID - " + AreaID);
             msg.Append(";Sex - " + Sex);
             msg.Append(";Email - " + Email);
             msg.Append(";dealType - " + dealType);
             msg.Append(";ExtendField - " + ExtendField);
             msg.Append(";strXML - " + strXML);

            if(AuthenRecords != null )
            {
                if (AuthenRecords.Length > 0)
                {
                    for (int i = 0; i < AuthenRecords.Length; i++)
                    {
                        msg.Append(";AuthenType - " + AuthenRecords[i].AuthenType);
                        msg.Append(";AuthenName - " + AuthenRecords[i].AuthenName);
                    }
                }
            }
            msg.Append(";ExtendField - " + ExtendField);
            msg.Append("\r\n");
            msg.Append("处理结果 - " + Result.Result);
            msg.Append("; 错误描述 - " + Result.ErrorDescription);
            msg.Append("; CustID - " + Result.CustID);
            msg.Append("; ID - " + Result.ID);
            msg.Append("; ErrorDescription - " + Result.ErrorDescription);
            msg.Append("; ExtendField - " + Result.ExtendField + "\r\n");
            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

            BTUCenterInterfaceLog.CenterForCRM("CustInfoUpload", msg);
            #endregion
        }

        return Result;
    }