You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/EntityDA/SeaContainerDA.cs

112 lines
3.9 KiB
C#

2 years ago
using System;
using System.Data;
using System.Data.SqlClient;
using DSWeb.Models;
using WebSqlHelper;
namespace DSWeb.EntityDA
{
public class SeaContainerDA
{
private const string PARM_SEACTN_GID = "@gid";
private const string PARM_SEACTN_BSNO = "@bsno";
private const string PARM_SEACTN_CTN_CODE = "@ctn_code";
private const string PARM_SEACTN_SIZE = "@size";
private const string PARM_SEACTN_CTN = "@ctn";
private const string PARM_SEACTN_CTN_NUM = "@ctn_num";
private const string PARM_SEACTN_TEU = "@teu";
private const string PARM_SEACTN_CTN_ALL = "@ctn_all";
private const string SQL_SELECT_SEACTN_BY_ID = " SELECT CTN_ID, BSNO, CTNCODE, SIZE, CTN, CTNNUM, TEU, CTNALL from op_ctn WHERE CTN_ID = @gid";
private const string SQL_SELECT_SEACTN_ALL = " SELECT CTN_ID, BSNO, CTNCODE, SIZE, CTN, CTNNUM, TEU, CTNALL from op_ctn ";
#region 根据集装箱箱量信息表GID获取信息
/// <summary>
/// 根据集装箱箱量信息表GID获取信息
/// </summary>
/// <param name="strGID"></param>
/// <returns></returns>
public SeaContainerEntity GetCTNByID(string strGID)
{
SeaContainerEntity seaContainerEntity = null;
SqlParameter parm = new SqlParameter(PARM_SEACTN_GID, SqlDbType.VarChar, 36);
parm.Value = strGID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_SEACTN_BY_ID, parm))
{
try
{
seaContainerEntity = new SeaContainerEntity();
while (sqlRead.Read())
{
if (!sqlRead.IsDBNull(0))
{
seaContainerEntity.CTNID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
seaContainerEntity.BSNO = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
seaContainerEntity.CTNCode = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
seaContainerEntity.Size = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
seaContainerEntity.CTN = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
seaContainerEntity.CTNNum = sqlRead.GetInt32(5);
}
if (!sqlRead.IsDBNull(6))
{
seaContainerEntity.TEU = sqlRead.GetInt32(6);
}
if (!sqlRead.IsDBNull(7))
{
seaContainerEntity.CTNAll = sqlRead.GetString(7);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return seaContainerEntity;
}
#endregion
#region 返回所有集装箱箱量信息数据集
/// <summary>
/// 返回所有集装箱箱量信息数据集
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public DataSet GetFeeList()
{
DataSet userSet = new DataSet();
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_SEACTN_ALL);
return userSet;
}
#endregion
}
}