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.

114 lines
4.6 KiB
C#

using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using DSWeb.Areas.Import.Models.CargoName;
using HcUtility.Comm;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.Areas.Import.DAL.FactoryCargoName
{
public partial class FactoryCargoNameDAL
{
#region 厂号2
static public List<Import_FactoryNo2> GetFactoryNoList2 ( string strCondition )
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append("GID,FactoryNo,Remark,countryid,(select country from code_country where countryid=Import_FactoryNo.countryid) country");
strSql.Append(" from Import_FactoryNo ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
return SetFactoryNo2(strSql);
}
static public Import_FactoryNo2 GetData ( string condition )
{
var _t = "";
var list = GetFactoryNoList2(condition);
if (list.Count > 0)
return list[0];
return new Import_FactoryNo2();
}
private static List<Import_FactoryNo2> SetFactoryNo2 ( StringBuilder strSql )
{
var headList = new List<Import_FactoryNo2>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
Import_FactoryNo2 data = new Import_FactoryNo2();
#region Set DB data to Object
data.GID = Convert.ToString(reader["GID"]);
data.COUNTRYID = Convert.ToString(reader["COUNTRYID"]);
data.COUNTRY = Convert.ToString(reader["COUNTRY"]);
data.FACTORYNO = Convert.ToString(reader["FACTORYNO"]);
data.REMARK = Convert.ToString(reader["REMARK"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 商品名称2
static public List<Import_CargoName2> GetCargoNameList2 ( string strCondition )
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append("GID,FACTORYNOGID,ENNAME,CNNAME,HS_ID,CIQ_ID,MODIFIEDUSER,MODIFIEDTIME");
strSql.Append(",(select code+'_'+name from import_cargoinfo where id=HS_ID)HSREF");
strSql.Append(",(select ciqcode+'_'+ciqname from import_cargoCIQ where id=CIQ_ID)CIQREF,SBYS,CARGOTYPE,TAGPICURL");
strSql.Append(" from Import_CargoName ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
return SetCargoName2(strSql);
}
private static List<Import_CargoName2> SetCargoName2 ( StringBuilder strSql )
{
var headList = new List<Import_CargoName2>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
Import_CargoName2 data = new Import_CargoName2();
#region Set DB data to Object
data.GID = Convert.ToString(reader["GID"]);
data.FACTORYNOGID = Convert.ToString(reader["FACTORYNOGID"]);
data.ENNAME = Convert.ToString(reader["ENNAME"]);
data.CNNAME = Convert.ToString(reader["CNNAME"]);
data.HS_ID = Convert.ToString(reader["HS_ID"]);
data.CIQ_ID = Convert.ToString(reader["CIQ_ID"]);
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
data.HSREF = Convert.ToString(reader["HSREF"]);
data.CIQREF = Convert.ToString(reader["CIQREF"]);
data.SBYS = Convert.ToString(reader["SBYS"]);
data.CARGOTYPE = Convert.ToString(reader["CARGOTYPE"]);
data.TAGPICURL = Convert.ToString(reader["TAGPICURL"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
}
}