Esempio n. 1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            CPublic.AppPath = Server.MapPath(@"\");
            CPublic.LogPath = CPublic.AppPath + "Log\\";
            CPublic.AuthUpdate();
            //int nRet = CPublic.Init();
            //if (nRet != 0)
            //{
            //    CPublic.WriteLog("Web Service 初始化失败,nRet=" + nRet.ToString());
            //}
            int nRet = TPE_Class.TPE_GetNetState();

            if (nRet != 3)
            {
                TPE_Class.TPE_StartTPE();
            }
            for (int i = 0; i < 20; i++)
            {
                nRet = TPE_Class.TPE_GetNetState();
                if (nRet == 3)
                {
                    nRet = TPE_Class.TPE_GetLocalNode();
                    CPublic.LocalNode = nRet.ToString();
                    CPublic.WriteLog("TPE LocalNode " + nRet);
                    CPublic.WriteLog("TPE OK " + i);
                    break;
                }
                Thread.Sleep(1000);
            }
            CPublic.WriteLog("Application_Start");
        }
Esempio n. 2
0
 public TPE_ConfigIdentiRec(tagTPE_ConfigIdentiRec Cir)
 {
     IdentiNo  = Cir.IdentiNo;
     Code      = CPublic.ByteArrayToStr(Cir.Code);
     Name      = CPublic.ByteArrayToStr(Cir.Name);
     OverDraft = Cir.OverDraft;
 }
Esempio n. 3
0
 public TPE_GetAccountRes(tagTPE_GetAccountRes Res)
 {
     AccessControl   = CPublic.ByteArrayToStr(Res.AccessControl);
     AccountNo       = Res.AccountNo;
     Balance         = Res.Balance;
     Birthday        = CPublic.ConvertDateTime(Res.Birthday);
     CardNo          = Res.CardNo;
     CertCode        = CPublic.ByteArrayToStr(Res.CertCode);
     CertType        = Res.CertType;
     Comment         = CPublic.ByteArrayToStr(Res.Comment);
     Condition       = Res.Condition;
     CreateTime      = CPublic.ConvertDateTime(Res.CreateTime);
     CreditCardNo    = CPublic.ByteArrayToStr(Res.CreditCardNo);
     Depart          = Res.Depart;
     Email           = CPublic.ByteArrayToStr(Res.Email);
     ExpireDate      = CPublic.ConvertDateTime(Res.ExpireDate);
     Extend          = CPublic.ByteArrayToStr(Res.Extend);
     ExtendLen       = Res.ExtendLen;
     FileNameAudio   = CPublic.ByteArrayToStr(Res.FileNameAudio);
     FileNameFinger  = CPublic.ByteArrayToStr(Res.FileNameFinger);
     FileNamePicture = CPublic.ByteArrayToStr(Res.FileNamePicture);
     Identi          = Res.Identi;
     Name            = CPublic.ByteArrayToStr(Res.Name);
     Nation          = Res.Nation;
     Password        = CPublic.ByteArrayToStr(Res.Password);
     PersonID        = CPublic.ByteArrayToStr(Res.PersonID);
     PostalAddr      = CPublic.ByteArrayToStr(Res.PostalAddr);
     PostalCode      = CPublic.ByteArrayToStr(Res.PostalCode);
     RetValue        = Res.RetValue;
     Tel             = CPublic.ByteArrayToStr(Res.Tel);
     TransferLimit   = Res.TransferLimit;
     TransferMoney   = Res.TransferMoney;
     UpdateTime      = CPublic.ConvertDateTime(Res.UpdateTime);
 }
Esempio n. 4
0
 public TPE_GetAccountExRes(tagTPE_GetAccountExRes GAE)
 {
     RetValue = GAE.RetValue;
     DefINT1  = GAE.DefINT1;
     DefINT2  = GAE.DefINT2;
     DefINT3  = GAE.DefINT3;
     DefINT4  = GAE.DefINT4;
     DefVAR1  = CPublic.ByteArrayToStr(GAE.DefVAR1);
     DefVAR2  = CPublic.ByteArrayToStr(GAE.DefVAR2);
     DefVAR3  = CPublic.ByteArrayToStr(GAE.DefVAR3);
     DefVAR4  = CPublic.ByteArrayToStr(GAE.DefVAR4);
 }
Esempio n. 5
0
 public string MD5(string strPlain)
 {
     try
     {
         CMD5   md5        = new CMD5();
         byte[] plainArray = Encoding.UTF8.GetBytes(strPlain);
         byte[] mac        = md5.MAC(plainArray);
         return(Convert.ToBase64String(mac));
     }
     catch (Exception e)
     {
         CPublic.WriteLog("MD5 签名过程异常:" + e.Message);
         return(null);
     }
 }
Esempio n. 6
0
        public int TokenVaildCheck(string User, string param, string sha, string DoingLog)
        {
            // -1: 需更新令牌
            // 0: 验证正确
            // 1: 验证失败
            // 2: 令牌无效
            // 3: 信息错误

/*            CPublic.WriteLog ("提供的 SHA:" + sha.ToUpper () + ",计算的 SHA:" + SHA1 (param + "$" + TokenAuth).ToUpper () + ",内容:" + param + "$" + TokenAuth);
 *          if (!string.IsNullOrEmpty (oldTokenAuth)) {
 *              CPublic.WriteLog ("提供的 SHA:" + sha.ToUpper () + ",计算的 SHA:" + SHA1 (param + "$" + oldTokenAuth).ToUpper () + ",内容:" + param + "$" + oldTokenAuth);
 *              CPublic.WriteLog ("检测到存在旧密钥");
 *          } else { CPublic.WriteLog ("未检测到存在旧密钥"); }*/
            if (TokenUser == User)
            {
                if (Usable())
                {
                    if (sha.ToUpper().Equals(SHA1(param + "$" + TokenAuth).ToUpper()))
                    {
                        Update();
                        CPublic.WriteLog(TokenUser + ": " + DoingLog);
                        return(0);
                    }
                    else if (!string.IsNullOrEmpty(oldTokenAuth) && oldTokenLifetime > DateTime.Now)
                    {
                        if (sha.ToUpper().Equals(SHA1(param + "$" + oldTokenAuth).ToUpper()))
                        {
                            CPublic.WriteLog(TokenUser + ": " + DoingLog);
                            return(-1);
                        }
                        return(2);
                    }
                    return(1);
                }
                else if (Replaceable())
                {
                    if (sha.ToUpper().Equals(SHA1(param + "$" + TokenAuth).ToUpper()))
                    {
                        CPublic.WriteLog(TokenUser + ": " + DoingLog);
                        return(-1);
                    }
                    return(1);
                }
                return(2);
            }
            return(3);
        }
Esempio n. 7
0
 public string DesEncrypt(string strPlain, string strKey)
 {
     try
     {
         CDES   des         = new CDES();
         byte[] key         = Encoding.UTF8.GetBytes(strKey);
         byte[] plainArray  = Encoding.UTF8.GetBytes(strPlain);
         byte[] cipherArray = des.Encrypt(plainArray, 0, plainArray.Length, key);
         //return Encoding.UTF8.GetString(cipherArray);
         return(Convert.ToBase64String(cipherArray));
     }
     catch (Exception e)
     {
         CPublic.WriteLog("DES 加密过程异常:" + e.Message);
         return(null);
     }
 }
Esempio n. 8
0
 public string DesDecrypt(string strCipher, string strKey)
 {
     try
     {
         CDES   des         = new CDES();
         byte[] key         = Encoding.UTF8.GetBytes(strKey);
         byte[] cipherArray = Convert.FromBase64String(strCipher);
         //byte[] cipherArray = Encoding.UTF8.GetBytes(strCipher);
         byte[] plainArray = des.Decrypt(cipherArray, 0, cipherArray.Length, key);
         return(Encoding.UTF8.GetString(plainArray));
     }
     catch (Exception e)
     {
         CPublic.WriteLog("DES 解密过程异常:" + e.Message);
         return(null);
     }
 }
Esempio n. 9
0
 public TPE_CReturnObj(tagTPE_CReturnObj Cro)
 {
     TransType      = Cro.TransType;
     CenterNo       = Cro.CenterNo;
     OccurNode      = Cro.OccurNode;
     OccurIdNo      = Cro.OccurIdNo;
     OccurTime      = CPublic.ConvertDateTime(Cro.OccurTime);
     AccountNo      = Cro.AccountNo;
     CardNo         = Cro.CardNo;
     TransMoney     = Cro.TransMoney;
     Balance        = Cro.Balance;
     Condition      = Cro.Condition;
     TransferLimit  = Cro.TransferLimit;
     TransferMoney  = Cro.TransferMoney;
     JoinNode       = Cro.JoinNode;
     JoinCardHolder = CPublic.ByteArrayToStr(Cro.JoinCardHolder);
 }
Esempio n. 10
0
        //public static SqlConnection conn = new SqlConnection();

        //@"Data Source=" + IP + ";Initial Catalog=SMS;User ID=" + UserName + ";Password="******"DBConfig.cfg"))
                {
                    using (FileStream fs = new FileStream(AppPath + "DBConfig.cfg", FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        byte[] buf      = new byte[2048];
                        int    nReadNum = fs.Read(buf, 0, 2048);
                        if (nReadNum != 2048)
                        {
                            CPublic.WriteLog("读取数据库连年配置文件失败,长度不足.");
                        }
                        else
                        {
                            EncryptHelper eh = new EncryptHelper();

                            int len = BitConverter.ToInt32(buf, 0);
                            ConnString = eh.DesDecrypt(Encoding.GetEncoding("gb2312").GetString(buf, 4, len), "synjones");

                            len = BitConverter.ToInt32(buf, 1024);
                            string ConOperKey = eh.DesDecrypt(Encoding.GetEncoding("gb2312").GetString(buf, 1028, len), "synjones");
                        }
                    }
                }
                else
                {
                    CPublic.WriteLog("数据库连接配置文件不存在,请使用工具生,并放在目录:" + AppPath);
                }

                return(0);
            }
            catch (Exception e)
            {
                CPublic.WriteLog("初始化异常:" + e.Message);
                return(-1);
            }
        }
Esempio n. 11
0
 protected void Application_End(object sender, EventArgs e)
 {
     TPE_Class.TPE_StopTPE();
     CPublic.WriteLog("Application_End");
 }
Esempio n. 12
0
 protected void Application_Error(object sender, EventArgs e)
 {
     CPublic.WriteLog("Application_Error");
 }
Esempio n. 13
0
 protected void Application_AuthenticateRequest(object sender, EventArgs e)
 {
     CPublic.WriteLog("Application_AuthenticateRequest");
 }
Esempio n. 14
0
 protected void Session_Start(object sender, EventArgs e)
 {
     CPublic.WriteLog("Session_Start");
 }
Esempio n. 15
0
 public TPE_ConfigDeptRec(tagTPE_ConfigDeptRec Cdr)
 {
     DeptNo = Cdr.DeptNo;
     Code   = CPublic.ByteArrayToStr(Cdr.Code);
     Name   = CPublic.ByteArrayToStr(Cdr.Name);
 }