Example #1
0
 public static Boolean login(String userno, String password)
 {
     DB db = new DB();
     long count = db.GetCount(String.Format("SELECT COUNT(*) FROM user_info WHERE user_no='{0}' AND password='******'", userno, Utils.md5(password)));
     if(count == 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #2
0
        public static Boolean login(String userno, String password)
        {
            DB   db    = new DB();
            long count = db.GetCount(String.Format("SELECT COUNT(*) FROM user_info WHERE user_no='{0}' AND password='******'", userno, Utils.md5(password)));

            if (count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 /// <summary>
 // 生成制卡文件后要提交数据库,某集团的某批次已制卡完成
 /// </summary>
 /// <param name="unitNum"></param>
 /// <param name="batchNum"></param>
 /// <returns></returns>
 public static Boolean CommitGenFile(String unitNum, int batchNum)
 {
     DB db = new DB();
     db.Conn.Open();
     NpgsqlTransaction transaction = db.Conn.BeginTransaction();
     //DataTable dt = new DataTable();
     long count = db.GetCount(String.Format("SELECT COUNT(*) FROM card_batch_info WHERE file_generated=true AND unit_no='{0}' AND batch_no={1}", unitNum, batchNum));
     if (count == 0)
     {
         // card_kind: 卡类型 0:磁条卡 1:IC接解卡 2:IC非接触
         // card_type: 卡种类 0:系统卡 1:自发卡
         db.ExecSql(String.Format("INSERT INTO card_info(card_no, card_kind, password, status, amount, points_rule, exp_date, points, unit_no, track_2, valid_life, card_type) (SELECT card_no, card_kind, md5(password), status, amount, points_rule, exp_date, points, unit_no, track_2, valid_life, '0' FROM tmp_card_info WHERE unit_no = '{0}' AND batch_no = {1})", unitNum, batchNum));
         db.ExecSql(String.Format("UPDATE card_batch_info SET file_generated=true WHERE unit_no='{0}' AND batch_no={1}", unitNum, batchNum));
     }
     transaction.Commit();
     db.Conn.Close();
     return true;
 }
Example #4
0
        /// <summary>
        // 生成制卡文件后要提交数据库,某集团的某批次已制卡完成
        /// </summary>
        /// <param name="unitNum"></param>
        /// <param name="batchNum"></param>
        /// <returns></returns>
        public static Boolean CommitGenFile(String unitNum, int batchNum)
        {
            DB db = new DB();

            db.Conn.Open();
            NpgsqlTransaction transaction = db.Conn.BeginTransaction();
            //DataTable dt = new DataTable();
            long count = db.GetCount(String.Format("SELECT COUNT(*) FROM card_batch_info WHERE file_generated=true AND unit_no='{0}' AND batch_no={1}", unitNum, batchNum));

            if (count == 0)
            {
                // card_kind: 卡类型 0:磁条卡 1:IC接解卡 2:IC非接触
                // card_type: 卡种类 0:系统卡 1:自发卡
                db.ExecSql(String.Format("INSERT INTO card_info(card_no, card_kind, password, status, amount, points_rule, exp_date, points, unit_no, track_2, valid_life, card_type) (SELECT card_no, card_kind, md5(password), status, amount, points_rule, exp_date, points, unit_no, track_2, valid_life, '0' FROM tmp_card_info WHERE unit_no = '{0}' AND batch_no = {1})", unitNum, batchNum));
                db.ExecSql(String.Format("UPDATE card_batch_info SET file_generated=true WHERE unit_no='{0}' AND batch_no={1}", unitNum, batchNum));
            }
            transaction.Commit();
            db.Conn.Close();
            return(true);
        }