using System ;
using System.Data ;
using System.Collections ;
using System.Collections.Generic ;
using System.Text ;
using System.Globalization ;
using System.Xml ;
using DSWeb.MvcShipping.Models.MsOpSeaeModule ;
using Microsoft.Practices.EnterpriseLibrary.Data ;
using DSWeb.EntityDA ;
using DSWeb.Areas.CommMng.Models ;
using HcUtility.Comm ;
using System.IO ;
using DSWeb.MvcShipping.Models.FtpSet ;
using DSWeb.MvcShipping.Models.MsOpSeaeBill ;
using DSWeb.MvcShipping.Models.MsOpSeae ;
using DSWeb.MvcShipping.Models.CompanyDef ;
using DSWeb.MvcShipping.DAL.DsSendmail ;
using DotNet4.Utilities ;
using HcUtility.Core ;
using DSWeb.MvcShipping.DAL.MsSysParamSet ;
using Microsoft.Office.Interop.Excel ;
using System.Web.Configuration ;
using DSWeb.Areas.MvcShipping.Comm ;
using DSWeb.MvcShipping.Helper ;
using System.Linq ;
using System.Collections.Specialized ;
using System.Net ;
using DSWeb.Common.DB ;
using DSWeb.Areas.CommMng.DAL ;
namespace DSWeb.MvcShipping.DAL.MsOpSeaeModuleDAL
{
public class MsOpSeaeModuleDAL
{
#region 查询
static public List < MsOpSeaeModule > GetDataList ( string strCondition , string userid , string usercode , string companyid , string sort = null )
{
var rangstr = GetRangDAStr ( "index" , userid , usercode , companyid ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strCondition = strCondition + " and " + rangstr ;
}
else
{
strCondition = rangstr ;
}
}
/ /
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT GID,MBLNO,HBLNO,TEMPLATE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO," ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION," ) ;
strSql . Append ( "NOBILL,ISSUETYPE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME," ) ;
strSql . Append ( "GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,INPUTDATE," ) ;
strSql . Append ( "INPUTBY,PLACERECEIPTID,REMARK,HSCODE,CARGOID,COPYNOBILL,[DCLASS],[DUNNO],[REEFERF],[HUMIDITY],[TEMPID],[TEMPSET],[TEMPMAX]," ) ;
strSql . Append ( "[TEMPMIN],[DPAGE],[DLABEL],[LINKMAN],CUSTOMERNAME" ) ;
strSql . Append ( " from op_seae_module " ) ;
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strSql . Append ( " where " + strCondition ) ;
}
/ /
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
strSql . Append ( " order by " + sortstring ) ;
}
else
{
strSql . Append ( " order by INPUTDATE desc" ) ;
}
return SetData ( strSql ) ;
}
static public string GetDataListStr ( string strCondition , string userid , string usercode , string companyid , string sort = null )
{
var rangstr = GetRangDAStr ( "index" , userid , usercode , companyid ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strCondition = strCondition + " and " + rangstr ;
}
else
{
strCondition = rangstr ;
}
}
/ /
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT GID,MBLNO,HBLNO,TEMPLATE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO," ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION," ) ;
strSql . Append ( "NOBILL,ISSUETYPE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME," ) ;
strSql . Append ( "GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,INPUTDATE," ) ;
strSql . Append ( "INPUTBY,PLACERECEIPTID,REMARK,HSCODE,CARGOID,COPYNOBILL,[DCLASS],[DUNNO],[REEFERF],[HUMIDITY],[TEMPID],[TEMPSET],[TEMPMAX]," ) ;
strSql . Append ( "[TEMPMIN],[DPAGE],[DLABEL],[LINKMAN],CUSTOMERNAME" ) ;
strSql . Append ( " from op_seae_module " ) ;
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strSql . Append ( " where " + strCondition ) ;
}
/ /
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
strSql . Append ( " order by " + sortstring ) ;
}
else
{
strSql . Append ( " order by INPUTDATE desc" ) ;
}
return strSql . ToString ( ) ;
}
static public MsOpSeaeModule GetData ( string condition )
{
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT GID,MBLNO,HBLNO,TEMPLATE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO," ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION," ) ;
strSql . Append ( "NOBILL,ISSUETYPE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME," ) ;
strSql . Append ( "GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,INPUTDATE," ) ;
strSql . Append ( "INPUTBY,PLACERECEIPTID,REMARK,HSCODE,CARGOID,COPYNOBILL,[DCLASS],[DUNNO],[REEFERF],[HUMIDITY],[TEMPID],[TEMPSET],[TEMPMAX]," ) ;
strSql . Append ( "[TEMPMIN],[DPAGE],[DLABEL],[LINKMAN],CUSTOMERNAME" ) ;
strSql . Append ( " from op_seae_module " ) ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql . Append ( " where " + condition ) ;
}
var list = SetData ( strSql ) ;
if ( list . Count > 0 )
return list [ 0 ] ;
return new MsOpSeaeModule ( ) ;
}
private static List < MsOpSeaeModule > SetData ( StringBuilder strSql )
{
var headList = new List < MsOpSeaeModule > ( ) ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
MsOpSeaeModule data = new MsOpSeaeModule ( ) ;
#region Set DB data to Object
data . GID = Convert . ToString ( reader [ "GID" ] ) ; //业务编号
data . MBLNO = Convert . ToString ( reader [ "MBLNO" ] ) ; //主提单号
data . HBLNO = Convert . ToString ( reader [ "HBLNO" ] ) ; //分提单号
data . TEMPLATE = Convert . ToString ( reader [ "TEMPLATE" ] ) ; // 业务状态
data . INPUTBY = Convert . ToString ( reader [ "INPUTBY" ] ) ; //录入人
data . VESSEL = Convert . ToString ( reader [ "VESSEL" ] ) ; //船名
data . VOYNO = Convert . ToString ( reader [ "VOYNO" ] ) ; //航次
data . PORTLOADID = Convert . ToString ( reader [ "PORTLOADID" ] ) ; //装货港代码
data . PORTLOAD = Convert . ToString ( reader [ "PORTLOAD" ] ) ; //装货港
data . PORTDISCHARGEID = Convert . ToString ( reader [ "PORTDISCHARGEID" ] ) ; //卸货港代码
data . PORTDISCHARGE = Convert . ToString ( reader [ "PORTDISCHARGE" ] ) ; //卸货港
data . GOODSNAME = Convert . ToString ( reader [ "GOODSNAME" ] ) ; //品名
if ( reader [ "KGS" ] ! = DBNull . Value )
data . KGS = Convert . ToDecimal ( reader [ "KGS" ] ) ; //毛重
if ( reader [ "PKGS" ] ! = DBNull . Value )
data . PKGS = Convert . ToInt32 ( reader [ "PKGS" ] ) ; //件数
if ( reader [ "CBM" ] ! = DBNull . Value )
data . CBM = Convert . ToDecimal ( reader [ "CBM" ] ) ; //立方数/尺码
data . YARD = Convert . ToString ( reader [ "YARD" ] ) ; //场站/靠泊码头
data . KINDPKGS = Convert . ToString ( reader [ "KINDPKGS" ] ) ; //件数包装
data . NOPKGS = Convert . ToString ( reader [ "NOPKGS" ] ) ; //件数包装
data . GROSSWEIGHT = Convert . ToString ( reader [ "GROSSWEIGHT" ] ) ; //货物毛重
data . MEASUREMENT = Convert . ToString ( reader [ "MEASUREMENT" ] ) ; //货物尺码
data . DESCRIPTION = Convert . ToString ( reader [ "DESCRIPTION" ] ) ; //货物描述
data . TOTALNO = Convert . ToString ( reader [ "TOTALNO" ] ) ; //件数大写
data . SHIPPERID = Convert . ToString ( reader [ "SHIPPERID" ] ) ; //发货人
data . CONSIGNEEID = Convert . ToString ( reader [ "CONSIGNEEID" ] ) ; //收货人
data . NOTIFYPARTYID = Convert . ToString ( reader [ "NOTIFYPARTYID" ] ) ; //通知人
data . SHIPPER = Convert . ToString ( reader [ "SHIPPER" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //发货人内容
//data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]);//收货人内容
data . CONSIGNEE = Convert . ToString ( reader [ "CONSIGNEE" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //收货人内容
//data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]);//通知人内容
data . NOTIFYPARTY = Convert . ToString ( reader [ "NOTIFYPARTY" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //通知人内容
data . AGENTID = Convert . ToString ( reader [ "AGENTID" ] ) ; //国外代理
data . AGENT = Convert . ToString ( reader [ "AGENT" ] ) ; //国外代理内容
data . PLACERECEIPT = Convert . ToString ( reader [ "PlACERECEIPT" ] ) ; //收货地
data . PLACERECEIPTID = Convert . ToString ( reader [ "PlACERECEIPTID" ] ) ; //收货地
data . PLACEDELIVERYID = Convert . ToString ( reader [ "PLACEDELIVERYID" ] ) ; //交货地代码
data . PLACEDELIVERY = Convert . ToString ( reader [ "PLACEDELIVERY" ] ) ; //交货地
data . DESTINATIONID = Convert . ToString ( reader [ "DESTINATIONID" ] ) ; //目的地代码
data . DESTINATION = Convert . ToString ( reader [ "DESTINATION" ] ) ; //目的地
data . NOBILL = Convert . ToString ( reader [ "NOBILL" ] ) ; //提单份数
data . ISSUETYPE = Convert . ToString ( reader [ "ISSUETYPE" ] ) ; //签单方式
data . ISSUEPLACE = Convert . ToString ( reader [ "ISSUEPLACE" ] ) ; //签单地点
data . BLFRT = Convert . ToString ( reader [ "BLFRT" ] ) ; //付费方式
data . PREPARDAT = Convert . ToString ( reader [ "PREPARDAT" ] ) ; //预付地点
data . PAYABLEAT = Convert . ToString ( reader [ "PAYABLEAT" ] ) ; //到付地点
data . SERVICE = Convert . ToString ( reader [ "SERVICE" ] ) ; //运输条款
data . MARKS = Convert . ToString ( reader [ "MARKS" ] ) ; //唛头
data . REMARK = Convert . ToString ( reader [ "REMARK" ] ) ; //唛头
data . DCLASS = Convert . ToString ( reader [ "DCLASS" ] ) ; //唛头
data . DUNNO = Convert . ToString ( reader [ "DUNNO" ] ) ; //发货人
data . REEFERF = Convert . ToString ( reader [ "REEFERF" ] ) ; //发货人
data . HUMIDITY = Convert . ToString ( reader [ "HUMIDITY" ] ) ; //发货人
data . TEMPID = Convert . ToString ( reader [ "TEMPID" ] ) ; //发货人
data . TEMPSET = Convert . ToString ( reader [ "TEMPSET" ] ) ; //收货人
data . TEMPMAX = Convert . ToString ( reader [ "TEMPMAX" ] ) ; //发货人
data . TEMPMIN = Convert . ToString ( reader [ "TEMPMIN" ] ) ; //收货人
data . DPAGE = Convert . ToString ( reader [ "DPAGE" ] ) ; //收货人
data . DLABEL = Convert . ToString ( reader [ "DLABEL" ] ) ; //通知人
data . LINKMAN = Convert . ToString ( reader [ "LINKMAN" ] ) ; //发货人
data . HSCODE = Convert . ToString ( reader [ "HSCODE" ] ) ; / /
data . CARGOID = Convert . ToString ( reader [ "CARGOID" ] ) ; / /
data . COPYNOBILL = Convert . ToString ( reader [ "COPYNOBILL" ] ) ; / /
if ( reader [ "INPUTDATE" ] ! = DBNull . Value )
data . INPUTDATE = Convert . ToDateTime ( reader [ "INPUTDATE" ] ) . ToString ( "yyyy-MM-dd HH:mm:ss" ) ; //签单日期
data . CUSTOMERNAME = Convert . ToString ( reader [ "CUSTOMERNAME" ] ) ; / /
# endregion
headList . Add ( data ) ;
}
reader . Close ( ) ;
}
return headList ;
}
private static List < MsOpSeaeModule > SetData ( StringBuilder strSql , Database db )
{
var headList = new List < MsOpSeaeModule > ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
MsOpSeaeModule data = new MsOpSeaeModule ( ) ;
#region Set DB data to Object
data . GID = Convert . ToString ( reader [ "GID" ] ) ; //业务编号
data . MBLNO = Convert . ToString ( reader [ "MBLNO" ] ) ; //主提单号
data . HBLNO = Convert . ToString ( reader [ "HBLNO" ] ) ; //分提单号
data . TEMPLATE = Convert . ToString ( reader [ "TEMPLATE" ] ) ; // 业务状态
data . INPUTBY = Convert . ToString ( reader [ "INPUTBY" ] ) ; //录入人
data . VESSEL = Convert . ToString ( reader [ "VESSEL" ] ) ; //船名
data . VOYNO = Convert . ToString ( reader [ "VOYNO" ] ) ; //航次
data . PORTLOADID = Convert . ToString ( reader [ "PORTLOADID" ] ) ; //装货港代码
data . PORTLOAD = Convert . ToString ( reader [ "PORTLOAD" ] ) ; //装货港
data . PORTDISCHARGEID = Convert . ToString ( reader [ "PORTDISCHARGEID" ] ) ; //卸货港代码
data . PORTDISCHARGE = Convert . ToString ( reader [ "PORTDISCHARGE" ] ) ; //卸货港
data . GOODSNAME = Convert . ToString ( reader [ "GOODSNAME" ] ) ; //品名
if ( reader [ "KGS" ] ! = DBNull . Value )
data . KGS = Convert . ToDecimal ( reader [ "KGS" ] ) ; //毛重
if ( reader [ "PKGS" ] ! = DBNull . Value )
data . PKGS = Convert . ToInt32 ( reader [ "PKGS" ] ) ; //件数
if ( reader [ "CBM" ] ! = DBNull . Value )
data . CBM = Convert . ToDecimal ( reader [ "CBM" ] ) ; //立方数/尺码
data . YARD = Convert . ToString ( reader [ "YARD" ] ) ; //场站/靠泊码头
data . KINDPKGS = Convert . ToString ( reader [ "KINDPKGS" ] ) ; //件数包装
data . NOPKGS = Convert . ToString ( reader [ "NOPKGS" ] ) ; //件数包装
data . GROSSWEIGHT = Convert . ToString ( reader [ "GROSSWEIGHT" ] ) ; //货物毛重
data . MEASUREMENT = Convert . ToString ( reader [ "MEASUREMENT" ] ) ; //货物尺码
data . DESCRIPTION = Convert . ToString ( reader [ "DESCRIPTION" ] ) ; //货物描述
data . TOTALNO = Convert . ToString ( reader [ "TOTALNO" ] ) ; //件数大写
data . SHIPPERID = Convert . ToString ( reader [ "SHIPPERID" ] ) ; //发货人
data . CONSIGNEEID = Convert . ToString ( reader [ "CONSIGNEEID" ] ) ; //收货人
data . NOTIFYPARTYID = Convert . ToString ( reader [ "NOTIFYPARTYID" ] ) ; //通知人
data . SHIPPER = Convert . ToString ( reader [ "SHIPPER" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //发货人内容
//data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]);//收货人内容
data . CONSIGNEE = Convert . ToString ( reader [ "CONSIGNEE" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //收货人内容
//data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]);//通知人内容
data . NOTIFYPARTY = Convert . ToString ( reader [ "NOTIFYPARTY" ] ) . Replace ( @"\\\\" , "\n" ) . Replace ( @"^" , "\'" ) ; //通知人内容
data . AGENTID = Convert . ToString ( reader [ "AGENTID" ] ) ; //国外代理
data . AGENT = Convert . ToString ( reader [ "AGENT" ] ) ; //国外代理内容
data . PLACERECEIPT = Convert . ToString ( reader [ "PlACERECEIPT" ] ) ; //收货地
data . PLACERECEIPTID = Convert . ToString ( reader [ "PlACERECEIPTID" ] ) ; //收货地
data . PLACEDELIVERYID = Convert . ToString ( reader [ "PLACEDELIVERYID" ] ) ; //交货地代码
data . PLACEDELIVERY = Convert . ToString ( reader [ "PLACEDELIVERY" ] ) ; //交货地
data . DESTINATIONID = Convert . ToString ( reader [ "DESTINATIONID" ] ) ; //目的地代码
data . DESTINATION = Convert . ToString ( reader [ "DESTINATION" ] ) ; //目的地
data . NOBILL = Convert . ToString ( reader [ "NOBILL" ] ) ; //提单份数
data . ISSUETYPE = Convert . ToString ( reader [ "ISSUETYPE" ] ) ; //签单方式
data . ISSUEPLACE = Convert . ToString ( reader [ "ISSUEPLACE" ] ) ; //签单地点
data . BLFRT = Convert . ToString ( reader [ "BLFRT" ] ) ; //付费方式
data . PREPARDAT = Convert . ToString ( reader [ "PREPARDAT" ] ) ; //预付地点
data . PAYABLEAT = Convert . ToString ( reader [ "PAYABLEAT" ] ) ; //到付地点
data . SERVICE = Convert . ToString ( reader [ "SERVICE" ] ) ; //运输条款
data . MARKS = Convert . ToString ( reader [ "MARKS" ] ) ; //唛头
data . REMARK = Convert . ToString ( reader [ "REMARK" ] ) ; //唛头
data . DCLASS = Convert . ToString ( reader [ "DCLASS" ] ) ; //唛头
data . DUNNO = Convert . ToString ( reader [ "DUNNO" ] ) ; //发货人
data . REEFERF = Convert . ToString ( reader [ "REEFERF" ] ) ; //发货人
data . HUMIDITY = Convert . ToString ( reader [ "HUMIDITY" ] ) ; //发货人
data . TEMPID = Convert . ToString ( reader [ "TEMPID" ] ) ; //发货人
data . TEMPSET = Convert . ToString ( reader [ "TEMPSET" ] ) ; //收货人
data . TEMPMAX = Convert . ToString ( reader [ "TEMPMAX" ] ) ; //发货人
data . TEMPMIN = Convert . ToString ( reader [ "TEMPMIN" ] ) ; //收货人
data . DPAGE = Convert . ToString ( reader [ "DPAGE" ] ) ; //收货人
data . DLABEL = Convert . ToString ( reader [ "DLABEL" ] ) ; //通知人
data . LINKMAN = Convert . ToString ( reader [ "LINKMAN" ] ) ; //发货人
data . HSCODE = Convert . ToString ( reader [ "HSCODE" ] ) ; / /
data . CARGOID = Convert . ToString ( reader [ "CARGOID" ] ) ; / /
data . COPYNOBILL = Convert . ToString ( reader [ "COPYNOBILL" ] ) ; / /
if ( reader [ "INPUTDATE" ] ! = DBNull . Value )
data . INPUTDATE = Convert . ToDateTime ( reader [ "INPUTDATE" ] ) . ToString ( "yyyy-MM-dd HH:mm:ss" ) ; //签单日期
# endregion
headList . Add ( data ) ;
}
reader . Close ( ) ;
}
return headList ;
}
# endregion
#region 权限范围
public static string GetRangDAStr ( string tb , string userid , string username , string companyid )
{
string str = "" ;
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT " ) ;
strSql . Append ( " VISIBLERANGE,OPERATERANGE " ) ;
strSql . Append ( " from VW_User_Authority " ) ;
strSql . Append ( " where [NAME]='modOrderManagement' and USERID='" + userid + "' and ISDELETE=0" ) ;
string visiblerange = "4" ;
string operaterange = "4" ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
visiblerange = Convert . ToString ( reader [ "VISIBLERANGE" ] ) ;
operaterange = Convert . ToString ( reader [ "OPERATERANGE" ] ) ;
break ;
}
reader . Close ( ) ;
}
if ( visiblerange = = "4" )
{
str = "1=2" ;
}
else if ( visiblerange = = "3" )
{
str = " (INPUTBY='" + username + "')" ;
}
else if ( visiblerange = = "2" )
{
if ( tb = = "index" )
{
var rangeDa = new RangeDA ( ) ;
var deptname = rangeDa . GetDEPTNAME ( userid ) ;
var userstr = new StringBuilder ( ) ;
userstr . Append ( " select SHOWNAME from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')" ) ;
Database userdb = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = userdb . ExecuteReader ( CommandType . Text , userstr . ToString ( ) ) )
{
str = "" ;
while ( reader . Read ( ) )
{
if ( str = = "" )
{
str = " (INPUTBY='" + Convert . ToString ( reader [ "SHOWNAME" ] ) + "'" ;
}
else
{
str = str + " or INPUTBY='" + Convert . ToString ( reader [ "SHOWNAME" ] ) + "'" ;
} ;
}
str = str + ")" ;
reader . Close ( ) ;
}
}
else
{
str = " 1=1" ;
}
}
else if ( visiblerange = = "1" )
{
str = " 1=1" ;
}
return str ;
}
# endregion
/ /
}
}