Ejemplo n.º 1
0
        public static string GetSysPublicKeyN()
        {
            XmlDocument xmldoc = new XmlDocument();

            //  xmldoc.Load("XMLFile8_Response");
            xmldoc.Load(GetPublicKey.GetSysPathRespose("XMLFile8_Response.xml"));

            try
            {
                XmlNode root = xmldoc.SelectSingleNode("//KEYN[last()]");
                String  temp = Convert.ToString(root);
                if (!string.IsNullOrEmpty(temp))
                {
                    return(xmldoc.SelectSingleNode("//KEYN[last()]").InnerText);
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ef)
            {
                return("");
            }
        }
Ejemplo n.º 2
0
        public static string GetSysPublicKey()
        {
            GetPublicKey.GetSysPublicKey();

            //  XmlElement theBook = null, theElem = null, root = null;
            XmlDocument xmldoc = new XmlDocument();

            //   xmldoc.Load("XMLFile8_Response");

            xmldoc.Load(GetPublicKey.GetSysPathRespose("XMLFile8_Response.xml"));
            //  xmldoc.Load(GetPublicKey.GetSysPath(XMLFile12_Request));
            //   root = xmldoc.DocumentElement;

            try
            {
                XmlNode root = xmldoc.SelectSingleNode("//KEYE[last()]");
                String  temp = Convert.ToString(root);
                if (!string.IsNullOrEmpty(temp))
                {
                    return(xmldoc.SelectSingleNode("//KEYE[last()]").InnerText);
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ef)
            {
                return("");
            }
        }
Ejemplo n.º 3
0
        public static string updateM(string phone)
        {
            string VipCardNo = "";

            PosExistMemberInfo posExi   = new PosExistMemberInfo();
            MemberVO           memberVO = new MemberVO();

            memberVO.phone = phone;
            string mebxml = posExi.getPosExistMemberInfo(memberVO);

            if (!string.IsNullOrEmpty(mebxml))
            {
                XmlDocument xmldocx = new XmlDocument();

                xmldocx.LoadXml(mebxml);
                VipCardNo = xmldocx.SelectSingleNode("//VipCardNo[last()]").InnerText.ToString();
            }


            //  VipCardNo = "1825822403504";
            Random ran     = new Random();
            int    RandKey = ran.Next(1, 35);
            //  System.Guid guid = new Guid();
            string guid = Guid.NewGuid().ToString().Remove(20);

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(GetPublicKey.GetSysPath("XMLFile8.xml"));
            string ClientCode = xmldoc.SelectSingleNode("//ClientCode[last()]").InnerText.ToString();

            XmlDocument xmldoc2 = new XmlDocument();

            xmldoc2.Load(GetPublicKey.GetSysPath("XMLFile12_Request.xml"));
            string UserCode   = xmldoc2.SelectSingleNode("//UserCode[last()]").InnerText.ToString();
            string workKey    = xmldoc2.SelectSingleNode("//WorkKey[last()]").InnerText.ToString();
            string VerifyInfo = xmldoc2.SelectSingleNode("//VerifyInfo[last()]").InnerText.ToString();


            XmlDocument xmldoc1 = new XmlDocument();

            xmldoc1.Load(GetPublicKey.GetSysPathRespose("XMLFile12_Response.xml"));
            string workGuid = xmldoc1.SelectSingleNode("//WorkGuid[last()]").InnerText.ToString();



//            <InputParameter>
//<RandomNo>随机数</RandomNo>
//<ClientCode>交易客户端编码</ClientCode>
//<UserCode>CRM系统用户编码</UserCode>
//<WorkGuid>工作Guid</WorkGuid>
//<VipCardNo>会员卡号</ VipCardNo>
//<UDP1>店铺类型标识</UDP1>
//<UDP2>秘镜思语门店名称</UDP2>
//<UDP3>秘镜思语注册时间</UDP3>
//</InputParameter>


            String body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><InputParameter><RandomNo>" + RandKey + "</RandomNo><ClientCode>" + ClientCode + "</ClientCode><UserCode>" + UserCode + "</UserCode><WorkGuid>" + workGuid + "</WorkGuid><OrgCode>86</OrgCode><VipCardNo>" + VipCardNo + "</VipCardNo><UDP1>店铺类型标识</UDP1><UDP2>店铺门店</UDP2><UDP3>" + DateTime.Now.ToShortTimeString() + "</UDP3></InputParameter>";



            String enBody = RSA_3DES.EncryStr3DES(workKey, body);

            String tag = enBody + VerifyInfo;

            tag = encryptMD5(tag).ToUpper();

            string psInputPara = "";

            psInputPara = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<Head>"
                          + "<ClientCode>" + ClientCode + "</ClientCode>"
                          + "<Tag>" + tag + "</Tag>"
                          + "</Head>"
                          + "<Body>"
                          + enBody
                          + "</Body>"
                          + "</InputParameter>";



            WebReferenceCC.TReturnInfo TReturnInfo = GetPublicKey.WebService(243, psInputPara);

            return(TReturnInfo.ReturnCode.ToString());
        }
Ejemplo n.º 4
0
        public void getPosMemberInfo(MemberVO memberVO)
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(GetPublicKey.GetSysPath("XMLFile8.xml"));
            string ClientCode = xmldoc.SelectSingleNode("//ClientCode[last()]").InnerText.ToString();

            XmlDocument xmldoc2 = new XmlDocument();

            xmldoc2.Load(GetPublicKey.GetSysPath("XMLFile12_Request.xml"));
            string UserCode   = xmldoc2.SelectSingleNode("//UserCode[last()]").InnerText.ToString();
            string workKey    = xmldoc2.SelectSingleNode("//WorkKey[last()]").InnerText.ToString();
            string VerifyInfo = xmldoc2.SelectSingleNode("//VerifyInfo[last()]").InnerText.ToString();


            XmlDocument xmldoc1 = new XmlDocument();

            xmldoc1.Load(GetPublicKey.GetSysPathRespose("XMLFile12_Response.xml"));
            string workGuid = xmldoc1.SelectSingleNode("//WorkGuid[last()]").InnerText.ToString();

            String psInputPara = "";


            String body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<CardNo>" + memberVO.posCardNo + "</CardNo>"
                          + "<CardNoType>1</CardNoType>"
                          + "<Password></Password>"
                          + "<CardFaceChk></CardFaceChk>"
                          + "<CardFaceNoVerifyValue></CardFaceNoVerifyValue>"
                          + "<OrgCode>7001</OrgCode>"
                          + "<AccType></AccType>"
                          + "<YwType>101COMM</YwType>"
                          + "<QryKind>0</QryKind>"
                          + "<WorkGuid>" + workGuid + "</WorkGuid>"
                          + "<CardFaceNo>" + memberVO.posCardNo + "</CardFaceNo>"
                          + "</InputParameter>";



            String enBody = RSA_3DES.EncryStr3DES(workKey, body);

            String tag = enBody + VerifyInfo;

            tag = RSA_3DES.encryptMD5(tag).ToUpper();



            psInputPara = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<Head>"
                          + "<Tag>" + tag + "</Tag>"
                          + "<ClientCode>" + ClientCode + "</ClientCode>"
                          + "</Head>"
                          + "<Body>"
                          + enBody
                          + "</Body>"
                          + "</InputParameter>";



            WebReferenceCC.TReturnInfo TReturnInfo = GetPublicKey.WebService(3, psInputPara);

            string decodedMsg = Base64.DecodeBase64(TReturnInfo.RtnMsg);



            if (TReturnInfo.ReturnCode == 0)
            {
                String resultXml = RSA_3DES.DecryStr3DES(workKey, TReturnInfo.OutputPara);
            }
        }
Ejemplo n.º 5
0
        public static int GetRegister(MemberVO memberVO)
        {
            Random ran     = new Random();
            int    RandKey = ran.Next(1000, 9999);

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(GetPublicKey.GetSysPath("XMLFile8.xml"));
            string ClientCode = xmldoc.SelectSingleNode("//ClientCode[last()]").InnerText.ToString();

            XmlDocument xmldoc2 = new XmlDocument();

            xmldoc2.Load(GetPublicKey.GetSysPath("XMLFile12_Request.xml"));
            string UserCode   = xmldoc2.SelectSingleNode("//UserCode[last()]").InnerText.ToString();
            string workKey    = xmldoc2.SelectSingleNode("//WorkKey[last()]").InnerText.ToString();
            string VerifyInfo = xmldoc2.SelectSingleNode("//VerifyInfo[last()]").InnerText.ToString();


            XmlDocument xmldoc1 = new XmlDocument();

            xmldoc1.Load(GetPublicKey.GetSysPathRespose("XMLFile12_Response.xml"));
            string workGuid = xmldoc1.SelectSingleNode("//WorkGuid[last()]").InnerText.ToString();


            String body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<Random>" + RandKey + "</Random>"
                          + "<ClientCode>" + ClientCode + "</ClientCode>"
                          + "<WorkGuid>" + workGuid + "</WorkGuid>"
                          + "<AppID></AppID>"
                          + "<CardTypeCode>501</CardTypeCode>"
                          + "<ExtCardNo></ExtCardNo>"
                          + "<YwType>4</YwType>"
                          + "<Mobile>" + memberVO.phone + "</Mobile>"
                          + "<Mailaddr></Mailaddr>"
                          + "<OrgCode>" + memberVO.OrgCode + "</OrgCode>"
                          + "<CertNo></CertNo>"
                          + "<Gender>1</Gender>"
                          + "<VipName>" + memberVO.memName + "</VipName>"
                          + "<OcUserCode>" + UserCode + "</OcUserCode>"
                          + "<OldBillNo>" + memberVO.idx + "</OldBillNo>"
                          + "<UserCode>" + UserCode + "</UserCode>"
                          + "<Birthday>" + memberVO.birthday + "</Birthday>"
                          + "</InputParameter>";


            String enBody = RSA_3DES.EncryStr3DES(workKey, body);

            String tag = enBody + VerifyInfo;

            tag = encryptMD5(tag).ToUpper();

            string psInputPara = "";

            psInputPara = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<Head>"
                          + "<Tag>" + tag + "</Tag>"
                          + "<ClientCode>" + ClientCode + "</ClientCode>"
                          + "</Head>"
                          + "<Body>"
                          + enBody
                          + "</Body>"
                          + "</InputParameter>";



            WebReferenceCC.TReturnInfo TReturnInfo = GetPublicKey.WebService(122, psInputPara);

            return(TReturnInfo.ReturnCode);

            //会员已存在 手机号重复
            //if (TReturnInfo.ReturnCode == 1221)
            //{
            //    PosExistMemberInfo posExistM = new PosExistMemberInfo();
            //     posExistM.getPosExistMemberInfo(memberVO);
            //}
        }
Ejemplo n.º 6
0
        public static string getPosPoint(MemberVO memberVO, PointVO pointVO)
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(GetPublicKey.GetSysPath("XMLFile8.xml"));
            string ClientCode = xmldoc.SelectSingleNode("//ClientCode[last()]").InnerText.ToString();

            XmlDocument xmldoc2 = new XmlDocument();

            xmldoc2.Load(GetPublicKey.GetSysPath("XMLFile12_Request.xml"));
            string UserCode   = xmldoc2.SelectSingleNode("//UserCode[last()]").InnerText.ToString();
            string workKey    = xmldoc2.SelectSingleNode("//WorkKey[last()]").InnerText.ToString();
            string VerifyInfo = xmldoc2.SelectSingleNode("//VerifyInfo[last()]").InnerText.ToString();


            XmlDocument xmldoc1 = new XmlDocument();

            xmldoc1.Load(GetPublicKey.GetSysPathRespose("XMLFile12_Response.xml"));
            string workGuid = xmldoc1.SelectSingleNode("//WorkGuid[last()]").InnerText.ToString();

            String psInputPara = "";

            //
            String body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<CardNoType>1</CardNoType>"
                          + "<CardNo>" + memberVO.posCardNo + "</CardNo>"
                          + "<Year>" + pointVO.yyyy + "</Year>"
                          + "<Month>" + pointVO.mm + "</Month>"
                          + "<WorkGuid>" + workGuid + "</WorkGuid>"
                          + "<BgnRowNum>" + pointVO.bgnRowNum + "</BgnRowNum>"
                          + "<EndRowNum>" + pointVO.endRowNum + "</EndRowNum>"
                          + "</InputParameter>";



            String enBody = RSA_3DES.EncryStr3DES(workKey, body);

            String tag = enBody + VerifyInfo;

            tag = RSA_3DES.encryptMD5(tag).ToUpper();



            psInputPara = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          + "<InputParameter>"
                          + "<Head>"
                          + "<Tag>" + tag + "</Tag>"
                          + "<ClientCode>" + ClientCode + "</ClientCode>"
                          + "</Head>"
                          + "<Body>"
                          + enBody
                          + "</Body>"
                          + "</InputParameter>";



            WebReferenceCC.TReturnInfo TReturnInfo = GetPublicKey.WebService(903, psInputPara);

            string decodedMsg = Base64.DecodeBase64(TReturnInfo.RtnMsg);



            if (TReturnInfo.ReturnCode == 0)
            {
                //String resultXml = DES3.decrypt(result.getOutputPara(), workKey).trim();
                jsonString = RSA_3DES.DecryStr3DES(workKey, TReturnInfo.OutputPara);
                return(jsonString);
            }


            else
            {
                return(jsonString);
            }
        }
Ejemplo n.º 7
0
        public static string GetSignIn()
        {
            XmlDocument xmldoc = new XmlDocument();
            //  xmldoc.Load("XMLFile12_Request");

            //   xmldoc.Load(GetPublicKey.GetSysPath("XMLFile12_Request.xml"));


            string d = System.Web.Hosting.HostingEnvironment.MapPath("~");

            //  string d = System.Web.HttpContext.Current.Server.MapPath("~");
            //   string subPath = d.Substring(0, d.Length - 4);

            string subPath = @"D:\WX_APIManage";

            string ff = subPath + "APIManage\\Requests\\Xml_Requests\\XMLFile12_Request.xml";

            xmldoc.Load(ff);

            string keyE = GetSysPublicKey();
            string keyN = GetSysPublicKeyN();
            //   string keyD = GetSysPublicKeyN();


            string rsaxmldoc = RSA(xmldoc.InnerXml, keyE, keyN);

            // string rsaxmldoc= EncryptUtils.RSAEncrypt(key, xmldoc.InnerXml);



            WebReferenceCC.TReturnInfo TReturnInfo = GetPublicKey.WebService(12, rsaxmldoc);


            XmlDocument xdocSave = new XmlDocument();

            //  xdocSave.InnerXml = EncryptUtils.DES3Decrypt(TReturnInfo.OutputPara, "1871890980664250");



            xdocSave.InnerXml = RSA_3DES.DecryStr3DES(xmldoc.SelectSingleNode("//WorkKey[last()]").InnerText, TReturnInfo.OutputPara);


            string f = subPath + "APIManage\\Responses\\Xml_Responses\\XMLFile12_Response.xml";

            xdocSave.Save(f);
            WorkGuid = xdocSave.InnerXml;

            //Session("name") = "MyName";
            //Application["CurrentGuests"] = 0;

            try
            {
                XmlNode root = xmldoc.SelectSingleNode("//KEYE[last()]");
                String  temp = Convert.ToString(root);
                if (!string.IsNullOrEmpty(temp))
                {
                    return(xmldoc.SelectSingleNode("//KEYE[last()]").InnerText);
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ef)
            {
                return("");
            }



            //    EncryptUtils.DES3Decrypt(TReturnInfo.OutputPara, GetSysPublicKey());
        }