예제 #1
0
 internal SqlSentence SelectByName(string sqlName, int status)
 {
     SqlSentence snt = new SqlSentence();
     string sql = "SELECT * FROM SqlSentence WHERE Status = "+ status +" AND SqlName='" + sqlName + "'";
     SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql);
     DataSet ds = SQLiteHelper.ExecuteDataSet(cmd);
     DataTable dt = ds.Tables[0];
     if (dt != null && dt.Rows.Count > 0)
     {
         DataModelHandler<SqlSentence> dmh = new DataModelHandler<SqlSentence>();
         snt = dmh.FillModel(dt.Rows[0]);
     }
     return snt;
 }
예제 #2
0
 internal List<User> Select(int status)
 {
     List<User> users = new List<User>();
     string sql = "SELECT * FROM User WHERE Status = " + status;
     SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql);
     DataSet ds = SQLiteHelper.ExecuteDataSet(cmd);
     DataTable dt = ds.Tables[0];
     if (dt != null && dt.Rows.Count > 0)
     {
         DataModelHandler<User> dmh = new DataModelHandler<User>();
         users = dmh.FillModel(dt);
     }
     return users;
 }
예제 #3
0
 internal DbConn SelectFirst(int status)
 {
     DbConn conn = new DbConn();
     string sql = "SELECT TOP 1 * FROM DbConn WHERE Status = " + status + "";
     SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql);
     DataSet ds = SQLiteHelper.ExecuteDataSet(cmd);
     DataTable dt = ds.Tables[0];
     if (dt != null && dt.Rows.Count > 0)
     {
         DataModelHandler<DbConn> dmh = new DataModelHandler<DbConn>();
         conn = dmh.FillModel(dt.Rows[0]);
     }
     return conn;
 }
예제 #4
0
        internal List <DbConn> Select(int status)
        {
            List <DbConn> conns = new List <DbConn>();
            string        sql   = "SELECT * FROM DbConn WHERE Status = " + status;
            SQLiteCommand cmd   = SQLiteHelper.CreateCommand(sql);
            DataSet       ds    = SQLiteHelper.ExecuteDataSet(cmd);
            DataTable     dt    = ds.Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                DataModelHandler <DbConn> dmh = new DataModelHandler <DbConn>();
                conns = dmh.FillModel(dt);
            }
            return(conns);
        }
예제 #5
0
        internal DbConn SelectFirst(int status)
        {
            DbConn        conn = new DbConn();
            string        sql  = "SELECT TOP 1 * FROM DbConn WHERE Status = " + status + "";
            SQLiteCommand cmd  = SQLiteHelper.CreateCommand(sql);
            DataSet       ds   = SQLiteHelper.ExecuteDataSet(cmd);
            DataTable     dt   = ds.Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                DataModelHandler <DbConn> dmh = new DataModelHandler <DbConn>();
                conn = dmh.FillModel(dt.Rows[0]);
            }
            return(conn);
        }
예제 #6
0
        internal SqlSentence SelectByName(string sqlName, int status)
        {
            SqlSentence   snt = new SqlSentence();
            string        sql = "SELECT * FROM SqlSentence WHERE Status = " + status + " AND SqlName='" + sqlName + "'";
            SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql);
            DataSet       ds  = SQLiteHelper.ExecuteDataSet(cmd);
            DataTable     dt  = ds.Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                DataModelHandler <SqlSentence> dmh = new DataModelHandler <SqlSentence>();
                snt = dmh.FillModel(dt.Rows[0]);
            }
            return(snt);
        }
예제 #7
0
        internal User SelectByName(string userName, int status)
        {
            User user = new User();
            string sql = "SELECT * FROM User WHERE Status = "+ status +" AND UserName = '******'";
            SQLiteCommand cmd = SQLiteHelper.CreateCommand(sql);
            DataSet ds = SQLiteHelper.ExecuteDataSet(cmd);
            DataTable dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                DataModelHandler<User> dmh = new DataModelHandler<User>();
                user = dmh.FillModel(dt.Rows[0]);
            }
            else
                user = null;

            return user;
        }
예제 #8
0
        internal User SelectByName(string userName, int status)
        {
            User          user = new User();
            string        sql  = "SELECT * FROM User WHERE Status = " + status + " AND UserName = '******'";
            SQLiteCommand cmd  = SQLiteHelper.CreateCommand(sql);
            DataSet       ds   = SQLiteHelper.ExecuteDataSet(cmd);
            DataTable     dt   = ds.Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                DataModelHandler <User> dmh = new DataModelHandler <User>();
                user = dmh.FillModel(dt.Rows[0]);
            }
            else
            {
                user = null;
            }

            return(user);
        }