コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_Batch_IndexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_Batch_Index set ");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_TrayCount=@Tf_TrayCount,");
            strSql.Append("Tf_CellCount=@Tf_CellCount");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,     4),
                new SqlParameter("@Tf_TrayCount", SqlDbType.Int,     4),
                new SqlParameter("@Tf_CellCount", SqlDbType.Int,     4),
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32)
            };
            parameters[0].Value = model.Tf_Batchtype;
            parameters[1].Value = model.Tf_TrayCount;
            parameters[2].Value = model.Tf_CellCount;
            parameters[3].Value = model.Tf_BatchID;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TB_Batch_IndexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_Batch_Index(");
            strSql.Append("Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount)");
            strSql.Append(" values (");
            strSql.Append("@Tf_BatchID,@Tf_Batchtype,@Tf_TrayCount,@Tf_CellCount)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayCount", SqlDbType.Int,      4),
                new SqlParameter("@Tf_CellCount", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_TrayCount;
            parameters[3].Value = model.Tf_CellCount;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_Batch_IndexModel DataRowToModel(DataRow row)
        {
            TB_Batch_IndexModel model = new TB_Batch_IndexModel();

            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_TrayCount"] != null && row["Tf_TrayCount"].ToString() != "")
                {
                    model.Tf_TrayCount = int.Parse(row["Tf_TrayCount"].ToString());
                }
                if (row["Tf_CellCount"] != null && row["Tf_CellCount"].ToString() != "")
                {
                    model.Tf_CellCount = int.Parse(row["Tf_CellCount"].ToString());
                }
            }
            return(model);
        }
コード例 #4
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);
            }
        }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TB_Batch_IndexModel model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(TB_Batch_IndexModel model)
 {
     return(dal.Add(model));
 }