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.

505 lines
13 KiB
C#

10 months ago
using System;
using System.Collections.Generic;
using System.Data;
using DSWeb.SoftMng.Model;
// ReSharper disable once CheckNamespace
namespace DSWeb.SoftMng.BLL {
//info_client
public partial class info_clientBLL
{
private readonly DAL.info_clientDAL dal=new DAL.info_clientDAL();
#region Method
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string GID)
{
return dal.Exists(GID);
}
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(info_client model)
{
return dal.Add(model);
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(info_client model)
{
return dal.Update(model);
}
/// <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 info_client 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<info_client> GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<info_client> DataTableToList(DataTable dt)
{
List<info_client> modelList = new List<info_client>();
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 info_client DataRowToModel(DataRow dr)
{
var model = new info_client();
model.GID= dr["GID"].ToString();
model.CODENAME= dr["CODENAME"].ToString();
model.SHORTNAME= dr["SHORTNAME"].ToString();
model.DESCRIPTION= dr["DESCRIPTION"].ToString();
model.NAME= dr["NAME"].ToString();
model.EnFullName= dr["EnFullName"].ToString();
if(dr["STATUS"].ToString()!="")
{
model.STATUS=int.Parse(dr["STATUS"].ToString());
}
model.ADDR= dr["ADDR"].ToString();
model.EMAIL= dr["EMAIL"].ToString();
model.WEB= dr["WEB"].ToString();
model.TEL= dr["TEL"].ToString();
model.FAX= dr["FAX"].ToString();
model.CHIEF= dr["CHIEF"].ToString();
model.SALE= dr["SALE"].ToString();
model.OP= dr["OP"].ToString();
model.DOC= dr["DOC"].ToString();
if(dr["ISCARRIER"].ToString()!="")
{
if((dr["ISCARRIER"].ToString()=="1")||(dr["ISCARRIER"].ToString().ToLower()=="true"))
{
model.ISCARRIER= true;
}
else
{
model.ISCARRIER= false;
}
}
if(dr["ISBOOKING"].ToString()!="")
{
if((dr["ISBOOKING"].ToString()=="1")||(dr["ISBOOKING"].ToString().ToLower()=="true"))
{
model.ISBOOKING= true;
}
else
{
model.ISBOOKING= false;
}
}
if(dr["ISYARD"].ToString()!="")
{
if((dr["ISYARD"].ToString()=="1")||(dr["ISYARD"].ToString().ToLower()=="true"))
{
model.ISYARD= true;
}
else
{
model.ISYARD= false;
}
}
if(dr["ISTRUCK"].ToString()!="")
{
if((dr["ISTRUCK"].ToString()=="1")||(dr["ISTRUCK"].ToString().ToLower()=="true"))
{
model.ISTRUCK= true;
}
else
{
model.ISTRUCK= false;
}
}
if(dr["ISCONTROLLER"].ToString()!="")
{
if((dr["ISCONTROLLER"].ToString()=="1")||(dr["ISCONTROLLER"].ToString().ToLower()=="true"))
{
model.ISCONTROLLER= true;
}
else
{
model.ISCONTROLLER= false;
}
}
if(dr["ISCUSTOM"].ToString()!="")
{
if((dr["ISCUSTOM"].ToString()=="1")||(dr["ISCUSTOM"].ToString().ToLower()=="true"))
{
model.ISCUSTOM= true;
}
else
{
model.ISCUSTOM= false;
}
}
if(dr["ISAGENT"].ToString()!="")
{
if((dr["ISAGENT"].ToString()=="1")||(dr["ISAGENT"].ToString().ToLower()=="true"))
{
model.ISAGENT= true;
}
else
{
model.ISAGENT= false;
}
}
if(dr["ISAGENTCN"].ToString()!="")
{
if((dr["ISAGENTCN"].ToString()=="1")||(dr["ISAGENTCN"].ToString().ToLower()=="true"))
{
model.ISAGENTCN= true;
}
else
{
model.ISAGENTCN= false;
}
}
if(dr["ISEXPRESS"].ToString()!="")
{
if((dr["ISEXPRESS"].ToString()=="1")||(dr["ISEXPRESS"].ToString().ToLower()=="true"))
{
model.ISEXPRESS= true;
}
else
{
model.ISEXPRESS= false;
}
}
if(dr["ISAIRLINES"].ToString()!="")
{
if((dr["ISAIRLINES"].ToString()=="1")||(dr["ISAIRLINES"].ToString().ToLower()=="true"))
{
model.ISAIRLINES= true;
}
else
{
model.ISAIRLINES= false;
}
}
if(dr["ISSHIPPER"].ToString()!="")
{
if((dr["ISSHIPPER"].ToString()=="1")||(dr["ISSHIPPER"].ToString().ToLower()=="true"))
{
model.ISSHIPPER= true;
}
else
{
model.ISSHIPPER= false;
}
}
if(dr["ISCONSIGNEE"].ToString()!="")
{
if((dr["ISCONSIGNEE"].ToString()=="1")||(dr["ISCONSIGNEE"].ToString().ToLower()=="true"))
{
model.ISCONSIGNEE= true;
}
else
{
model.ISCONSIGNEE= false;
}
}
if(dr["ISNOTIFYPARTY"].ToString()!="")
{
if((dr["ISNOTIFYPARTY"].ToString()=="1")||(dr["ISNOTIFYPARTY"].ToString().ToLower()=="true"))
{
model.ISNOTIFYPARTY= true;
}
else
{
model.ISNOTIFYPARTY= false;
}
}
if(dr["ISWAREHOUSE"].ToString()!="")
{
if((dr["ISWAREHOUSE"].ToString()=="1")||(dr["ISWAREHOUSE"].ToString().ToLower()=="true"))
{
model.ISWAREHOUSE= true;
}
else
{
model.ISWAREHOUSE= false;
}
}
model.COUNTRY= dr["COUNTRY"].ToString();
model.PROVINCE= dr["PROVINCE"].ToString();
model.CITY= dr["CITY"].ToString();
model.CORPID= dr["CORPID"].ToString();
model.BLCONTENT= dr["BLCONTENT"].ToString();
if(dr["ISSTOP"].ToString()!="")
{
if((dr["ISSTOP"].ToString()=="1")||(dr["ISSTOP"].ToString().ToLower()=="true"))
{
model.ISSTOP= true;
}
else
{
model.ISSTOP= false;
}
}
model.BillRises1= dr["BillRises1"].ToString();
model.BillRises2= dr["BillRises2"].ToString();
model.USDBillRises= dr["USDBillRises"].ToString();
model.RMBBillRises= dr["RMBBillRises"].ToString();
model.RMBBank= dr["RMBBank"].ToString();
model.RMBAccount= dr["RMBAccount"].ToString();
model.RMBOnlineNO= dr["RMBOnlineNO"].ToString();
model.USDBank= dr["USDBank"].ToString();
model.USDAccount= dr["USDAccount"].ToString();
model.USDOnlineNO= dr["USDOnlineNO"].ToString();
model.CustomAttributes1= dr["CustomAttributes1"].ToString();
model.CustomAttributes2= dr["CustomAttributes2"].ToString();
if(dr["USDMaxAmountCredit"].ToString()!="")
{
model.USDMaxAmountCredit=decimal.Parse(dr["USDMaxAmountCredit"].ToString());
}
if(dr["RMBMaxAmountCredit"].ToString()!="")
{
model.RMBMaxAmountCredit=decimal.Parse(dr["RMBMaxAmountCredit"].ToString());
}
if(dr["MaxAmountCredit"].ToString()!="")
{
model.MaxAmountCredit=decimal.Parse(dr["MaxAmountCredit"].ToString());
}
model.STLNAME= dr["STLNAME"].ToString();
model.OPNAME= dr["OPNAME"].ToString();
if(dr["OPTIME"].ToString()!="")
{
model.OPTIME=DateTime.Parse(dr["OPTIME"].ToString());
}
model.REMARK= dr["REMARK"].ToString();
if(dr["USDExchangeRate"].ToString()!="")
{
model.USDExchangeRate=decimal.Parse(dr["USDExchangeRate"].ToString());
}
model.STLDATE= dr["STLDATE"].ToString();
model.STLFIRSTHALFDATE= dr["STLFIRSTHALFDATE"].ToString();
model.STLMIDDLEDATE= dr["STLMIDDLEDATE"].ToString();
model.STLDATEPJ= dr["STLDATEPJ"].ToString();
model.LEVEL= dr["LEVEL"].ToString();
model.LOGINNAME= dr["LOGINNAME"].ToString();
model.LOGINPASSWORD= dr["LOGINPASSWORD"].ToString();
model.QQ= dr["QQ"].ToString();
model.MSN= dr["MSN"].ToString();
model.MODIFIEDUSER= dr["MODIFIEDUSER"].ToString();
if(dr["MODIFIEDTIME"].ToString()!="")
{
model.MODIFIEDTIME=DateTime.Parse(dr["MODIFIEDTIME"].ToString());
}
if(dr["ISWHARF"].ToString()!="")
{
if((dr["ISWHARF"].ToString()=="1")||(dr["ISWHARF"].ToString().ToLower()=="true"))
{
model.ISWHARF= true;
}
else
{
model.ISWHARF= false;
}
}
if(dr["ISSHIPPINGAGENT"].ToString()!="")
{
if((dr["ISSHIPPINGAGENT"].ToString()=="1")||(dr["ISSHIPPINGAGENT"].ToString().ToLower()=="true"))
{
model.ISSHIPPINGAGENT= true;
}
else
{
model.ISSHIPPINGAGENT= false;
}
}
model.FARCODE= dr["FARCODE"].ToString();
model.FAPCODE= dr["FAPCODE"].ToString();
if(dr["ISINSURE"].ToString()!="")
{
if((dr["ISINSURE"].ToString()=="1")||(dr["ISINSURE"].ToString().ToLower()=="true"))
{
model.ISINSURE= true;
}
else
{
model.ISINSURE= false;
}
}
if(dr["ISLEASING"].ToString()!="")
{
if((dr["ISLEASING"].ToString()=="1")||(dr["ISLEASING"].ToString().ToLower()=="true"))
{
model.ISLEASING= true;
}
else
{
model.ISLEASING= false;
}
}
if(dr["ISTRADINGAGENCY"].ToString()!="")
{
if((dr["ISTRADINGAGENCY"].ToString()=="1")||(dr["ISTRADINGAGENCY"].ToString().ToLower()=="true"))
{
model.ISTRADINGAGENCY= true;
}
else
{
model.ISTRADINGAGENCY= false;
}
}
if(dr["ISOTHER"].ToString()!="")
{
if((dr["ISOTHER"].ToString()=="1")||(dr["ISOTHER"].ToString().ToLower()=="true"))
{
model.ISOTHER= true;
}
else
{
model.ISOTHER= false;
}
}
model.OTHERS= dr["OTHERS"].ToString();
model.UNITPRICE= dr["UNITPRICE"].ToString();
model.REGISTRATIONNO= dr["REGISTRATIONNO"].ToString();
model.ORDERNO= dr["ORDERNO"].ToString();
if(dr["ISENTERP"].ToString()!="")
{
if((dr["ISENTERP"].ToString()=="1")||(dr["ISENTERP"].ToString().ToLower()=="true"))
{
model.ISENTERP= true;
}
else
{
model.ISENTERP= false;
}
}
model.TAXNO= dr["TAXNO"].ToString();
model.EDICODE= dr["EDICODE"].ToString();
model.EDICODE2= dr["EDICODE2"].ToString();
model.EDICODE3= dr["EDICODE3"].ToString();
model.ORGANIZATIONCODE= dr["ORGANIZATIONCODE"].ToString();
model.PCORPNAME= dr["PCORPNAME"].ToString();
model.InspectionNo= dr["InspectionNo"].ToString();
if(dr["ISSHIPAGENCY"].ToString()!="")
{
if((dr["ISSHIPAGENCY"].ToString()=="1")||(dr["ISSHIPAGENCY"].ToString().ToLower()=="true"))
{
model.ISSHIPAGENCY= true;
}
else
{
model.ISSHIPAGENCY= false;
}
}
if(dr["blstatus"].ToString()!="")
{
model.blstatus=int.Parse(dr["blstatus"].ToString());
}
if(dr["ISSP"].ToString()!="")
{
if((dr["ISSP"].ToString()=="1")||(dr["ISSP"].ToString().ToLower()=="true"))
{
model.ISSP= true;
}
else
{
model.ISSP= false;
}
}
model.FEEFRT= dr["FEEFRT"].ToString();
if(dr["RCVMode"].ToString()!="")
{
model.RCVMode=int.Parse(dr["RCVMode"].ToString());
}
model.ICOURL= dr["ICOURL"].ToString();
model.BSSOURCE= dr["BSSOURCE"].ToString();
model.INVBANK= dr["INVBANK"].ToString();
model.INVADDRTEL= dr["INVADDRTEL"].ToString();
model.SALECORPID= dr["SALECORPID"].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<info_client> 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
}
}