示例#1
0
        public Entities.TTable GetTTableByTTCode(string ttcode)
        {
            Entities.TTable      ttableModel = new Entities.TTable();
            Entities.QueryTTable query       = new QueryTTable();
            query.TTCode = ttcode;
            int       totalCount = 0;
            DataTable dt         = BLL.TTable.Instance.GetTTable(query, "", 1, 999, out totalCount);

            if (dt != null && dt.Rows.Count > 0)
            {
                ttableModel = Dal.TTable.Instance.GetTTable(int.Parse(dt.Rows[0]["RecID"].ToString()));
            }
            return(ttableModel);
        }
示例#2
0
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetTTable(QueryTTable query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;

            if (query.RecID != Constant.INT_INVALID_VALUE)
            {
                where += " and RecID=" + query.RecID + "";
            }

            if (query.TTCode != Constant.STRING_INVALID_VALUE)
            {
                where += " and TTCode='" + StringHelper.SqlFilter(query.TTCode) + "'";
            }

            if (query.TTDesName != Constant.STRING_INVALID_VALUE)
            {
                where += " and TTDesName like '%" + StringHelper.SqlFilter(query.TTDesName) + "%'";
            }

            if (query.TTIsData != Constant.INT_INVALID_VALUE)
            {
                where += " and TTisData =" + query.TTIsData;
            }

            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = order;
            parameters[2].Value     = pageSize;
            parameters[3].Value     = currentPage;
            parameters[4].Direction = ParameterDirection.Output;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_TTABLE_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
示例#3
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool IsExistsByRecID(int RecID)
        {
            QueryTTable query = new QueryTTable();

            query.RecID = RecID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetTTable(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entities.TTable GetTTable(int RecID)
        {
            QueryTTable query = new QueryTTable();

            query.RecID = RecID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetTTable(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(LoadSingleTTable(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 按照查询条件查询
 /// </summary>
 /// <param name="query">查询条件</param>
 /// <param name="order">排序</param>
 /// <param name="currentPage">页号,-1不分页</param>
 /// <param name="pageSize">每页记录数</param>
 /// <param name="totalCount">总行数</param>
 /// <returns>集合</returns>
 public DataTable GetTTable(QueryTTable query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.TTable.Instance.GetTTable(query, order, currentPage, pageSize, out totalCount));
 }