示例#1
0
        ////�û�������Ϣ������У�飨���ȣ��Ƿ�Ϊ�գ�
        //public static int UserSubInfoCheck(UserInfo UserBasicInfo)
        //{
        //    return 0;
        //}
        /// <summary>
        /// �ϲ��ʺ�
        /// </summary>
        /// <param name="ProvinceID"></param>
        /// <param name="SPID"></param>
        /// <param name="DeleteUserAccountRecords"></param>
        /// <param name="IncorporatedCustID"></param>
        /// <param name="IncorporatedUserAccount"></param>
        /// <param name="ErrMsg"></param>
        /// <returns></returns>
        public static int IncorporateUserAccount(string ProvinceID, string SPID,
            UserAccountRecord[] DeleteUserAccountRecords, string IncorporatedCustID, string IncorporatedUserAccount, out string ErrMsg)
        {
            int Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            ErrMsg = "";

            SqlConnection myCon = null;
            SqlCommand cmd = new SqlCommand();

            try
            {
                myCon = new SqlConnection(DBUtility.BestToneCenterConStr);
                cmd.Connection = myCon;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "dbo.up_BT_V2_Interface_IncorporateUserAccount";

                string DeleteUserAccountXML = GenerateXmlForDeleteUserAccountRecords(DeleteUserAccountRecords);

                SqlParameter parDeleteUserAccountXML = new SqlParameter("@DeleteUserAccountRecords", SqlDbType.Text);
                parDeleteUserAccountXML.Value = DeleteUserAccountXML;
                cmd.Parameters.Add(parDeleteUserAccountXML);

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

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

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

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

                DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

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

            }
            catch (Exception e)
            {
                Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
                ErrMsg = ErrorDefinition.BT_IError_Result_System_UnknowError_Msg + "," + e.Message;
            }

            return Result;
        }
    public IncorporateUserAccountResult IncorporateUserAccount(string ProvinceID, string SPID,
        UserAccountRecord[] DeleteUserAccountRecords, string IncorporatedCustID, string IncorporatedUserAccount)
    {
        IncorporateUserAccountResult Result = new IncorporateUserAccountResult();
        Result.CustID = IncorporatedCustID;
        Result.UserAccount = IncorporatedUserAccount;
        Result.ProvinceID = "35";
        Result.Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        Result.ErrorDescription = "";

        try
        {
            if (CommonUtility.IsEmpty(ProvinceID))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",不能为空";
                return Result;
            }

            if (ProvinceID.Length != ConstDefinition.Length_ProvinceID)
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",长度有误";
                return Result;
            }

            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;
            }

            if (CommonUtility.IsEmpty(IncorporatedCustID))
            {

                Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + ",不能为空";
                return Result;
            }

            if (CommonUtility.IsEmpty(IncorporatedUserAccount))
            {
                Result.Result = ErrorDefinition.BT_IError_Result_InValidUserAccount_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidUserAccount_Msg + ",不能为空";
                return Result;
            }

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

            for (int i = 0; i < DeleteUserAccountRecords.Length; i++)
            {
                if (CommonUtility.IsEmpty(DeleteUserAccountRecords[i].CustID))
                {

                    Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                    Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + ",第" + i.ToString() + "行CustID不能为空";
                    return Result;
                }

                if (CommonUtility.IsEmpty(DeleteUserAccountRecords[i].UserAccount))
                {

                    Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code;
                    Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + ",第" + i.ToString() + "行UserAccount不能为空";
                    return Result;
                }
            }

            Result.Result = BTBizRules.IncorporateUserAccount(ProvinceID, SPID,
                DeleteUserAccountRecords, IncorporatedCustID, IncorporatedUserAccount, 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 WriteLog
                StringBuilder msg = new StringBuilder();
                msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n");
                msg.Append("帐号合并接口 " + DateTime.Now.ToString("u") + "\r\n");
                msg.Append("ProvinceID - " + ProvinceID);
                msg.Append(";SPID - " + SPID);
                msg.Append(";IncorporatedCustID - " + IncorporatedCustID);
                msg.Append(";IncorporatedUserAccount - " + IncorporatedUserAccount);
                msg.Append(";DeleteUserAccountRecords: \r\n");
                if (DeleteUserAccountRecords != null)
                {
                    for (int i = 0; i < DeleteUserAccountRecords.Length; i++)
                    {
                        msg.Append(";CustID - " + DeleteUserAccountRecords[i].CustID);
                        msg.Append(";UserAccount - " + DeleteUserAccountRecords[i].UserAccount);
                    }
                    msg.Append("\r\n");
                }

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

                msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

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

                CommonBizRules.WriteDataLog(SPID, IncorporatedCustID, IncorporatedUserAccount, Result.Result,
                    Result.ErrorDescription, "", "IncorporateUserAccount");
            }
            catch { }
        }
        return Result;
    }
示例#3
0
        /// <summary> ��ȡ��ɾ���ʺż�¼��xml�ַ���
        /// ��ȡ��ɾ���ʺż�¼��xml�ַ���
        /// </summary>
        /// <param name="DeleteUserAccountRecords"></param>
        /// <returns></returns>
        public static string GenerateXmlForDeleteUserAccountRecords(UserAccountRecord[] DeleteUserAccountRecords)
        {
            string Result = "";

            XmlDocument xmldoc;
            XmlNode xmlnode;
            XmlElement xmlelem;
            XmlElement xmlelem2;
            XmlElement xmlelem3;
            XmlText xmltext;
            try
            {
                xmldoc = new XmlDocument();
                //����XML����������
                xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
                xmldoc.AppendChild(xmlnode);
                //����һ����Ԫ��
                xmlelem = xmldoc.CreateElement("", "ROOT", "");
                xmldoc.AppendChild(xmlelem);

                for (int i = 0; i < DeleteUserAccountRecords.Length; i++)
                {
                    //��������һ��Ԫ��
                    xmlelem2 = xmldoc.CreateElement("DeleteUserAccountRecord");
                    xmlelem2 = xmldoc.CreateElement("", "DeleteUserAccountRecord", "");

                    xmlelem3 = xmldoc.CreateElement("", "CustID", "");
                    xmltext = xmldoc.CreateTextNode(DeleteUserAccountRecords[i].CustID.ToString());
                    xmlelem3.AppendChild(xmltext);
                    xmlelem2.AppendChild(xmlelem3);

                    xmlelem3 = xmldoc.CreateElement("", "UserAccount", "");
                    xmltext = xmldoc.CreateTextNode(DeleteUserAccountRecords[i].UserAccount.ToString());
                    xmlelem3.AppendChild(xmltext);
                    xmlelem2.AppendChild(xmlelem3);

                    xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);
                }
                //���洴���õ�XML�ĵ�

                // xmldoc.Save(@".\DeleteUserAccountRecord.xml");
                Result = xmldoc.OuterXml;

            }
            catch
            { }

            return Result;
        }