Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_After_GradeDataModel GetModel(string batchID, string Tf_TrayId, string Tf_CellSn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag from TB_After_GradeData ");
            strSql.Append(" where Tf_BatchID =@Tf_BatchID and Tf_TrayId=@Tf_TrayId and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_TrayId",  SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",  SqlDbType.VarChar, 32)
            };
            parameters[0].Value = batchID;
            parameters[1].Value = Tf_TrayId;
            parameters[2].Value = Tf_CellSn;

            //TB_After_GradeDataModel model = new TB_After_GradeDataModel();
            DataSet ds = DbHelperSQL2.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount ");
            strSql.Append(" FROM TB_Batch_Index ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag ");
            strSql.Append(" FROM TB_After_GradeData ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by Tf_ChannelNo ");
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount ");
            strSql.Append(" FROM TB_Batch_Index ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.Tf_BatchID desc");
            }
            strSql.Append(")AS Row, T.*  from TB_Batch_Index T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_Batch_IndexModel GetModel(string Tf_BatchID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount from TB_Batch_Index ");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = Tf_BatchID;

            TB_Batch_IndexModel model = new TB_Batch_IndexModel();
            DataSet             ds    = DbHelperSQL2.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }