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/Areas/SoftMng/DAL/DecList.cs

441 lines
30 KiB
C#

3 years ago
using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Data;
using DSWeb.SoftMng.DBUtility;
// ReSharper disable once CheckNamespace
namespace DSWeb.SoftMng.DAL
{
//DecList
public partial class DecListDAL
{
public bool Exists(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from DecList");
strSql.Append(" where ");
strSql.Append(" GID = @GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) };
parameters[0].Value = GID;
return DbHelperSQL.Exists(strSql.ToString(),parameters);
}
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(DSWeb.SoftMng.Model.DecList model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into DecList(");
strSql.Append("GID,GNo,ContrItem,CodeTS,CiqCode,CiqCode_Text,GName,GModel,GQty,GUnit,GUnit_Text,DeclPrice,DeclTotal,TradeCurr,TradeCurr_Text,FirstQty,FirstUnit,FirstUnit_Text,ExgVersion,ExgNo,DestinationCountry,DestinationCountry_Text,SecondQty,SecondUnit,SecondUnit_Text,OriginCountry,OriginCountry_Text,DistrictCode,DistrictCode_Text,DestCode,DestCode_Text,DutyMode,DutyMode_Text,GoodsAttr,GoodsAttr_Text,Purpose,Purpose_Text,NoDangFlag,Uncode,DangName,DangPackType,DangPackSpec,DangPackSpec_Text,Stuff,ProdValidDt,ProdQgp,EngManEntCnm,GoodsSpec,GoodsModel,GoodsBrand,ProduceDate,ProdBatchNo,MnufctrRegNo,PID");
strSql.Append(") values (");
strSql.Append("@GID,@GNo,@ContrItem,@CodeTS,@CiqCode,@CiqCode_Text,@GName,@GModel,@GQty,@GUnit,@GUnit_Text,@DeclPrice,@DeclTotal,@TradeCurr,@TradeCurr_Text,@FirstQty,@FirstUnit,@FirstUnit_Text,@ExgVersion,@ExgNo,@DestinationCountry,@DestinationCountry_Text,@SecondQty,@SecondUnit,@SecondUnit_Text,@OriginCountry,@OriginCountry_Text,@DistrictCode,@DistrictCode_Text,@DestCode,@DestCode_Text,@DutyMode,@DutyMode_Text,@GoodsAttr,@GoodsAttr_Text,@Purpose,@Purpose_Text,@NoDangFlag,@Uncode,@DangName,@DangPackType,@DangPackSpec,@DangPackSpec_Text,@Stuff,@ProdValidDt,@ProdQgp,@EngManEntCnm,@GoodsSpec,@GoodsModel,@GoodsBrand,@ProduceDate,@ProdBatchNo,@MnufctrRegNo,@PID");
strSql.Append(") ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
new SqlParameter("@GNo", SqlDbType.VarChar,50) ,
new SqlParameter("@ContrItem", SqlDbType.VarChar,50) ,
new SqlParameter("@CodeTS", SqlDbType.VarChar,50) ,
new SqlParameter("@CiqCode", SqlDbType.VarChar,150) ,
new SqlParameter("@CiqCode_Text", SqlDbType.NVarChar,150) ,
new SqlParameter("@GName", SqlDbType.NVarChar,50) ,
new SqlParameter("@GModel", SqlDbType.NVarChar,550) ,
new SqlParameter("@GQty", SqlDbType.Decimal,18) ,
new SqlParameter("@GUnit", SqlDbType.NVarChar,50) ,
new SqlParameter("@GUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DeclPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@DeclTotal", SqlDbType.Decimal,9) ,
new SqlParameter("@TradeCurr", SqlDbType.VarChar,50) ,
new SqlParameter("@TradeCurr_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@FirstQty", SqlDbType.Decimal,18) ,
new SqlParameter("@FirstUnit", SqlDbType.VarChar,50) ,
new SqlParameter("@FirstUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@ExgVersion", SqlDbType.VarChar,50) ,
new SqlParameter("@ExgNo", SqlDbType.VarChar,50) ,
new SqlParameter("@DestinationCountry", SqlDbType.VarChar,50) ,
new SqlParameter("@DestinationCountry_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@SecondQty", SqlDbType.Decimal,18) ,
new SqlParameter("@SecondUnit", SqlDbType.VarChar,50) ,
new SqlParameter("@SecondUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@OriginCountry", SqlDbType.VarChar,50) ,
new SqlParameter("@OriginCountry_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DistrictCode", SqlDbType.VarChar,50) ,
new SqlParameter("@DistrictCode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DestCode", SqlDbType.VarChar,50) ,
new SqlParameter("@DestCode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DutyMode", SqlDbType.VarChar,50) ,
new SqlParameter("@DutyMode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsAttr", SqlDbType.VarChar,500) ,
new SqlParameter("@GoodsAttr_Text", SqlDbType.NVarChar,500) ,
new SqlParameter("@Purpose", SqlDbType.VarChar,50) ,
new SqlParameter("@Purpose_Text", SqlDbType.VarChar,50) ,
new SqlParameter("@NoDangFlag", SqlDbType.Int,4) ,
new SqlParameter("@Uncode", SqlDbType.VarChar,50) ,
new SqlParameter("@DangName", SqlDbType.NVarChar,50) ,
new SqlParameter("@DangPackType", SqlDbType.Int,4) ,
new SqlParameter("@DangPackSpec", SqlDbType.VarChar,50) ,
new SqlParameter("@DangPackSpec_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@Stuff", SqlDbType.NVarChar,50) ,
new SqlParameter("@ProdValidDt", SqlDbType.DateTime) ,
new SqlParameter("@ProdQgp", SqlDbType.Int,4) ,
new SqlParameter("@EngManEntCnm", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsSpec", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsModel", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsBrand", SqlDbType.NVarChar,50) ,
new SqlParameter("@ProduceDate", SqlDbType.NVarChar,100) ,
new SqlParameter("@ProdBatchNo", SqlDbType.NVarChar,50) ,
new SqlParameter("@MnufctrRegNo", SqlDbType.VarChar,50) ,
new SqlParameter("@PID", SqlDbType.VarChar,50)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.GNo??(Object)DBNull.Value;
parameters[2].Value = model.ContrItem??(Object)DBNull.Value;
parameters[3].Value = model.CodeTS??(Object)DBNull.Value;
parameters[4].Value = model.CiqCode??(Object)DBNull.Value;
parameters[5].Value = model.CiqCode_Text??(Object)DBNull.Value;
parameters[6].Value = model.GName??(Object)DBNull.Value;
parameters[7].Value = model.GModel??(Object)DBNull.Value;
parameters[8].Value = model.GQty??(Object)DBNull.Value;
parameters[9].Value = model.GUnit??(Object)DBNull.Value;
parameters[10].Value = model.GUnit_Text??(Object)DBNull.Value;
parameters[11].Value = model.DeclPrice??(Object)DBNull.Value;
parameters[12].Value = model.DeclTotal??(Object)DBNull.Value;
parameters[13].Value = model.TradeCurr??(Object)DBNull.Value;
parameters[14].Value = model.TradeCurr_Text??(Object)DBNull.Value;
parameters[15].Value = model.FirstQty??(Object)DBNull.Value;
parameters[16].Value = model.FirstUnit??(Object)DBNull.Value;
parameters[17].Value = model.FirstUnit_Text??(Object)DBNull.Value;
parameters[18].Value = model.ExgVersion??(Object)DBNull.Value;
parameters[19].Value = model.ExgNo??(Object)DBNull.Value;
parameters[20].Value = model.DestinationCountry??(Object)DBNull.Value;
parameters[21].Value = model.DestinationCountry_Text??(Object)DBNull.Value;
parameters[22].Value = model.SecondQty??(Object)DBNull.Value;
parameters[23].Value = model.SecondUnit??(Object)DBNull.Value;
parameters[24].Value = model.SecondUnit_Text??(Object)DBNull.Value;
parameters[25].Value = model.OriginCountry??(Object)DBNull.Value;
parameters[26].Value = model.OriginCountry_Text??(Object)DBNull.Value;
parameters[27].Value = model.DistrictCode??(Object)DBNull.Value;
parameters[28].Value = model.DistrictCode_Text??(Object)DBNull.Value;
parameters[29].Value = model.DestCode??(Object)DBNull.Value;
parameters[30].Value = model.DestCode_Text??(Object)DBNull.Value;
parameters[31].Value = model.DutyMode??(Object)DBNull.Value;
parameters[32].Value = model.DutyMode_Text??(Object)DBNull.Value;
parameters[33].Value = model.GoodsAttr??(Object)DBNull.Value;
parameters[34].Value = model.GoodsAttr_Text??(Object)DBNull.Value;
parameters[35].Value = model.Purpose??(Object)DBNull.Value;
parameters[36].Value = model.Purpose_Text??(Object)DBNull.Value;
parameters[37].Value = model.NoDangFlag??(Object)DBNull.Value;
parameters[38].Value = model.Uncode??(Object)DBNull.Value;
parameters[39].Value = model.DangName??(Object)DBNull.Value;
parameters[40].Value = model.DangPackType??(Object)DBNull.Value;
parameters[41].Value = model.DangPackSpec??(Object)DBNull.Value;
parameters[42].Value = model.DangPackSpec_Text??(Object)DBNull.Value;
parameters[43].Value = model.Stuff??(Object)DBNull.Value;
parameters[44].Value = model.ProdValidDt??(Object)DBNull.Value;
parameters[45].Value = model.ProdQgp??(Object)DBNull.Value;
parameters[46].Value = model.EngManEntCnm??(Object)DBNull.Value;
parameters[47].Value = model.GoodsSpec??(Object)DBNull.Value;
parameters[48].Value = model.GoodsModel??(Object)DBNull.Value;
parameters[49].Value = model.GoodsBrand??(Object)DBNull.Value;
parameters[50].Value = model.ProduceDate??(Object)DBNull.Value;
parameters[51].Value = model.ProdBatchNo??(Object)DBNull.Value;
parameters[52].Value = model.MnufctrRegNo??(Object)DBNull.Value;
parameters[53].Value = model.PID??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(DSWeb.SoftMng.Model.DecList model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("update DecList set ");
strSql.Append(" GID = @GID,");
strSql.Append(" GNo = @GNo,");
strSql.Append(" ContrItem = @ContrItem,");
strSql.Append(" CodeTS = @CodeTS,");
strSql.Append(" CiqCode = @CiqCode,");
strSql.Append(" CiqCode_Text = @CiqCode_Text,");
strSql.Append(" GName = @GName,");
strSql.Append(" GModel = @GModel,");
strSql.Append(" GQty = @GQty,");
strSql.Append(" GUnit = @GUnit,");
strSql.Append(" GUnit_Text = @GUnit_Text,");
strSql.Append(" DeclPrice = @DeclPrice,");
strSql.Append(" DeclTotal = @DeclTotal,");
strSql.Append(" TradeCurr = @TradeCurr,");
strSql.Append(" TradeCurr_Text = @TradeCurr_Text,");
strSql.Append(" FirstQty = @FirstQty,");
strSql.Append(" FirstUnit = @FirstUnit,");
strSql.Append(" FirstUnit_Text = @FirstUnit_Text,");
strSql.Append(" ExgVersion = @ExgVersion,");
strSql.Append(" ExgNo = @ExgNo,");
strSql.Append(" DestinationCountry = @DestinationCountry,");
strSql.Append(" DestinationCountry_Text = @DestinationCountry_Text,");
strSql.Append(" SecondQty = @SecondQty,");
strSql.Append(" SecondUnit = @SecondUnit,");
strSql.Append(" SecondUnit_Text = @SecondUnit_Text,");
strSql.Append(" OriginCountry = @OriginCountry,");
strSql.Append(" OriginCountry_Text = @OriginCountry_Text,");
strSql.Append(" DistrictCode = @DistrictCode,");
strSql.Append(" DistrictCode_Text = @DistrictCode_Text,");
strSql.Append(" DestCode = @DestCode,");
strSql.Append(" DestCode_Text = @DestCode_Text,");
strSql.Append(" DutyMode = @DutyMode,");
strSql.Append(" DutyMode_Text = @DutyMode_Text,");
strSql.Append(" GoodsAttr = @GoodsAttr,");
strSql.Append(" GoodsAttr_Text = @GoodsAttr_Text,");
strSql.Append(" Purpose = @Purpose,");
strSql.Append(" Purpose_Text = @Purpose_Text,");
strSql.Append(" NoDangFlag = @NoDangFlag,");
strSql.Append(" Uncode = @Uncode,");
strSql.Append(" DangName = @DangName,");
strSql.Append(" DangPackType = @DangPackType,");
strSql.Append(" DangPackSpec = @DangPackSpec,");
strSql.Append(" DangPackSpec_Text = @DangPackSpec_Text,");
strSql.Append(" Stuff = @Stuff,");
strSql.Append(" ProdValidDt = @ProdValidDt,");
strSql.Append(" ProdQgp = @ProdQgp,");
strSql.Append(" EngManEntCnm = @EngManEntCnm,");
strSql.Append(" GoodsSpec = @GoodsSpec,");
strSql.Append(" GoodsModel = @GoodsModel,");
strSql.Append(" GoodsBrand = @GoodsBrand,");
strSql.Append(" ProduceDate = @ProduceDate,");
strSql.Append(" ProdBatchNo = @ProdBatchNo,");
strSql.Append(" MnufctrRegNo = @MnufctrRegNo,");
strSql.Append(" PID = @PID");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
new SqlParameter("@GNo", SqlDbType.VarChar,50) ,
new SqlParameter("@ContrItem", SqlDbType.VarChar,50) ,
new SqlParameter("@CodeTS", SqlDbType.VarChar,50) ,
new SqlParameter("@CiqCode", SqlDbType.VarChar,150) ,
new SqlParameter("@CiqCode_Text", SqlDbType.NVarChar,150) ,
new SqlParameter("@GName", SqlDbType.NVarChar,50) ,
new SqlParameter("@GModel", SqlDbType.NVarChar,550) ,
new SqlParameter("@GQty", SqlDbType.Decimal,18) ,
new SqlParameter("@GUnit", SqlDbType.NVarChar,50) ,
new SqlParameter("@GUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DeclPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@DeclTotal", SqlDbType.Decimal,9) ,
new SqlParameter("@TradeCurr", SqlDbType.VarChar,50) ,
new SqlParameter("@TradeCurr_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@FirstQty", SqlDbType.Decimal,18) ,
new SqlParameter("@FirstUnit", SqlDbType.VarChar,50) ,
new SqlParameter("@FirstUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@ExgVersion", SqlDbType.VarChar,50) ,
new SqlParameter("@ExgNo", SqlDbType.VarChar,50) ,
new SqlParameter("@DestinationCountry", SqlDbType.VarChar,50) ,
new SqlParameter("@DestinationCountry_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@SecondQty", SqlDbType.Decimal,18) ,
new SqlParameter("@SecondUnit", SqlDbType.VarChar,50) ,
new SqlParameter("@SecondUnit_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@OriginCountry", SqlDbType.VarChar,50) ,
new SqlParameter("@OriginCountry_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DistrictCode", SqlDbType.VarChar,50) ,
new SqlParameter("@DistrictCode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DestCode", SqlDbType.VarChar,50) ,
new SqlParameter("@DestCode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@DutyMode", SqlDbType.VarChar,50) ,
new SqlParameter("@DutyMode_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsAttr", SqlDbType.VarChar,500) ,
new SqlParameter("@GoodsAttr_Text", SqlDbType.NVarChar,500) ,
new SqlParameter("@Purpose", SqlDbType.VarChar,50) ,
new SqlParameter("@Purpose_Text", SqlDbType.VarChar,50) ,
new SqlParameter("@NoDangFlag", SqlDbType.Int,4) ,
new SqlParameter("@Uncode", SqlDbType.VarChar,50) ,
new SqlParameter("@DangName", SqlDbType.NVarChar,50) ,
new SqlParameter("@DangPackType", SqlDbType.Int,4) ,
new SqlParameter("@DangPackSpec", SqlDbType.VarChar,50) ,
new SqlParameter("@DangPackSpec_Text", SqlDbType.NVarChar,50) ,
new SqlParameter("@Stuff", SqlDbType.NVarChar,50) ,
new SqlParameter("@ProdValidDt", SqlDbType.DateTime) ,
new SqlParameter("@ProdQgp", SqlDbType.Int,4) ,
new SqlParameter("@EngManEntCnm", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsSpec", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsModel", SqlDbType.NVarChar,50) ,
new SqlParameter("@GoodsBrand", SqlDbType.NVarChar,50) ,
new SqlParameter("@ProduceDate", SqlDbType.NVarChar,50) ,
new SqlParameter("@ProdBatchNo", SqlDbType.NVarChar,50) ,
new SqlParameter("@MnufctrRegNo", SqlDbType.VarChar,50) ,
new SqlParameter("@PID", SqlDbType.VarChar,50)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.GNo??(Object)DBNull.Value;
parameters[2].Value = model.ContrItem??(Object)DBNull.Value;
parameters[3].Value = model.CodeTS??(Object)DBNull.Value;
parameters[4].Value = model.CiqCode??(Object)DBNull.Value;
parameters[5].Value = model.CiqCode_Text??(Object)DBNull.Value;
parameters[6].Value = model.GName??(Object)DBNull.Value;
parameters[7].Value = model.GModel??(Object)DBNull.Value;
parameters[8].Value = model.GQty??(Object)DBNull.Value;
parameters[9].Value = model.GUnit??(Object)DBNull.Value;
parameters[10].Value = model.GUnit_Text??(Object)DBNull.Value;
parameters[11].Value = model.DeclPrice??(Object)DBNull.Value;
parameters[12].Value = model.DeclTotal??(Object)DBNull.Value;
parameters[13].Value = model.TradeCurr??(Object)DBNull.Value;
parameters[14].Value = model.TradeCurr_Text??(Object)DBNull.Value;
parameters[15].Value = model.FirstQty??(Object)DBNull.Value;
parameters[16].Value = model.FirstUnit??(Object)DBNull.Value;
parameters[17].Value = model.FirstUnit_Text??(Object)DBNull.Value;
parameters[18].Value = model.ExgVersion??(Object)DBNull.Value;
parameters[19].Value = model.ExgNo??(Object)DBNull.Value;
parameters[20].Value = model.DestinationCountry??(Object)DBNull.Value;
parameters[21].Value = model.DestinationCountry_Text??(Object)DBNull.Value;
parameters[22].Value = model.SecondQty??(Object)DBNull.Value;
parameters[23].Value = model.SecondUnit??(Object)DBNull.Value;
parameters[24].Value = model.SecondUnit_Text??(Object)DBNull.Value;
parameters[25].Value = model.OriginCountry??(Object)DBNull.Value;
parameters[26].Value = model.OriginCountry_Text??(Object)DBNull.Value;
parameters[27].Value = model.DistrictCode??(Object)DBNull.Value;
parameters[28].Value = model.DistrictCode_Text??(Object)DBNull.Value;
parameters[29].Value = model.DestCode??(Object)DBNull.Value;
parameters[30].Value = model.DestCode_Text??(Object)DBNull.Value;
parameters[31].Value = model.DutyMode??(Object)DBNull.Value;
parameters[32].Value = model.DutyMode_Text??(Object)DBNull.Value;
parameters[33].Value = model.GoodsAttr??(Object)DBNull.Value;
parameters[34].Value = model.GoodsAttr_Text??(Object)DBNull.Value;
parameters[35].Value = model.Purpose??(Object)DBNull.Value;
parameters[36].Value = model.Purpose_Text??(Object)DBNull.Value;
parameters[37].Value = model.NoDangFlag??(Object)DBNull.Value;
parameters[38].Value = model.Uncode??(Object)DBNull.Value;
parameters[39].Value = model.DangName??(Object)DBNull.Value;
parameters[40].Value = model.DangPackType??(Object)DBNull.Value;
parameters[41].Value = model.DangPackSpec??(Object)DBNull.Value;
parameters[42].Value = model.DangPackSpec_Text??(Object)DBNull.Value;
parameters[43].Value = model.Stuff??(Object)DBNull.Value;
parameters[44].Value = model.ProdValidDt??(Object)DBNull.Value;
parameters[45].Value = model.ProdQgp??(Object)DBNull.Value;
parameters[46].Value = model.EngManEntCnm??(Object)DBNull.Value;
parameters[47].Value = model.GoodsSpec??(Object)DBNull.Value;
parameters[48].Value = model.GoodsModel??(Object)DBNull.Value;
parameters[49].Value = model.GoodsBrand??(Object)DBNull.Value;
parameters[50].Value = model.ProduceDate??(Object)DBNull.Value;
parameters[51].Value = model.ProdBatchNo??(Object)DBNull.Value;
parameters[52].Value = model.MnufctrRegNo??(Object)DBNull.Value;
parameters[53].Value = model.PID??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 删除一条数据
/// </summary>
public int Delete(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from DecList ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) };
parameters[0].Value = GID;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 按条件批量删除
/// </summary>
public int DeleteListWhere(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from DecList ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.ExecuteSql(strSql.ToString());
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataSet GetModel(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select GID, GNo, ContrItem, CodeTS, CiqCode, CiqCode_Text, GName, GModel, GQty, GUnit, GUnit_Text, DeclPrice, DeclTotal, TradeCurr, TradeCurr_Text, FirstQty, FirstUnit, FirstUnit_Text, ExgVersion, ExgNo, DestinationCountry, DestinationCountry_Text, SecondQty, SecondUnit, SecondUnit_Text, OriginCountry, OriginCountry_Text, DistrictCode, DistrictCode_Text, DestCode, DestCode_Text, DutyMode, DutyMode_Text, GoodsAttr, GoodsAttr_Text, Purpose, Purpose_Text, NoDangFlag, Uncode, DangName, DangPackType, DangPackSpec, DangPackSpec_Text, Stuff, ProdValidDt, ProdQgp, EngManEntCnm, GoodsSpec, GoodsModel, GoodsBrand, ProduceDate, ProdBatchNo, MnufctrRegNo, PID ");
strSql.Append(" from DecList ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) };
parameters[0].Value = GID;
DSWeb.SoftMng.Model.DecList model=new DSWeb.SoftMng.Model.DecList();
return DbHelperSQL.Query(strSql.ToString(),parameters);
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM DecList ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
/// <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(" * ");
strSql.Append(" FROM DecList ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
strSql.Append(" order by " + filedOrder);
return DbHelperSQL.Query(strSql.ToString());
}
/// <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);
strSql.Append(")AS Row, T.* from DecList T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.Row > {0} and TT.Row <= {1}", startIndex, endIndex);
//公共代码
return DbHelperSQL.Query(strSql.ToString());
}
/// <summary>
/// 获取记录总数
/// </summary>
public int GetRecordCount(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) FROM DecList ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.ExcuteScalarSQL(strSql.ToString());
}
}
}