using System; using System.Collections.Generic; using System.Data; using DSWeb.SoftMng.Model; // ReSharper disable once CheckNamespace namespace DSWeb.SoftMng.BLL { //op_apply public partial class op_applyBLL { private readonly DAL.op_applyDAL dal=new DAL.op_applyDAL(); #region Method /// /// 是否存在该记录 /// public bool Exists(string BSNO,string MASTERNO,string CUSTNO) { return dal.Exists(BSNO,MASTERNO,CUSTNO); } /// /// 增加一条数据 /// public int Add(op_apply model) { return dal.Add(model); } /// /// 更新一条数据 /// public int Update(op_apply model) { return dal.Update(model); } /// /// 删除一条数据 /// public int Delete(string BSNO,string MASTERNO,string CUSTNO) { return dal.Delete(BSNO,MASTERNO,CUSTNO); } /// /// 按条件批量删除(有风险) /// public int DeleteListWhere(string strWhere) { return dal.DeleteListWhere(strWhere); } /// /// 得到一个对象实体 /// public op_apply GetModel(string BSNO,string MASTERNO,string CUSTNO) { DataSet ds = dal.GetModel(BSNO,MASTERNO,CUSTNO); 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 op_apply DataRowToModel(DataRow dr) { var model = new op_apply(); model.BSNO= dr["BSNO"].ToString(); model.MASTERNO= dr["MASTERNO"].ToString(); model.CUSTNO= dr["CUSTNO"].ToString(); model.BSTYPE= dr["BSTYPE"].ToString(); if(dr["BSSTATUS"].ToString()!="") { if((dr["BSSTATUS"].ToString()=="1")||(dr["BSSTATUS"].ToString().ToLower()=="true")) model.BSSTATUS= true; else model.BSSTATUS= false; } if(dr["FEESTATUS"].ToString()!="") { if((dr["FEESTATUS"].ToString()=="1")||(dr["FEESTATUS"].ToString().ToLower()=="true")) model.FEESTATUS= true; else model.FEESTATUS= false; } if(dr["BSDATE"].ToString()!="") model.BSDATE=DateTime.Parse(dr["BSDATE"].ToString()); model.ACCDATE= dr["ACCDATE"].ToString(); model.BSSOURCE= dr["BSSOURCE"].ToString(); model.BSSOURCEDETAIL= dr["BSSOURCEDETAIL"].ToString(); model.MBLNO= dr["MBLNO"].ToString(); model.CUSTOMERNAME= dr["CUSTOMERNAME"].ToString(); model.CUSTOMNO= dr["CUSTOMNO"].ToString(); model.VESSEL= dr["VESSEL"].ToString(); model.VOYNO= dr["VOYNO"].ToString(); model.ETD= dr["ETD"].ToString(); model.ETA= dr["ETA"].ToString(); model.PORTLOAD= dr["PORTLOAD"].ToString(); model.PORTDISCHARGE= dr["PORTDISCHARGE"].ToString(); if(dr["PKGS"].ToString()!="") model.PKGS=int.Parse(dr["PKGS"].ToString()); model.KINDPKGS= dr["KINDPKGS"].ToString(); if(dr["KGS"].ToString()!="") model.KGS=decimal.Parse(dr["KGS"].ToString()); if(dr["CBM"].ToString()!="") model.CBM=decimal.Parse(dr["CBM"].ToString()); model.OP= dr["OP"].ToString(); model.SALE= dr["SALE"].ToString(); model.INVNO= dr["INVNO"].ToString(); model.CONTRACTNO= dr["CONTRACTNO"].ToString(); model.ENTERPID= dr["ENTERPID"].ToString(); model.ENTERP= dr["ENTERP"].ToString(); model.ARCOUNTRY= dr["ARCOUNTRY"].ToString(); model.GOODSOURCE= dr["GOODSOURCE"].ToString(); model.DOCNO= dr["DOCNO"].ToString(); model.REMARK= dr["REMARK"].ToString(); if(dr["TimeMark"].ToString()!="") model.TimeMark=decimal.Parse(dr["TimeMark"].ToString()); model.INPUTBY= dr["INPUTBY"].ToString(); model.CORPID= dr["CORPID"].ToString(); model.CUSTOMSER= dr["CUSTOMSER"].ToString(); if(dr["NETWEIGHT"].ToString()!="") model.NETWEIGHT=decimal.Parse(dr["NETWEIGHT"].ToString()); model.SALEDEPT= dr["SALEDEPT"].ToString(); model.INSPECTIONNO= dr["INSPECTIONNO"].ToString(); model.INSPECTIONDATE= dr["INSPECTIONDATE"].ToString(); model.TRADETYPE= dr["TRADETYPE"].ToString(); model.BOOKNO= dr["BOOKNO"].ToString(); model.IsService1= dr["IsService1"].ToString(); model.IsService2= dr["IsService2"].ToString(); model.IsService3= dr["IsService3"].ToString(); model.IsService4= dr["IsService4"].ToString(); model.IsService5= dr["IsService5"].ToString(); model.IsService6= dr["IsService6"].ToString(); model.CUSTOMDATE= dr["CUSTOMDATE"].ToString(); model.BYCUSTOM= dr["BYCUSTOM"].ToString(); model.HBLNO= dr["HBLNO"].ToString(); model.IsServiceFee1= dr["IsServiceFee1"].ToString(); model.IsServiceFee2= dr["IsServiceFee2"].ToString(); model.IsServiceFee3= dr["IsServiceFee3"].ToString(); model.IsServiceFee4= dr["IsServiceFee4"].ToString(); model.IsServiceFee5= dr["IsServiceFee5"].ToString(); model.IsServiceFee6= dr["IsServiceFee6"].ToString(); model.OPDATE= dr["OPDATE"].ToString(); model.MANIFESTSTATUS= dr["MANIFESTSTATUS"].ToString(); model.IsService9= dr["IsService9"].ToString(); model.IsService10= dr["IsService10"].ToString(); model.IsService11= dr["IsService11"].ToString(); model.IsService12= dr["IsService12"].ToString(); model.IsService13= dr["IsService13"].ToString(); model.IsService14= dr["IsService14"].ToString(); model.IsService15= dr["IsService15"].ToString(); model.IsService16= dr["IsService16"].ToString(); model.IsServiceFee9= dr["IsServiceFee9"].ToString(); model.IsServiceFee10= dr["IsServiceFee10"].ToString(); model.IsServiceFee11= dr["IsServiceFee11"].ToString(); model.IsServiceFee12= dr["IsServiceFee12"].ToString(); model.IsServiceFee13= dr["IsServiceFee13"].ToString(); model.IsServiceFee14= dr["IsServiceFee14"].ToString(); model.IsServiceFee15= dr["IsServiceFee15"].ToString(); model.IsServiceFee16= dr["IsServiceFee16"].ToString(); if(dr["CLEARCUSTOMDATE"].ToString()!="") model.CLEARCUSTOMDATE=DateTime.Parse(dr["CLEARCUSTOMDATE"].ToString()); if(dr["ISMOREGOOD"].ToString()!="") { if((dr["ISMOREGOOD"].ToString()=="1")||(dr["ISMOREGOOD"].ToString().ToLower()=="true")) model.ISMOREGOOD= true; else model.ISMOREGOOD= false; } model.INSPECTSERVICE= dr["INSPECTSERVICE"].ToString(); if(dr["CUSTOMSNUM"].ToString()!="") model.CUSTOMSNUM=int.Parse(dr["CUSTOMSNUM"].ToString()); model.TRADETERM= dr["TRADETERM"].ToString(); model.BSCUSTOMNO= dr["BSCUSTOMNO"].ToString(); model.ISPRINTPR= dr["ISPRINTPR"].ToString(); model.CUSTOMTYPE= dr["CUSTOMTYPE"].ToString(); model.ISCLEAR= dr["ISCLEAR"].ToString(); model.ISCUSTOMEND= dr["ISCUSTOMEND"].ToString(); model.CUSTOMSLNO= dr["CUSTOMSLNO"].ToString(); model.WMSNO= dr["WMSNO"].ToString(); if(dr["ediYwlx"].ToString()!="") model.ediYwlx=int.Parse(dr["ediYwlx"].ToString()); model.recordSn= dr["recordSn"].ToString(); model.payMent= dr["payMent"].ToString(); model.carriageType= dr["carriageType"].ToString(); if(dr["carriagePrice"].ToString()!="") model.carriagePrice=decimal.Parse(dr["carriagePrice"].ToString()); model.carriageCurrency= dr["carriageCurrency"].ToString(); model.premiumType= dr["premiumType"].ToString(); if(dr["premiumPrice"].ToString()!="") model.premiumPrice=decimal.Parse(dr["premiumPrice"].ToString()); model.premiumCurrency= dr["premiumCurrency"].ToString(); if(dr["CNTR1"].ToString()!="") model.CNTR1=int.Parse(dr["CNTR1"].ToString()); if(dr["CNTR2"].ToString()!="") model.CNTR2=int.Parse(dr["CNTR2"].ToString()); if(dr["CNTR3"].ToString()!="") model.CNTR3=int.Parse(dr["CNTR3"].ToString()); if(dr["CNTR4"].ToString()!="") model.CNTR4=int.Parse(dr["CNTR4"].ToString()); if(dr["CNTR5"].ToString()!="") model.CNTR5=int.Parse(dr["CNTR5"].ToString()); if(dr["CNTR6"].ToString()!="") model.CNTR6=int.Parse(dr["CNTR6"].ToString()); if(dr["CNTR7"].ToString()!="") model.CNTR7=int.Parse(dr["CNTR7"].ToString()); if(dr["CNTR8"].ToString()!="") model.CNTR8=int.Parse(dr["CNTR8"].ToString()); if(dr["CNTR9"].ToString()!="") model.CNTR9=int.Parse(dr["CNTR9"].ToString()); if(dr["CNTR10"].ToString()!="") model.CNTR10=int.Parse(dr["CNTR10"].ToString()); if(dr["OTCNTR"].ToString()!="") model.OTCNTR=int.Parse(dr["OTCNTR"].ToString()); if(dr["TEU"].ToString()!="") model.TEU=int.Parse(dr["TEU"].ToString()); if(dr["ISVOU"].ToString()!="") { if((dr["ISVOU"].ToString()=="1")||(dr["ISVOU"].ToString().ToLower()=="true")) model.ISVOU= true; else model.ISVOU= false; } model.VOUNO= dr["VOUNO"].ToString(); model.SALECORPID= dr["SALECORPID"].ToString(); model.IsService7= dr["IsService7"].ToString(); model.IsService8= dr["IsService8"].ToString(); model.IsServiceFee7= dr["IsServiceFee7"].ToString(); model.IsServiceFee8= dr["IsServiceFee8"].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 } }