/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_After_GradeDataModel model, string oldTrayID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_After_GradeData set ");
            strSql.Append("Tf_TrayId=@Tf_TrayId,");
            strSql.Append("Tf_BatchID=@Tf_BatchID,");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_ChannelNo=@Tf_ChannelNo,");
            strSql.Append("Tf_CellSn=@Tf_CellSn,");
            strSql.Append("Tf_Pick=@Tf_Pick,");
            strSql.Append("Tf_Tag=@Tf_Tag");
            strSql.Append(" where Tf_TrayId='" + oldTrayID + "' and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_ChannelNo", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayId",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Pick",      SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Tag",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_ChannelNo;
            parameters[3].Value = model.Tf_TrayId;
            parameters[4].Value = model.Tf_CellSn;
            parameters[5].Value = model.Tf_Pick;
            parameters[6].Value = model.Tf_Tag;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_After_GradeDataModel DataRowToModel(DataRow row)
        {
            TB_After_GradeDataModel model = new TB_After_GradeDataModel();

            if (row != null)
            {
                if (row["Tf_BatchID"] != null)
                {
                    model.Tf_BatchID = row["Tf_BatchID"].ToString();
                }
                if (row["Tf_Batchtype"] != null && row["Tf_Batchtype"].ToString() != "")
                {
                    model.Tf_Batchtype = int.Parse(row["Tf_Batchtype"].ToString());
                }
                if (row["Tf_TrayId"] != null)
                {
                    model.Tf_TrayId = row["Tf_TrayId"].ToString();
                }
                if (row["Tf_ChannelNo"] != null && row["Tf_ChannelNo"].ToString() != "")
                {
                    model.Tf_ChannelNo = int.Parse(row["Tf_ChannelNo"].ToString());
                }
                if (row["Tf_CellSn"] != null)
                {
                    model.Tf_CellSn = row["Tf_CellSn"].ToString();
                }
                if (row["Tf_Pick"] != null)
                {
                    model.Tf_Pick = row["Tf_Pick"].ToString();
                }
                if (row["Tf_Tag"] != null && row["Tf_Tag"].ToString() != "")
                {
                    model.Tf_Tag = int.Parse(row["Tf_Tag"].ToString());
                }
            }
            return(model);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TB_After_GradeDataModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_After_GradeData(");
            strSql.Append("Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag)");
            strSql.Append(" values (");
            strSql.Append("@Tf_BatchID,@Tf_Batchtype,@Tf_TrayId,@Tf_ChannelNo,@Tf_CellSn,@Tf_Pick,@Tf_Tag)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayId",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_ChannelNo", SqlDbType.Int,      4),
                new SqlParameter("@Tf_CellSn",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Pick",      SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Tag",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_TrayId;
            parameters[3].Value = model.Tf_ChannelNo;
            parameters[4].Value = model.Tf_CellSn;
            parameters[5].Value = model.Tf_Pick;
            parameters[6].Value = model.Tf_Tag;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TB_After_GradeDataModel model, string oldTrayID)
 {
     return(dal.Update(model, oldTrayID));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(TB_After_GradeDataModel model)
 {
     return(dal.Add(model));
 }