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/BLL/DecHead.cs

296 lines
12 KiB
C#

3 years ago
using System;
using System.Collections.Generic;
using System.Data;
using DSWeb.SoftMng.Model;
// ReSharper disable once CheckNamespace
namespace DSWeb.SoftMng.BLL {
//DecHead
public partial class DecHeadBLL
{
private readonly DAL.DecHeadDAL dal=new DAL.DecHeadDAL();
#region Method
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string GID)
{
return dal.Exists(GID);
}
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(DecHead model)
{
return dal.Add(model);
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(DecHead model)
{
return dal.Update(model);
}
/// <summary>
/// 更新报关单状态
/// </summary>
public int UpdateBillState(string gid,string state,string reason)
{
return dal.UpdateBillState(gid,state,reason);
}
/// <summary>
/// 删除一条数据
/// </summary>
public int Delete(string GID)
{
return dal.Delete(GID);
}
/// <summary>
/// 按条件批量删除(有风险)
/// </summary>
public int DeleteListWhere(string strWhere)
{
return dal.DeleteListWhere(strWhere);
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public DecHead GetModel(string GID)
{
DataSet ds = dal.GetModel(GID);
if(ds.Tables.Count> 0){
var dt = ds.Tables[0];
if(dt.Rows.Count>0){
var dr = dt.Rows[0];
return DataRowToModel(dr);
}
return null;
}
return null;
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
/// <summary>
/// 获得前几行数据
/// </summary>
public DataSet GetList(int Top,string strWhere,string filedOrder)
{
return dal.GetList(Top,strWhere,filedOrder);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DecHead> GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DecHead> DataTableToList(DataTable dt)
{
List<DecHead> modelList = new List<DecHead>();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
for (int n = 0; n < rowsCount; n++)
{
var model = DataRowToModel(dt.Rows[n]);
modelList.Add(model);
}
}
return modelList;
}
/// <summary>
/// 获得数据
/// </summary>
public DecHead DataRowToModel(DataRow dr)
{
var model = new DecHead();
model.GID= dr["GID"].ToString();
model.BSNO= dr["BSNO"].ToString();
model.IEFlag= dr["IEFlag"].ToString();
model.Type= dr["Type"].ToString();
model.EdiId= dr["EdiId"].ToString();
model.Risk= dr["Risk"].ToString();
model.CopCode= dr["CopCode"].ToString();
model.CopName= dr["CopName"].ToString();
if (dr["PDate"].ToString()!="")
model.PDate=DateTime.Parse(dr["PDate"].ToString());
model.TypistNo= dr["TypistNo"].ToString();
model.InputerName= dr["InputerName"].ToString();
model.PartenerID= dr["PartenerID"].ToString();
model.TgdNo= dr["TgdNo"].ToString();
model.DataSource= dr["DataSource"].ToString();
model.DeclTrnRel= dr["DeclTrnRel"].ToString();
model.ChkSurety= dr["ChkSurety"].ToString();
model.CopCodeScc= dr["CopCodeScc"].ToString();
model.CheckFlow= dr["CheckFlow"].ToString();
model.TaxAaminMark= dr["TaxAaminMark"].ToString();
model.EntyPortCode= dr["EntyPortCode"].ToString();
model.BLNo= dr["BLNo"].ToString();
model.BillType= dr["BillType"].ToString();
model.ApprNo= dr["ApprNo"].ToString();
model.CustomMaster= dr["CustomMaster"].ToString();
model.CustomMaster_Text= dr["CustomMaster_Text"].ToString();
model.AgentStatus= dr["AgentStatus"].ToString();
model.SeqNo= dr["SeqNo"].ToString();
model.PreEntryId= dr["PreEntryId"].ToString();
model.EntryId= dr["EntryId"].ToString();
model.IEPort= dr["IEPort"].ToString();
model.IEPort_Text= dr["IEPort_Text"].ToString();
model.ManualNo= dr["ManualNo"].ToString();
model.ContrNo= dr["ContrNo"].ToString();
if (dr["IEDate"].ToString()!="")
model.IEDate=DateTime.Parse(dr["IEDate"].ToString());
if (dr["DDate"].ToString()!="")
model.DDate=DateTime.Parse(dr["DDate"].ToString());
model.TradeCoScc= dr["TradeCoScc"].ToString();
model.TradeCode= dr["TradeCode"].ToString();
model.TradeCiqCode= dr["TradeCiqCode"].ToString();
model.TradeName= dr["TradeName"].ToString();
model.OverseasConsignorCode= dr["OverseasConsignorCode"].ToString();
model.OverseasConsignorCname= dr["OverseasConsignorCname"].ToString();
model.OverseasConsignorEname= dr["OverseasConsignorEname"].ToString();
model.OverseasConsignorAddr= dr["OverseasConsignorAddr"].ToString();
model.OverseasConsigneeCode= dr["OverseasConsigneeCode"].ToString();
model.OverseasConsigneeEname= dr["OverseasConsigneeEname"].ToString();
model.DomesticConsigneeEname= dr["DomesticConsigneeEname"].ToString();
model.EdiRemark2= dr["EdiRemark2"].ToString();
model.EdiRemark= dr["EdiRemark"].ToString();
model.OwnerCodeScc= dr["OwnerCodeScc"].ToString();
model.OwnerCode= dr["OwnerCode"].ToString();
model.OwnerCiqCode= dr["OwnerCiqCode"].ToString();
model.OwnerName= dr["OwnerName"].ToString();
model.AgentCodeScc= dr["AgentCodeScc"].ToString();
model.AgentCode= dr["AgentCode"].ToString();
model.DeclCiqCode= dr["DeclCiqCode"].ToString();
model.AgentName= dr["AgentName"].ToString();
model.TrafMode= dr["TrafMode"].ToString();
model.TrafMode_Text= dr["TrafMode_Text"].ToString();
model.TrafName= dr["TrafName"].ToString();
model.NativeVoyageNo= dr["NativeVoyageNo"].ToString();
model.BillNo= dr["BillNo"].ToString();
model.TradeMode= dr["TradeMode"].ToString();
model.TradeMode_Text= dr["TradeMode_Text"].ToString();
model.CutMode= dr["CutMode"].ToString();
model.CutMode_Text= dr["CutMode_Text"].ToString();
model.LicenseNo= dr["LicenseNo"].ToString();
model.TradeCountry= dr["TradeCountry"].ToString();
model.TradeCountry_Text= dr["TradeCountry_Text"].ToString();
model.DistinatePort= dr["DistinatePort"].ToString();
model.DistinatePort_Text= dr["DistinatePort_Text"].ToString();
model.TransMode= dr["TransMode"].ToString();
model.TransMode_Text= dr["TransMode_Text"].ToString();
model.FeeMark= dr["FeeMark"].ToString();
if (dr["FeeRate"].ToString()!="")
model.FeeRate=decimal.Parse(dr["FeeRate"].ToString());
model.FeeCurr= dr["FeeCurr"].ToString();
model.FeeCurr_Text= dr["FeeCurr_Text"].ToString();
model.InsurMark= dr["InsurMark"].ToString();
if (dr["InsurRate"].ToString()!="")
model.InsurRate=decimal.Parse(dr["InsurRate"].ToString());
model.InsurCurr= dr["InsurCurr"].ToString();
model.InsurCurr_Text= dr["InsurCurr_Text"].ToString();
model.OtherMark= dr["OtherMark"].ToString();
if (dr["OtherRate"].ToString()!="")
model.OtherRate=decimal.Parse(dr["OtherRate"].ToString());
model.OtherCurr= dr["OtherCurr"].ToString();
model.OtherCurr_Text= dr["OtherCurr_Text"].ToString();
if (dr["PackNo"].ToString()!="")
model.PackNo=int.Parse(dr["PackNo"].ToString());
model.WrapType= dr["WrapType"].ToString();
model.WrapType_Text= dr["WrapType_Text"].ToString();
if (dr["GrossWet"].ToString()!="")
model.GrossWet=decimal.Parse(dr["GrossWet"].ToString());
if (dr["NetWt"].ToString()!="")
model.NetWt=decimal.Parse(dr["NetWt"].ToString());
model.TradeAreaCode= dr["TradeAreaCode"].ToString();
model.TradeAreaCode_Text= dr["TradeAreaCode_Text"].ToString();
if (dr["ContaCount"].ToString()!="")
model.ContaCount=int.Parse(dr["ContaCount"].ToString());
model.AttaDocuCdstr= dr["AttaDocuCdstr"].ToString();
model.GoodsPlace= dr["GoodsPlace"].ToString();
model.DespPortCode= dr["DespPortCode"].ToString();
model.DespPortCode_Text= dr["DespPortCode_Text"].ToString();
model.EntryType= dr["EntryType"].ToString();
model.EntryType_Text= dr["EntryType_Text"].ToString();
//model.ApplyType = string.IsNullOrWhiteSpace(dr["ApplyType"].ToString()) ? 1 : (int)dr["ApplyType"];
if (dr["ApplyType"].ToString() != "")
model.ApplyType = int.Parse(dr["ApplyType"].ToString());
//model.ApplyType_Text = dr["ApplyType_Text"].ToString();
model.NoteS= dr["NoteS"].ToString();
model.MarkNo= dr["MarkNo"].ToString();
model.OrgCode= dr["OrgCode"].ToString();
model.OrgCode_Text= dr["OrgCode_Text"].ToString();
model.VsaOrgCode= dr["VsaOrgCode"].ToString();
model.VsaOrgCode_Text= dr["VsaOrgCode_Text"].ToString();
model.InspOrgCode= dr["InspOrgCode"].ToString();
model.InspOrgCode_Text= dr["InspOrgCode_Text"].ToString();
model.PurpOrgCode= dr["PurpOrgCode"].ToString();
model.PurpOrgCode_Text= dr["PurpOrgCode_Text"].ToString();
model.CorrelationNo= dr["CorrelationNo"].ToString();
model.CorrelationReasonFlag= dr["CorrelationReasonFlag"].ToString();
model.CorrelationReasonFlag_Text= dr["CorrelationReasonFlag_Text"].ToString();
if (dr["DespDate"].ToString()!="")
model.DespDate=DateTime.Parse(dr["DespDate"].ToString());
if (dr["CmplDschrgDt"].ToString()!="")
model.CmplDschrgDt=DateTime.Parse(dr["CmplDschrgDt"].ToString());
model.OrigBoxFlag= dr["OrigBoxFlag"].ToString();
model.SpecDeclFlag= dr["SpecDeclFlag"].ToString();
model.SpecDeclFlag_Text= dr["SpecDeclFlag_Text"].ToString();
model.PromiseItmes= dr["PromiseItmes"].ToString();
model.DeclareName= dr["DeclareName"].ToString();
model.NoOtherPack= dr["NoOtherPack"].ToString();
model.Insp_cert= dr["Insp_cert"].ToString();
model.BillState = dr["BillState"].ToString();
return model;
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetAllList()
{
return GetList("");
}
/// <summary>
/// 分页获取数据列表
/// </summary>
/// <param name="startIndex"></param>
/// <param name="limit"></param>
/// <param name="strWhere"></param>
/// <param name="orderby"></param>
/// <returns></returns>
public List<DecHead> GetModelList(int startIndex, int limit, string strWhere, string orderby)
{
int endIndex = startIndex + limit;
DataSet ds = dal.GetListByPage(strWhere,orderby,startIndex,endIndex);
return DataTableToList(ds.Tables[0]);
}
/// <summary>
/// 获取记录总数
/// </summary>
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
#endregion
}
}