示例#1
0
        /// <summary> ֪ͨ����ϵͳ�û���Ϣ
        /// ֪ͨ����ϵͳ�û���Ϣ
        /// </summary>
        /// <param name="CustID"></param>
        /// <param name="UserAccount"></param>
        /// <param name="ExtendField"></param>
        /// <param name="DealType"></param>
        /// <param name="RegistryType"> 1������ע��</param>
        public static void CustInfoNotify(string CustID, string UserAccount, string ExtendField, string DealType, string RegistryType, string PaymentPwd)
        {
            int Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            string ErrMsg = "";

            DataSet ds = null;
            SqlCommand cmd = new SqlCommand();

            StringBuilder msg = new StringBuilder();

            DateTime startTime =DateTime.Now;
            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_BT_V2_Interface_QueryCustInfo";

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

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

                ds = DBUtility.FillData(cmd, DBUtility.BestToneCenterConStr);

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

                        //��������һ��Ԫ��
                        xmlelem2 = xmldoc.CreateElement("BasicUserInfo");
                        xmlelem2 = xmldoc.CreateElement("", "BasicUserInfo", "");

                        xmlelem3 = xmldoc.CreateElement("", "birthday", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["Birthday"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "cardClass", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["CustLevel"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "certificateCode", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["CertificateCode"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "certificateType", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["CertificateType"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "credit", "");
                        xmltext = xmldoc.CreateTextNode("");
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "custContactTel", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["CustContactTel"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "custID", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["CustID"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "OuterCustID", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["outerID"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "custType", "");
                        string custType = "1";

                        //�ͻ����ͣ� 1�����˿ͻ���2������ͻ�
                        //�ж����ݣ� �����Ϊ 9λ�ҵ���λΪ0��1��2�� �򿨺�Ϊ 16λ �ҵ�
                        if (UserAccount.Length == 9)
                        {
                            string tmpAA = UserAccount.Substring(3, 1);
                            if (tmpAA == "1" || tmpAA == "0")
                            {
                                custType = "2";
                            }
                        }
                        xmltext = xmldoc.CreateTextNode(custType);
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "enterpriseID", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["EnterpriseID"].ToString());
                        xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "extendField", "");
                        xmltext = xmldoc.CreateTextNode("");
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "realName", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["RealName"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "registration", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["RegistrationDate"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "sex", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["Sex"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        //ͬ��������ϵͳʱ��status=02����ʶ����ע��
                        string status = ds.Tables[0].Rows[0]["status"].ToString();
                        if(RegistryType == "1")
                            status = "02";

                        xmlelem3 = xmldoc.CreateElement("", "status", "");
                        xmltext = xmldoc.CreateTextNode(status);
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "uProvinceID", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["UProvinceID"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "userAccount", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["UserAccount"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);

                        xmlelem3 = xmldoc.CreateElement("", "userType", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["UserType"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);
                        xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);

                        xmlelem3 = xmldoc.CreateElement("", "AuthenName", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["AuthenName"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);
                        xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);

                        xmlelem3 = xmldoc.CreateElement("", "AreaCode", "");
                        xmltext = xmldoc.CreateTextNode(ds.Tables[0].Rows[0]["AreaCode"].ToString());
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);
                        xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);

                        xmlelem3 = xmldoc.CreateElement("", "PaymentPwd", "");
                        xmltext = xmldoc.CreateTextNode(PaymentPwd);
                        xmlelem3.AppendChild(xmltext);
                        xmlelem2.AppendChild(xmlelem3);
                        xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);

                    //���洴���õ�XML�ĵ�

                   // xmldoc.Save(@".\BasicUserInfo.xml");
                        CustInfoXML = xmldoc.OuterXml;
                        CustInfoXML = CustInfoXML.Substring(CustInfoXML.IndexOf("<ROOT>"));
                        CustInfoXML = @"<?xml version='1.0' encoding='gb2312'?>" + CustInfoXML;

                    UnifyInterfaceForUCenter obj = new UnifyInterfaceForUCenter();
                //BaiscUserInfo CustInfoObj = new BaiscUserInfo();
                //CustInfoObj.birthday = ds.Tables[0].Rows[0]["Birthday"].ToString();
                //CustInfoObj.cardClass = ds.Tables[0].Rows[0]["CustLevel"].ToString();
                //CustInfoObj.certificateCode = ds.Tables[0].Rows[0]["CertificateCode"].ToString();
                //CustInfoObj.certificateType = ds.Tables[0].Rows[0]["CertificateType"].ToString();
                //CustInfoObj.credit = "";
                //CustInfoObj.custContactTel = ds.Tables[0].Rows[0]["CustContactTel"].ToString();
                //CustInfoObj.custId = ds.Tables[0].Rows[0]["CustID"].ToString();
                //CustInfoObj.custLevel = ds.Tables[0].Rows[0]["CustLevel"].ToString();
                //CustInfoObj.enterpriseId = ds.Tables[0].Rows[0]["EnterpriseID"].ToString();
                //CustInfoObj.extendField = "";
                //CustInfoObj.realName = ds.Tables[0].Rows[0]["RealName"].ToString();
                //CustInfoObj.registration = ds.Tables[0].Rows[0]["RegistrationDate"].ToString();
                //CustInfoObj.sex = ds.Tables[0].Rows[0]["Sex"].ToString();
                //CustInfoObj.status = ds.Tables[0].Rows[0]["Status"].ToString();
                //CustInfoObj.UProvinceID = ds.Tables[0].Rows[0]["UProvinceID"].ToString();
                //CustInfoObj.userAccount = ds.Tables[0].Rows[0]["UserAccount"].ToString();
                //CustInfoObj.userType = ds.Tables[0].Rows[0]["UserType"].ToString();
                //string sd = CustInfoObj.
                startTime = DateTime.Now;
                msg.Append("���ÿ�ʼ    " + startTime.ToString() + "." + startTime.Millisecond.ToString());
                msg.Append("    " + UserAccount);

                obj.Url = ConfigurationManager.AppSettings["UnifyInterUrl"];
                string strResult = obj.newCardCustomerInfoExport("35000000", CustInfoXML, DealType);

                XmlDocument xmlObj = new XmlDocument();
                xmlObj.LoadXml(strResult);
                Result = int.Parse(xmlObj.GetElementsByTagName("result")[0].InnerText);
                ErrMsg = xmlObj.GetElementsByTagName("errorDescription")[0].InnerText;

                DateTime endTime = DateTime.Now;
                long interval = endTime.Ticks - startTime.Ticks;
                string strInterval = interval.ToString();
                msg.Append("    ���ý���    " + endTime.ToString() + "." + endTime.Millisecond.ToString() + "    " + strInterval + "\r\n");

                //Result = ResultObj.Result;
                //ErrMsg = ResultObj.ErrorDescription;

            }
            catch (Exception ex)
            {
                ErrMsg = "1," + ex.Message;
                Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
                DateTime endTime = DateTime.Now;
                long interval = endTime.Ticks - startTime.Ticks;
                string strInterval = interval.ToString();
                msg.Append("    ���ý���    " + endTime.ToString() + "." + endTime.Millisecond.ToString() + "    " + strInterval + "\r\n");
            }
            finally
            {
                string IsWriteLog = ConfigurationManager.AppSettings["IsWriteLog"];
                if (IsWriteLog == "0")
                {
                    //���֪ͨʧ��������û���Ϣʧ�ܼ�¼��
                    // if (Result != 0)
                    //
                    cmd = new SqlCommand();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "up_BT_V2_Interface_InsertCustInfoNotifyFailRecord";

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

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

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

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

                    DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);
                    // }
                }

                BTUCenterInterfaceLog.CenterForBizTourLog("TmpNewCardCustomerInfoExport", msg);
            }
        }
        /// <summary>
        /// ͬ����ҵ��Ϣ������ϵͳ
        /// </summary>
        /// <param name="ProvinceID"></param>
        /// <param name="SPID"></param>
        /// <param name="CorporationID"></param>
        /// <param name="CustID"></param>
        /// <param name="UserAccount"></param>
        /// <param name="CorporationName"></param>
        /// <param name="CorporationType"></param>
        /// <param name="?"></param>
        public static void EnterpriseInfoNotify(string ProvinceID,string SPID,string CorporationID,string CustID,string UserAccount,
                                                  string CorporationName,string CorporationType,string ExtendField)
        {
            int Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
            string strResult="";
            string ErrMsg = "";
            try
            {
                #region XML
                //string CustInfoXML = "";
                //XmlDocument xmldoc;
                //XmlNode xmlnode;
                //XmlElement xmlelem;
                //XmlElement xmlelem2 = null;
                //XmlElement xmlelem3;
                //XmlText xmltext;
                //xmldoc = new XmlDocument();
                ////����XML����������
                //xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
                //xmldoc.AppendChild(xmlnode);
                ////����һ����Ԫ��
                //xmlelem = xmldoc.CreateElement("", "ROOT", "");
                //xmldoc.AppendChild(xmlelem);

                ////��������һ��Ԫ��
                //xmlelem2 = xmldoc.CreateElement("EnterpriseInfoUplodRequest");
                //xmlelem2 = xmldoc.CreateElement("", "EnterpriseInfoUplodRequest", "");

                //xmlelem3 = xmldoc.CreateElement("", "ProvinceID", "");
                //xmltext = xmldoc.CreateTextNode(ProvinceID);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "SPID", "");
                //xmltext = xmldoc.CreateTextNode(SPID);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "CorporationID", "");
                //xmltext = xmldoc.CreateTextNode(CorporationID);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "CustID", "");
                //xmltext = xmldoc.CreateTextNode(CustID);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "UserAccount", "");
                //xmltext = xmldoc.CreateTextNode(UserAccount);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "CorporationName", "");
                //xmltext = xmldoc.CreateTextNode(CorporationName);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "CorporationType", "");
                //xmltext = xmldoc.CreateTextNode(CorporationType);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmlelem3 = xmldoc.CreateElement("", "ExtendField", "");
                //xmltext = xmldoc.CreateTextNode(ExtendField);
                //xmltext.InnerText = CommonUtility.IsEmpty(xmltext.InnerText) ? "" : xmltext.InnerText;
                //xmlelem3.AppendChild(xmltext);
                //xmlelem2.AppendChild(xmlelem3);

                //xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);

                ////���洴���õ�XML�ĵ�

                //xmldoc.Save(@"C:\BasicUserInfo.xml");
                //CustInfoXML = xmldoc.OuterXml;
                //CustInfoXML = CustInfoXML.Substring(CustInfoXML.IndexOf("<ROOT>"));
                //CustInfoXML = @"<?xml version='1.0' encoding='gb2312'?>" + CustInfoXML;

                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                #endregion
                UnifyInterfaceForUCenter obj = new UnifyInterfaceForUCenter();
                obj.Url = ConfigurationManager.AppSettings["UnifyInterUrl"];
                strResult = obj.enterpriseInfoUplod(SPID, CorporationID, CustID, UserAccount, CorporationName, CorporationType);

                XmlDocument xmlObj = new XmlDocument();
                xmlObj.LoadXml(strResult);
                Result = int.Parse(xmlObj.GetElementsByTagName("result")[0].InnerText);
                ErrMsg = xmlObj.GetElementsByTagName("errorDescription")[0].InnerText;
            }
            catch (Exception ex)
            {
                ErrMsg = "1," + ex.Message;
                Result = ErrorDefinition.BT_IError_Result_System_UnknowError_Code;
            }
            finally
            {
                string IsWriteLog = ConfigurationManager.AppSettings["IsWriteLog"];
                if (IsWriteLog == "0")
                {
                    //���֪ͨʧ��������û���Ϣʧ�ܼ�¼��
                    // if (Result != 0)
                    //
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "up_BT_V2_Interface_InsertCustInfoNotifyFailRecord";

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

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

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

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

                    DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

                }
            }
        }