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_clientServerBLL { private readonly DAL.info_clientServerDAL dal=new DAL.info_clientServerDAL(); #region Method /// /// 是否存在该记录 /// public bool Exists(string GID) { return dal.Exists(GID); } /// /// 增加一条数据 /// public int Add(info_client model) { return dal.Add(model); } /// /// 更新一条数据 /// public int Update(info_client model) { return dal.Update(model); } /// /// 删除一条数据 /// public int Delete(string GID) { return dal.Delete(GID); } /// /// 按条件批量删除(有风险) /// public int DeleteListWhere(string strWhere) { return dal.DeleteListWhere(strWhere); } /// /// 得到一个对象实体 /// 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; } /// /// 获得数据列表 /// public DataSet GetList(string strWhere) { return dal.GetList(strWhere); } /// /// 获得前几行数据 /// public DataSet GetList(int Top,string strWhere,string filedOrder) { return dal.GetList(Top,strWhere,filedOrder); } /// /// 获得数据列表 /// public List GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); return DataTableToList(ds.Tables[0]); } /// /// 获得数据列表 /// public List DataTableToList(DataTable dt) { List modelList = new List(); 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; } /// /// 获得数据 /// 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; } /// /// 获得数据列表 /// public DataSet GetAllList() { return GetList(""); } /// /// 分页获取数据列表 /// /// /// /// /// /// public List 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]); } /// /// 获取记录总数 /// public int GetRecordCount(string strWhere) { return dal.GetRecordCount(strWhere); } #endregion } }