Пример #1
0
        public static object GetMaxId()
        {
            string sConn      = PlavyConfig.GetConnectionString("db");
            SqlDb  db         = new SQLiteDb(sConn);
            var    dbFactory  = db.DbBuilder.DbFactory;
            var    dbOperator = dbFactory.GetDbParamOperator();

            var dblist = db.ExecuteScalar("select max(id) from tb_certs");

            if (dblist == null)
            {
                return(-1);
            }
            return(dblist);
        }
Пример #2
0
        public static void Insert(string sSerialNo, string sCertData, string sCommonName, string sPwd)
        {
            string sConn      = PlavyConfig.GetConnectionString("db");
            SqlDb  db         = new SQLiteDb(sConn);
            var    dbFactory  = db.DbBuilder.DbFactory;
            var    dbOperator = dbFactory.GetDbParamOperator();

            db.BeginTransaction();
            var obj = db.Insert <Certificate>(new Certificate()
            {
                SerialNo   = sSerialNo,
                CommonName = sCommonName,
                CertData   = sCertData,
                CertPwd    = sPwd,
                Udt        = DateTime.Now
            });

            db.CommitTransaction();
        }