注塑喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

4 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.Model;
namespace MESClassLibrary.DAL.PunchAndWeld
{
public class PunchRecordDAL
{
public bool AddInfo(PunchRecordModel md)
{
try
{
string sql = "";
SqlParameter[] param = null;
sql = " insert into tb_PunchRecord(ID,BarCode";
sql += ") VALUES (";
sql += "@ID,";
sql += "@BarCode)";
param = new SqlParameter[2];
param[0] = new SqlParameter("@ID", SqlDbType.VarChar);
param[0].Value = md.ID;
param[1] = new SqlParameter("@BarCode", SqlDbType.VarChar);
param[1].Value =md.BarCode ;
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
return true;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
public DataTable SearchInfo(string barCode)
{
try
{
string sql = @"SELECT * from tb_PunchRecord where BarCode=@BarCode ";
SqlParameter[] param = null;
param = new SqlParameter[1];
param[0] = new SqlParameter("@BarCode", SqlDbType.VarChar);
param[0].Value = barCode;
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return null;
}
}
}
}