コード例 #1
0
ファイル: AddressInfoBO.cs プロジェクト: qinains/lihongtu
        /// <summary>
        /// 客户地址信息查询接口返回记录
        /// 作者:周涛      时间:2009-08-03
        /// 修改:          时间:
        /// </summary>
        public static AddressInfoRecord[] GetAddressInfo(string SPID, string CustID, out int Result, out string ErrMsg)
        {
            AddressInfoRecord[] AddressInfoRecords = null;
            Result = ErrorDefinition.IError_Result_UnknowError_Code;
            ErrMsg = "";
            SqlConnection myCon = new SqlConnection(DBUtility.BestToneCenterConStr);

            try
            {
                SqlCommand cmd = new SqlCommand();
                DataSet    ds  = null;
                cmd.Connection  = myCon;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_Customer_V3_Interface_AddressInfoQuery";

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

                SqlParameter parCustID = new SqlParameter("@CustID", SqlDbType.VarChar, 16);
                parCustID.Value = CustID;
                cmd.Parameters.Add(parCustID);

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

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

                ds = DBUtility.FillData(cmd, DBUtility.BestToneCenterConStr);
                if (ds != null)
                {
                    if (ds.Tables.Count != 0)
                    {
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            int RowCount = ds.Tables[0].Rows.Count;
                            AddressInfoRecords = new AddressInfoRecord[RowCount];
                            AddressInfoRecord addressInfoRecord = new AddressInfoRecord();
                            for (int i = 0; i < RowCount; i++)
                            {
                                addressInfoRecord                = new AddressInfoRecord();
                                addressInfoRecord.AddressID      = long.Parse(ds.Tables[0].Rows[i]["SequenceID"].ToString().Trim());
                                addressInfoRecord.AreaCode       = ds.Tables[0].Rows[i]["AreaCode"].ToString().Trim();
                                addressInfoRecord.Address        = ds.Tables[0].Rows[i]["Address"].ToString().Trim();
                                addressInfoRecord.Zipcode        = ds.Tables[0].Rows[i]["ZipCode"].ToString().Trim();
                                addressInfoRecord.Type           = ds.Tables[0].Rows[i]["Type"].ToString().Trim();
                                addressInfoRecord.OtherType      = ds.Tables[0].Rows[i]["OtherType"].ToString().Trim();
                                addressInfoRecord.RelationPerson = ds.Tables[0].Rows[i]["RelationPerson"].ToString().Trim();
                                addressInfoRecord.Mobile         = ds.Tables[0].Rows[i]["Mobile"].ToString().Trim();
                                addressInfoRecord.FixedPhone     = ds.Tables[0].Rows[i]["FixedPhone"].ToString().Trim();
                                addressInfoRecord.DealType       = "3";
                                addressInfoRecord.ExtendField    = "";
                                AddressInfoRecords[i]            = addressInfoRecord;
                            }
                        }
                    }
                }
                Result = int.Parse(parResult.Value.ToString().Trim());
                ErrMsg = parErrMsg.Value.ToString().Trim();
            }
            catch (Exception e)
            {
                Result = ErrorDefinition.IError_Result_System_UnknowError_Code;
                ErrMsg = "获取客户地址信息出错," + e.Message;
            }
            return(AddressInfoRecords);
        }
コード例 #2
0
    public AddressInfoUploadResult AddressInfoUpload(string SPID, string CustID, AddressInfoRecord[] AddressInfoRecords, string ExtendField)
    {
        AddressInfoUploadResult Result = new AddressInfoUploadResult();

        Result.Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        Result.CustID = CustID;
        Result.ErrorDescription = "";
        Result.ExtendField = "";

        try
        {
            #region 数据合法性判断

            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + "不能为空";
                return Result;
            }

            if (SPID.Length != ConstDefinition.Length_SPID)
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + "长度有误";
                return Result;
            }
            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrorDescription);
            if (Result.Result != 0)
            {
                return Result;
            }

            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "AddressInfoUploadQuery", this.Context, out Result.ErrorDescription);
            if (Result.Result != 0)
            {
                return Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + "不能为空";
                return Result;
            }

            if (CustID.Length > ConstDefinition.Length_CustID)
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + "长度有误";
            }

            if (AddressInfoRecords == null)
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidParameter_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidParameter_Msg + "AddressInfoRecords为空";
                return Result;
            }
            #endregion

            Result.Result = AddressInfoBO.UploadAddressInfo(SPID, AddressInfoRecords, CustID, out Result.ErrorDescription);

        }
        catch (Exception e)
        {
            Result.Result = ErrorDefinition.IError_Result_System_UnknowError_Code;
            Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + e.Message;
        }
        finally
        {
            try
            {
                #region 文本日志
                StringBuilder msg = new StringBuilder();
                msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n");
                msg.Append("客户地址信息上传接口" + DateTime.Now.ToString("u") + "\r\n");
                msg.Append(";SPID - " + SPID);
                msg.Append(";CustID - " + CustID + "\r\n");
                if (AddressInfoRecords != null)
                {
                    if (AddressInfoRecords.Length > 0)
                    {
                        msg.Append("AddressInfoRecords: \r\n");
                        for (int i = 0; i < AddressInfoRecords.Length; i++)
                        {
                            msg.Append("AddressID - " + AddressInfoRecords[i].AddressID);
                            msg.Append(" :Address - " + AddressInfoRecords[i].Address);
                            msg.Append(" :Zipcode - " + AddressInfoRecords[i].Zipcode);
                            msg.Append(" :Type - " + AddressInfoRecords[i].Type);
                            msg.Append(" :DealType - " + AddressInfoRecords[i].DealType);
                            msg.Append("ExtendField - " + AddressInfoRecords[i].ExtendField + "\r\n");
                        }
                    }
                }
                msg.Append(";ExtendField - " + ExtendField + "\r\n");

                msg.Append("处理结果 - " + Result.Result);
                msg.Append("; 错误描述 - " + Result.ErrorDescription);
                msg.Append("; CustID - " + Result.CustID);
                msg.Append("; ExtendField - " + Result.ExtendField + "\r\n");
                msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

                BTUCenterInterfaceLog.CenterForBizTourLog("AddressInfoUploadQuery", msg);
                #endregion

                #region 数据库日志

                StringBuilder inParam = new StringBuilder();
                String outParam = String.Empty;

                inParam.Append("SPID:" + SPID);
                inParam.Append(",CustID:" + CustID);
                if (AddressInfoRecords != null && AddressInfoRecords.Length > 0)
                {
                    inParam.Append(",AddressInfo:");
                    foreach (AddressInfoRecord address in AddressInfoRecords)
                    {
                        inParam.Append("{");
                        inParam.AppendFormat("AddressID:{0},Address:{1},Zipcode:{2},Type:{3},DealType:{4},ExtendField:{5}",
                            address.AddressID, address.Address, address.Zipcode, address.Type, address.DealType, address.ExtendField);
                        inParam.Append("},");
                    }
                }
                inParam.Append(",ExtendField:" + ExtendField);

                CommonBizRules.WriteCallInterfaceLog_DB(HttpContext.Current.Request.UserHostAddress, SPID, "AddressInfoUpload", inParam.ToString(), outParam.ToString(), Result.Result, Result.ErrorDescription);
                #endregion

                //CommonBizRules.WriteDataLog(SPID, CustID, "", Result.Result, Result.ErrorDescription, "", "AddressInfoUploadQuery");
            }
            catch { }
        }
        return Result;
    }
コード例 #3
0
ファイル: UserInfoClass.cs プロジェクト: noikiy/lihongtu
        /// <summary>
        /// �û�ע��
        /// �޸ģ�����      ʱ�䣺2009-09-01
        /// </summary>
        /// <param name="RegistrationStyle"></param>
        /// <param name="ErrMsg"></param>
        /// <returns></returns>
        public int UserInfoRegistry(HttpContext SpecificContext, string RegistrationStyle, string SPID, out string ErrMsg)
        {
            //���phone��Ϊ��ʱ���ֻ�Ϊ��֤�ֻ������������Ϊһ��绰
            int Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            ErrMsg = "";

            string userName = CommonBizRules.GetValueFromXmlStr(ExtendField, "UserName");
            string Phone = CommonBizRules.GetValueFromXmlStr(ExtendField, "MobilePhone");

            string UserNameSPID = System.Configuration.ConfigurationManager.AppSettings["UserName_SPID"];

            int SIP = UserNameSPID.IndexOf(SPID);
            if (SIP < 0)
            {
                if (CommonUtility.IsEmpty(userName))
                {
                    Result = ErrorDefinition.BT_IError_Result_InValidParameter_Code;
                    ErrMsg = ErrorDefinition.BT_IError_Result_InValidParameter_Msg + "���û�������Ϊ��";
                    return Result;
                }
            }

            if(!CommonUtility.IsEmpty(userName))
            {
                //�ж��û����Ƿ����
                if (CustBasicInfo.IsExistUser(userName) != 0)
                {
                    Result = ErrorDefinition.BT_IError_Result_InValidParameter_Code;
                    ErrMsg = "�û����Ѿ�����";
                    return Result;
                }

            }

            bool tmp = false;
            if (!CommonUtility.IsEmpty(Phone))
            {
                string phone1 = "";
                if (!CommonBizRules.PhoneNumValid(SpecificContext,Phone,out phone1))
                {
                    Result = ErrorDefinition.BT_IError_Result_InValidPhoneNum_Code;
                    ErrMsg = "�󶨵绰��Ч";
                    return Result;
                }
                Phone = phone1;

                BasicInfoV2Record[] asicInfoV2Records = PhoneBO.GetQueryByPhone(SPID, Phone, out Result, out ErrMsg);
                if(asicInfoV2Records != null)
                {
                    if(asicInfoV2Records.Length > 0)
                    {
                        foreach (BasicInfoV2Record basicinfo in asicInfoV2Records)
                        {
                            if(basicinfo.PhoneClass != "1")
                            {
                                tmp = true;
                                break;
                            }

                        }
                    }
                }

                if(tmp)
                {
                    Result = -30005;
                    ErrMsg = "���ֻ������Ѿ��������ͻ���";
                    return Result;
                }

            }

            //�ư��ֻ�ע��
            //Phone  ��Ϊ��֤�绰
            //if(RegistrationStyle == "05")
            //{

            //}

            if (RegistrationStyle == "05")
            {
                if (CommonUtility.IsEmpty(Phone))
                {
                    Result = ErrorDefinition.BT_IError_Result_InValidPhoneNum_Code;
                    ErrMsg = "�ֻ��Ų���Ϊ��";
                    return Result;

                }

                Result = PhoneBO.PhoneSel("", Phone, out ErrMsg);
                if(Result != 0)
                {
                    ErrMsg = "���ֻ������Ѿ��������û���";
                    return Result;
                }

            }

            if (RegistrationStyle == "06")
            {
                if (CommonUtility.IsEmpty(userName))
                {
                    Result = ErrorDefinition.BT_IError_Result_InValidRealName_Code;
                    ErrMsg = "�û�������Ϊ��";
                    return Result;

                }
            }

            if(userAccount != "")
            {
                if(userAccount.Length != 9 && userAccount.Length != 16)
                {
                    result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                    ErrMsg = "���ÿ����Ȳ���ȷ";
                    return Result;
                }
            }

            SqlConnection myCon = null;
            SqlCommand cmd = new SqlCommand();
            try
            {
                myCon = new SqlConnection(DBUtility.BestToneCenterConStr);
                cmd.Connection = myCon;
                cmd.CommandType = CommandType.StoredProcedure;
                //if (RegistrationStyle == "05" || RegistrationStyle == "06")
                //    cmd.CommandText = "up_BT_V2_Interface_PersonalUserNameUserRegistry";
                //else
                //    cmd.CommandText = "up_BT_V2_Interface_InsertUserCommonInfo";
                cmd.CommandText = "up_Customer_OV3_Interface_UserInfoRegistry";

                //SqlParameter parRegistrationStyle = new SqlParameter("@RegistrationStyle", SqlDbType.VarChar, 2);
                //parRegistrationStyle.Value = RegistrationStyle;
                //cmd.Parameters.Add(cmd);

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

                SqlParameter parUserType = new SqlParameter("@UserType", SqlDbType.VarChar, 2);
                parUserType.Value = userType;
                cmd.Parameters.Add(parUserType);

                SqlParameter parUserAccount = new SqlParameter("@UserAccount", SqlDbType.VarChar, 16);
                parUserAccount.Value = CommonUtility.IsEmpty(userAccount) ? "" : userAccount;
                cmd.Parameters.Add(parUserAccount);

                SqlParameter parPassword = new SqlParameter("@Password", SqlDbType.VarChar, 6);
                parPassword.Value = CommonUtility.IsEmpty(password) ? "" : password;
                cmd.Parameters.Add(parPassword);

                SqlParameter parEncryptPassword = new SqlParameter("@EncryptPassword", SqlDbType.VarChar, 50);
                parEncryptPassword.Value = CryptographyUtil.Encrypt(password);
                cmd.Parameters.Add(parEncryptPassword);

                SqlParameter parCustID = new SqlParameter("@CustID", SqlDbType.VarChar, 16);
                parCustID.Value = CommonUtility.IsEmpty(CustID) ? "" : CustID;
                cmd.Parameters.Add(parCustID);

                SqlParameter parUProvinceID = new SqlParameter("@UProvinceID", SqlDbType.VarChar, 2);
                parUProvinceID.Value = uProvinceID;
                cmd.Parameters.Add(parUProvinceID);

                SqlParameter parAreaCode = new SqlParameter("@AreaCode", SqlDbType.VarChar, 6);
                parAreaCode.Value = areaCode;
                cmd.Parameters.Add(parAreaCode);

                SqlParameter parStatus = new SqlParameter("@Status", SqlDbType.VarChar, 2);
                parStatus.Value = status;
                cmd.Parameters.Add(parStatus);

                SqlParameter parRealName = new SqlParameter("@RealName", SqlDbType.VarChar, 30);
                parRealName.Value = realName;
                cmd.Parameters.Add(parRealName);

                SqlParameter parCertificateCode = new SqlParameter("@CertificateCode", SqlDbType.VarChar, 30);
                parCertificateCode.Value = CommonUtility.IsEmpty(certificateCode) ? "" : certificateCode;
                cmd.Parameters.Add(parCertificateCode);

                SqlParameter parCertificateType = new SqlParameter("@CertificateType", SqlDbType.VarChar,2);
                parCertificateType.Value = CommonUtility.IsEmpty(CertificateType) ? "" : CertificateType;
                cmd.Parameters.Add(parCertificateType);

                SqlParameter parBirthday = new SqlParameter("@Birthday", SqlDbType.VarChar, 19);
                parBirthday.Value = CommonUtility.IsEmpty(Birthday) ? "" : Birthday;
                cmd.Parameters.Add(parBirthday);

                SqlParameter parSex = new SqlParameter("@Sex", SqlDbType.VarChar, 1);
                parSex.Value = CommonUtility.IsEmpty(Sex) ? "" : Sex;
                cmd.Parameters.Add(parSex);

                SqlParameter parCustLevel = new SqlParameter("@CustLevel", SqlDbType.VarChar, 1);
                parCustLevel.Value = CommonUtility.IsEmpty(CustLevel) ? "" : CustLevel;
                cmd.Parameters.Add(parCustLevel);

                SqlParameter parEduLevel = new SqlParameter("@EduLevel", SqlDbType.VarChar, 2);
                parEduLevel.Value = CommonUtility.IsEmpty(EduLevel) ? "" : EduLevel;
                cmd.Parameters.Add(parEduLevel);

                if(CommonUtility.IsEmpty(favorite))
                {
                    SqlParameter parFavorite = new SqlParameter("@Favorite", SqlDbType.VarChar, 256);
                    parFavorite.Value = DBNull.Value;
                    cmd.Parameters.Add(parFavorite);
                }
                else
                {
                    SqlParameter parFavorite = new SqlParameter("@Favorite", SqlDbType.VarChar, 256);
                    parFavorite.Value = favorite;
                    cmd.Parameters.Add(parFavorite);
                }

                SqlParameter parIncomeLevel = new SqlParameter("@IncomeLevel", SqlDbType.VarChar, 2);
                parIncomeLevel.Value = CommonUtility.IsEmpty(IncomeLevel) ? "" : IncomeLevel;
                cmd.Parameters.Add(parIncomeLevel);

                SqlParameter parEmail = new SqlParameter("@Email", SqlDbType.VarChar, 100);
                parEmail.Value = CommonUtility.IsEmpty(Email) ? "" : Email;
                cmd.Parameters.Add(parEmail);

                //SqlParameter parPaymentAccountType = new SqlParameter("@PaymentAccountType", SqlDbType.VarChar, 2);
                //parPaymentAccountType.Value = CommonUtility.IsEmpty(PaymentAccountType) ? "" : PaymentAccountType;
                //cmd.Parameters.Add(parPaymentAccountType);

                ////ϵͳ���죬ԭPaymentAccount�ֶκ�������� ��PaymentAccount���������û���
                //SqlParameter parPaymentAccount = new SqlParameter("@PaymentAccount", SqlDbType.VarChar, 50);
                //parPaymentAccount.Value = CommonUtility.IsEmpty(Phone) ? "" : Phone;
                //cmd.Parameters.Add(parPaymentAccount);

                ////ϵͳ���죬ԭEnterPriseID�ֶκ�������� ��EnterPriseID���������ֻ���
                //SqlParameter parEnterPriseID = new SqlParameter("@EnterPriseID", SqlDbType.VarChar, 30);
                //parEnterPriseID.Value = CommonUtility.IsEmpty(userName) ? "" : userName;
                //cmd.Parameters.Add(parEnterPriseID);

                //SqlParameter parPaymentAccountPassword = new SqlParameter("@PaymentAccountPassword", SqlDbType.VarChar, 50);
                //parPaymentAccountPassword.Value = CryptographyUtil.Encrypt(paymentAccountPassword);
                //cmd.Parameters.Add(parPaymentAccountPassword);

                //SqlParameter parContactTel = new SqlParameter("@CustContactTel", SqlDbType.VarChar, 20);
                //parContactTel.Value = CommonUtility.IsEmpty(custContactTel) ? "" : custContactTel;
                //cmd.Parameters.Add(parContactTel);

                SqlParameter parRegistrationSource = new SqlParameter("@RegistrationSource", SqlDbType.VarChar, 2);
                parRegistrationSource.Value = RegistrationStyle;
                cmd.Parameters.Add(parRegistrationSource);

                SqlParameter parUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 30);
                parUserName.Value = CommonUtility.IsEmpty(userName) ? "" : userName;
                cmd.Parameters.Add(parUserName);

                //SqlParameter parIsPost = new SqlParameter("@IsPost", SqlDbType.VarChar, 2);
                //parIsPost.Value = CommonUtility.IsEmpty(isPost) ? "" : isPost;
                //cmd.Parameters.Add(parIsPost);

                //SqlParameter parBoundPhoneRecords = new SqlParameter("@BoundPhoneRecords ", SqlDbType.Text);
                //string xmlBoundPhoneRecords = this.GenerateXmlForBoundPhoneRecords();

                //if (xmlBoundPhoneRecords == "")
                //    parBoundPhoneRecords.Value = DBNull.Value;
                //else
                //    parBoundPhoneRecords.Value = xmlBoundPhoneRecords;

                //cmd.Parameters.Add(parBoundPhoneRecords);

                //SqlParameter parAddressRecords = new SqlParameter("@AddressRecords", SqlDbType.Text);

                //string xmlAddressRecords = this.GenerateXmlForAddressRecords();
                //if (xmlAddressRecords == "")
                //    parAddressRecords.Value = DBNull.Value;
                //else
                //    parAddressRecords.Value = xmlAddressRecords;
                //cmd.Parameters.Add(parAddressRecords);

                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 parOCustID = new SqlParameter("@oCustID ", SqlDbType.VarChar, 16);
                parOCustID.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parOCustID);

                SqlParameter parOUserAccount = new SqlParameter("@oUserAccount ", SqlDbType.VarChar, 16);
                parOUserAccount.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parOUserAccount);

                DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

                Result = int.Parse(parResult.Value.ToString());
                ErrMsg = parErrMsg.Value.ToString();
                custID = parOCustID.Value.ToString();
                userAccount = parOUserAccount.Value.ToString();

                if(Result != 0)
                {
                    return Result;
                }

                bool temp = false;

                //�󶨵绰��һ��绰��
                if (boundPhoneRecords != null)
                {
                    if (boundPhoneRecords.Length > 0)
                    {
                        for (int i = 0; i < boundPhoneRecords.Length; i++)
                        {
                            Result = PhoneBO.PhoneSet(SPID, custID, boundPhoneRecords[i].Phone, "1", "2", out ErrMsg);

                            if(boundPhoneRecords[i].Phone.ToString().Equals(CustContactTel))
                            {
                                temp = true;
                            }
                        }
                    }
                }

                //���CustContactTel��boundPhoneRecords��ͬ������󶨵绰��(һ��绰)
                if(!CommonUtility.IsEmpty(CustContactTel))
                {
                    if (!temp)
                    {
                        Result = PhoneBO.PhoneSet(SPID, custID, CustContactTel, "1", "2", out ErrMsg);
                    }
                }

                //���Phone��Ϊ�գ��󶨵绰����֤�绰��
                if (!CommonUtility.IsEmpty(Phone))
                {
                    Result = PhoneBO.PhoneSet(SPID, custID, Phone, "2", "2", out ErrMsg);
                }
                int Address_Result;
                string Address_ErrMsg = "";
                //�ͻ���ַ����
                if(addressRecords != null)
                {
                    if(addressRecords.Length > 0)
                    {
                        AddressInfoRecord[] AddressInfoRecords = new AddressInfoRecord[addressRecords.Length];
                        for (int i = 0; i < addressRecords.Length; i++)
                        {
                            AddressInfoRecords[i] = new AddressInfoRecord();
                            AddressInfoRecords[i].Address = addressRecords[i].Address;
                            AddressInfoRecords[i].Zipcode = addressRecords[i].Zipcode;
                            AddressInfoRecords[i].Type = addressRecords[i].Type;
                            AddressInfoRecords[i].DealType = "0";
                        }

                        Address_Result =AddressInfoBO.UploadAddressInfo(SPID, AddressInfoRecords, custID, out Address_ErrMsg);

                    }
                }

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

            return Result;
        }
コード例 #4
0
ファイル: test.aspx.cs プロジェクト: noikiy/lihongtu
    protected void Button2_Click(object sender, EventArgs e)
    {
        //testCRMUserAuthResult resultObj = new testCRMUserAuthResult();
        //testSoap obj = new testSoap();
        //obj.Url = "http://bksvc-test.besttone.com.cn/yuan/services/CRMForBTUCenterSoap12";

        //resultObj = obj.CRMUserAuth("3501", "1", "1", "1", "1", "1", "1");

        //string ErrMsg = resultObj.ErrorDescription;
        //int Result = resultObj.Result;
        int a = 0;

        AddressInfoRecord[] addressInfoRecords = new AddressInfoRecord[4];
        addressInfoRecords[0] = new AddressInfoRecord();
        addressInfoRecords[0].Address = "aaaaaa";
        addressInfoRecords[0].Type = "01";
        addressInfoRecords[0].Zipcode = "210031";
        addressInfoRecords[0].ExtendField = "";
        addressInfoRecords[0].DealType = "0";

        addressInfoRecords[1] = new AddressInfoRecord();
        addressInfoRecords[1].Address = "bbbbb";
        addressInfoRecords[1].Type = "01";
        addressInfoRecords[1].Zipcode = "210031";
        addressInfoRecords[1].ExtendField = "";
        addressInfoRecords[1].DealType = "0";

        addressInfoRecords[2] = new AddressInfoRecord();
        addressInfoRecords[2].Address = "cccccc";
        addressInfoRecords[2].Type = "01";
        addressInfoRecords[2].Zipcode = "210031";
        addressInfoRecords[2].ExtendField = "";
        addressInfoRecords[2].DealType = "0";

        addressInfoRecords[3] = new AddressInfoRecord();
        addressInfoRecords[3].Address = "ddddd";
        addressInfoRecords[3].Type = "01";
        addressInfoRecords[3].Zipcode = "210031";
        addressInfoRecords[3].ExtendField = "";
        addressInfoRecords[3].DealType = "0";

        CIPInterfaceForBizSystem face = new CIPInterfaceForBizSystem();
        //face.QueryByPhone("11211111", "15050686791", "");
        face.CustBasicInfoQuery("01010101", "417345346", "");
        //face.CustExtendInfoQuery("11211111", "8600010191502000", "");
        //face.CustProvinceRelationQuery("11211111", "02", "02", "");
        //face.AddressInfoQuery("11211111", "8600010191502000", "");
        //face.FrequentUserUploadQuery("12111111", "8600010191502000",addressInfoRecords, "");
        //face.FrequentUserQuery("12111111", "8600010191502000", "");
        //face.UserRegistryV2("12112222", "41", "", "111111", "20", "130183", "hello", "13029999900", "1419991600", "0", "", "", "1", "");
        //face.SetPwd("12112222", "8600010191502000", "111a11", "1", "");
        //face.SetPwd("12112222", "8600010191502000", "sdfgreert", "2", "");
        face.AddressInfoUpload("11111111", "10051", addressInfoRecords, "");
        AddressRecord[] addresses = new AddressRecord[2];
        addresses[0] = new AddressRecord();
        addresses[0].Address = "上海南汇";
        addresses[0].Type = "02";
        addresses[0].Zipcode = "210031";

        addresses[1] = new AddressRecord();
        addresses[1].Address = "江苏南京";
        addresses[1].Type = "02";
        addresses[1].Zipcode = "210032";

        BoundPhoneRecord[] boundPhoneRecords = new BoundPhoneRecord[1];
        boundPhoneRecords[0] = new BoundPhoneRecord();
        boundPhoneRecords[0].Phone = "15813999999";

        UserInfo userInfo = new UserInfo();
        userInfo.UserType = "20";
        userInfo.UserAccount = "";
        userInfo.Password = "******"; ;
        userInfo.CustID = "";
        userInfo.UProvinceID = "20";
        userInfo.AreaCode = "020";
        userInfo.Status = "00";
        userInfo.RealName = "xiaotong";
        userInfo.CertificateType = "";
        userInfo.CertificateCode = "";
        userInfo.Birthday = "1999-09-29";
        userInfo.Sex = "1";
        userInfo.CustLevel = "4";
        userInfo.EduLevel = "5";
        userInfo.Favorite = "";
        userInfo.IncomeLevel = "3";
        userInfo.Email = "*****@*****.**";
        userInfo.CustContactTel = "15813999999";
        userInfo.AddressRecords = addresses;
        userInfo.BoundPhoneRecords = boundPhoneRecords;
        userInfo.ExtendField = "<?xml version='1.0' encoding='gb2312' standalone='yes'?><Root><UserName>xaotong</UserName><MobilePhone>15888866644</MobilePhone></Root>";

        BestToneUCenterForBizTour best = new BestToneUCenterForBizTour();
           // best.UserInfoQuery("20", "12342343", "203100004", "", "", DateTime.Now.ToString());
        //best.UserRegistry("20", "35000001", "05", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), userInfo);
    }
コード例 #5
0
ファイル: AddressInfoBO.cs プロジェクト: noikiy/lihongtu
        /// <summary>
        /// �ͻ���ַ��Ϣ�ϴ��ӿڷ��ؼ�¼
        /// ���ߣ�����      ʱ�䣺2009-08-04
        /// �޸ģ�          ʱ�䣺
        /// </summary>
        public static int UploadAddressInfo(string SPID, AddressInfoRecord[] AddressInfoRecords, string CustID, out string ErrMsg)
        {
            int Result = ErrorDefinition.IError_Result_UnknowError_Code;
            ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

            SqlConnection myCon = new SqlConnection(DBUtility.BestToneCenterConStr);
            SqlTransaction myTrans = null;
            //�޸� ������20091110

            try
            {
                myCon.Open();
                myTrans = myCon.BeginTransaction();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = myTrans.Connection;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_Customer_V3_Interface_AddressInfoUploadQuery";
                cmd.Transaction = myTrans;

                for (int i = 0; i < AddressInfoRecords.Length; i++)
                {

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

                    SqlParameter parCustID = new SqlParameter("@CustID", SqlDbType.VarChar, 16);
                    parCustID.Value = CustID;
                    cmd.Parameters.Add(parCustID);

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

                    SqlParameter parAddressID = new SqlParameter("@AddressID", SqlDbType.BigInt, 8);
                    parAddressID.Value = AddressInfoRecords[i].AddressID;
                    cmd.Parameters.Add(parAddressID);

                    SqlParameter parAreaCode = new SqlParameter("@AreaCode", SqlDbType.VarChar, 6);
                    parAreaCode.Value = AddressInfoRecords[i].AreaCode == null ? "" : AddressInfoRecords[i].AreaCode;
                    cmd.Parameters.Add(parAreaCode);

                    SqlParameter parAddress = new SqlParameter("@Address", SqlDbType.VarChar, 256);
                    parAddress.Value = AddressInfoRecords[i].Address == null ? "" : AddressInfoRecords[i].Address;
                    cmd.Parameters.Add(parAddress);

                    SqlParameter parZipcode = new SqlParameter("@Zipcode", SqlDbType.VarChar, 6);
                    parZipcode.Value = AddressInfoRecords[i].Zipcode == null ? "" : AddressInfoRecords[i].Zipcode;
                    cmd.Parameters.Add(parZipcode);

                    SqlParameter parType = new SqlParameter("@Type", SqlDbType.VarChar, 20);
                    parType.Value = AddressInfoRecords[i].Type == null ? "" : AddressInfoRecords[i].Type;
                    cmd.Parameters.Add(parType);

                    SqlParameter parOtherType = new SqlParameter("@OtherType", SqlDbType.VarChar, 50);
                    parOtherType.Value = AddressInfoRecords[i].OtherType == null ? "" : AddressInfoRecords[i].OtherType;
                    cmd.Parameters.Add(parOtherType);

                    SqlParameter parRelationPerson = new SqlParameter("@RelationPerson", SqlDbType.VarChar, 20);
                    parRelationPerson.Value = AddressInfoRecords[i].RelationPerson == null ? "" : AddressInfoRecords[i].RelationPerson;
                    cmd.Parameters.Add(parRelationPerson);

                    SqlParameter parMobile = new SqlParameter("@Mobile", SqlDbType.VarChar, 20);
                    parMobile.Value = AddressInfoRecords[i].Mobile == null ? "" : AddressInfoRecords[i].Mobile;
                    cmd.Parameters.Add(parMobile);

                    SqlParameter parFixedPhone = new SqlParameter("@FixedPhone", SqlDbType.VarChar, 20);
                    parFixedPhone.Value = AddressInfoRecords[i].FixedPhone == null ? "" : AddressInfoRecords[i].FixedPhone;
                    cmd.Parameters.Add(parFixedPhone);

                    SqlParameter parDealType = new SqlParameter("@DealType", SqlDbType.VarChar, 1);
                    parDealType.Value = AddressInfoRecords[i].DealType == null ? "" : AddressInfoRecords[i].DealType;
                    cmd.Parameters.Add(parDealType);

            //                    SqlParameter parExtendField = new SqlParameter("@ExtendField", SqlDbType.VarChar, 256);
            //                    parExtendField.Value = AddressInfoRecords[i].ExtendField == null ? "" : AddressInfoRecords[i].ExtendField;
            //                    cmd.Parameters.Add(parExtendField);

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

                    cmd.ExecuteNonQuery();

                    Result = int.Parse(parResult.Value.ToString().Trim());
                    ErrMsg = parErrMsg.Value.ToString().Trim();

                    if (Result != 0)
                    {
                        myTrans.Rollback();
                        return Result;
                    }
                    cmd.Parameters.Clear();

                }
                myTrans.Commit();
            }
            catch (Exception e)
            {
                if (myTrans != null)
                {
                    myTrans.Rollback();
                }
                Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
                ErrMsg = ErrorDefinition.BT_IError_Result_System_UnknowError_Msg + e.Message;
            }
            finally //�޸� ������ 20091110
            {
                if (myCon.State != ConnectionState.Closed)
                {
                    myCon.Close();
                }
            }

            return Result;
        }
コード例 #6
0
ファイル: AddressInfoBO.cs プロジェクト: noikiy/lihongtu
        /// <summary>
        /// �ͻ���ַ��Ϣ��ѯ�ӿڷ��ؼ�¼
        /// ���ߣ�����      ʱ�䣺2009-08-03
        /// �޸ģ�          ʱ�䣺
        /// </summary>
        public static AddressInfoRecord[] GetAddressInfo(string SPID, string CustID, out int Result, out string ErrMsg)
        {
            AddressInfoRecord[] AddressInfoRecords = null;
            Result = ErrorDefinition.IError_Result_UnknowError_Code;
            ErrMsg = "";
            SqlConnection myCon = new SqlConnection(DBUtility.BestToneCenterConStr);

            try
            {
                SqlCommand cmd = new SqlCommand();
                DataSet ds = null;
                cmd.Connection = myCon;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_Customer_V3_Interface_AddressInfoQuery";

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

                SqlParameter parCustID = new SqlParameter("@CustID", SqlDbType.VarChar, 16);
                parCustID.Value = CustID;
                cmd.Parameters.Add(parCustID);

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

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

                ds = DBUtility.FillData(cmd, DBUtility.BestToneCenterConStr);
                if (ds != null)
                {
                    if (ds.Tables.Count != 0)
                    {
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            int RowCount = ds.Tables[0].Rows.Count;
                            AddressInfoRecords = new AddressInfoRecord[RowCount];
                            AddressInfoRecord addressInfoRecord = new AddressInfoRecord();
                            for (int i = 0; i < RowCount; i++)
                            {
                                addressInfoRecord = new AddressInfoRecord();
                                addressInfoRecord.AddressID = long.Parse(ds.Tables[0].Rows[i]["SequenceID"].ToString().Trim());
                                addressInfoRecord.AreaCode = ds.Tables[0].Rows[i]["AreaCode"].ToString().Trim();
                                addressInfoRecord.Address = ds.Tables[0].Rows[i]["Address"].ToString().Trim();
                                addressInfoRecord.Zipcode = ds.Tables[0].Rows[i]["ZipCode"].ToString().Trim();
                                addressInfoRecord.Type = ds.Tables[0].Rows[i]["Type"].ToString().Trim();
                                addressInfoRecord.OtherType = ds.Tables[0].Rows[i]["OtherType"].ToString().Trim();
                                addressInfoRecord.RelationPerson = ds.Tables[0].Rows[i]["RelationPerson"].ToString().Trim();
                                addressInfoRecord.Mobile = ds.Tables[0].Rows[i]["Mobile"].ToString().Trim();
                                addressInfoRecord.FixedPhone = ds.Tables[0].Rows[i]["FixedPhone"].ToString().Trim();
                                addressInfoRecord.DealType = "3";
                                addressInfoRecord.ExtendField = "";
                                AddressInfoRecords[i] = addressInfoRecord;
                            }
                        }
                    }
                }
                Result = int.Parse(parResult.Value.ToString().Trim());
                ErrMsg = parErrMsg.Value.ToString().Trim();
            }
            catch (Exception e)
            {
                Result = ErrorDefinition.IError_Result_System_UnknowError_Code;
                ErrMsg = "��ȡ�ͻ���ַ��Ϣ�����" + e.Message;
            }
            return AddressInfoRecords;
        }