Beispiel #1
0
        public override string getMachineCode()
        {
            string    sql = string.Format("select convert(varchar(20),database_id)+convert(varchar(100),create_date,120) as MACCODESOURCE FROM sys.databases where name='{0}'", dbaseName);
            DataTable dt  = RunSql(sql);

            if (dt.Rows.Count > 0)
            {
                string code = dt.Rows[0]["MACCODESOURCE"].ToString();
                return(code.Equals("") ? "" : CryptUtil.GetMd5Hash(code, true));
            }
            return("");
        }
Beispiel #2
0
        /*
         * public override void BeginTransaction()
         * {
         *  conn.Open();
         *  transaction = conn.BeginTransaction();
         *  inTranscation = true;
         * }
         *
         * public override void CommitTransaction()
         * {
         *  transaction.Commit();
         *  inTranscation = false;
         *  if (conn.State == ConnectionState.Open)
         *  {
         *      conn.Close();
         *  }
         * }
         *
         * public override void RollbackTransaction()
         * {
         *  transaction.Rollback();
         *  inTranscation = false;
         *  if (conn.State == ConnectionState.Open)
         *  {
         *      conn.Close();
         *  }
         * }*/

        public override string getMachineCode()
        {
            string    sql = string.Format("SELECT date_format(CREATE_TIME,'%Y-%m-%d %T') MACCODESOURCE  FROM information_schema.TABLES where  table_schema=DATABASE() and table_name='SYS_REG'");
            DataTable dt  = RunSql(sql);

            if (dt.Rows.Count > 0)
            {
                string code = dt.Rows[0]["MACCODESOURCE"].ToString();
                return(code.Equals("") ? "" : CryptUtil.GetMd5Hash(code, true));
            }
            return("");
        }
Beispiel #3
0
        /*
         * public override void BeginTransaction()
         * {
         *  if (conn.State == ConnectionState.Closed)
         *  {
         *      conn.Open();
         *  }
         *  transaction = conn.BeginTransaction();
         *  inTranscation = true;
         * }
         *
         * public override void CommitTransaction()
         * {
         *  transaction.Commit();
         *  inTranscation = false;
         *  if (conn.State == ConnectionState.Open)
         *  {
         *      conn.Close();
         *  }
         * }
         *
         * public override void RollbackTransaction()
         * {
         *  transaction.Rollback();
         *  inTranscation = false;
         *  if (conn.State == ConnectionState.Open)
         *  {
         *      conn.Close();
         *  }
         * }*/

        public override string getMachineCode()
        {
            string    sql = string.Format("select OBJECT_ID||to_char(CREATED,''yyyy-MM-dd HH24:mi:ss'') AS MACCODESOURCE from USER_OBJECTS WHERE OBJECT_NAME='SYS_REG'");
            DataTable dt  = RunSql(sql);

            if (dt.Rows.Count > 0)
            {
                string code = dt.Rows[0]["MACCODESOURCE"].ToString();
                return(code.Equals("") ? "" : CryptUtil.GetMd5Hash(code, true));
            }
            return("");
        }
Beispiel #4
0
        /// <summary>
        /// 获取数据库的创建时间,并生成机器码,如果是单机数据库则获取机器CPUID,并MD5加密,默认取机本地CPUID码
        /// </summary>
        /// <returns></returns>
        public virtual string getMachineCode()
        {
            string cpuID = HardWare.GetCpuID();

            return(cpuID.Equals("") ? "" : CryptUtil.GetMd5Hash(cpuID, true));
        }