Example #1
0
        /// <summary>得到一个对象实体
        ///
        /// </summary>
        /// <param name="intId">主键</param>
        /// <returns>返回对象实体</returns>
        public Nikita.Assist.CodeMaker.Model.Bse_UI GetModel(int intId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Bse_UI ");
            strSql.Append(" where Ui_Id=@id ");
            SQLiteHelper h = GlobalHelp.GetSQLiteHelper();

            h.CreateCommand(strSql.ToString());
            h.AddParameter("@id", intId);
            Nikita.Assist.CodeMaker.Model.Bse_UI model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
Example #2
0
        /// <summary>得到一个对象实体
        ///
        /// </summary>
        public Model.Set GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Tb_Set ");
            strSql.Append(" where id=@id ");
            SQLiteHelper h = GlobalHelp.GetSQLiteHelper();

            h.CreateCommand(strSql.ToString());
            h.AddParameter("@id", id);
            Model.Set model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            h.CloseConn();
            return(model);
        }
Example #3
0
        /// <summary>获得数据列表(比DataSet效率高,推荐使用)
        ///
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns>返回符合条件的对象集合</returns>
        public List <Nikita.Assist.CodeMaker.Model.Bse_UI> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append(" FROM Bse_UI ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List <Nikita.Assist.CodeMaker.Model.Bse_UI> list = new List <Nikita.Assist.CodeMaker.Model.Bse_UI>();
            SQLiteHelper h = GlobalHelp.GetSQLiteHelper();

            h.CreateCommand(strSql.ToString());
            using (IDataReader dataReader = h.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                h.CloseConn();
            }
            return(list);
        }
Example #4
0
        /// <summary>根据条件得到一个对象实体
        ///
        /// </summary>
        /// <param name="strCond">条件</param>
        /// <returns>返回对象实体</returns>
        public Nikita.Assist.CodeMaker.Model.Bse_UI GetModelByCond(string strCond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Bse_UI ");
            if (!string.IsNullOrEmpty(strCond))
            {
                strSql.Append(" where " + strCond);
            }
            strSql.Append(" limit 1");
            SQLiteHelper h = GlobalHelp.GetSQLiteHelper();

            h.CreateCommand(strSql.ToString());
            Nikita.Assist.CodeMaker.Model.Bse_UI model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
Example #5
0
        /// <summary>根据条件得到一个对象实体
        ///
        /// </summary>
        public Model.Set GetModelByCond(string cond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Tb_Set ");
            if (!string.IsNullOrEmpty(cond))
            {
                strSql.Append(" where " + cond);
            }
            strSql.Append(" limit 1");
            SQLiteHelper h = GlobalHelp.GetSQLiteHelper();

            h.CreateCommand(strSql.ToString());
            Model.Set model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }