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/EntityDA/CwDesignDA.cs

567 lines
31 KiB
C#

3 years ago
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.DataAccess;
namespace DSWeb.EntityDA
{
public class CwDesignDA
{
public CwDesignDA(){}
#region Method
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(CwDesignEntity model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into cw_design(");
strSql.Append("GID,FSOFTCODE,TVW,CPVW,CRTW,BPVW,BRTW,ISTCOIIED,ISUAPGE,AMCODE,CANAME,SANAME,DANAME,PANAEM,AFFIXNO,ISATTNOTCVVGV,ISATBGV,ISMGSC,ISVBM,ISCLIENTNAME,ISCOTCODE,ISCUSTNO,ISMBLNO,ISVESSEL,ISVOYNO,ISETD,ISRPCLIENTNAME,ISRPCOTCODE,ISRPMBLNO,ISRPCUSTNO,ISRPVESSEL,ISRPVOYNO,ISRPETD,AR,ARFC,AP,APFC,MBINCOME,MBSPENDING,TMFCI,TMSFC,AABWI,AMBS,AMFCI,AMSFC,OTHERR,OTHERP,EGOL,MODIFIEDUSER,MODIFIEDTIME,ISAPMBSPENDING,APMBSPENDING,ISAPTMSFC,APTMSFC,ISSETTLEMENTS,ISSETTLEMENTSOPEN,DR,DRFC,CR,CRFC,ISBILLNO,ISRPBILLNO,ISFILLSERIALNO)");
strSql.Append(" values (");
strSql.Append("@GID,@FSOFTCODE,@TVW,@CPVW,@CRTW,@BPVW,@BRTW,@ISTCOIIED,@ISUAPGE,@AMCODE,@CANAME,@SANAME,@DANAME,@PANAEM,@AFFIXNO,@ISATTNOTCVVGV,@ISATBGV,@ISMGSC,@ISVBM,@ISCLIENTNAME,@ISCOTCODE,@ISCUSTNO,@ISMBLNO,@ISVESSEL,@ISVOYNO,@ISETD,@ISRPCLIENTNAME,@ISRPCOTCODE,@ISRPMBLNO,@ISRPCUSTNO,@ISRPVESSEL,@ISRPVOYNO,@ISRPETD,@AR,@ARFC,@AP,@APFC,@MBINCOME,@MBSPENDING,@TMFCI,@TMSFC,@AABWI,@AMBS,@AMFCI,@AMSFC,@OTHERR,@OTHERP,@EGOL,@MODIFIEDUSER,getdate(),@ISAPMBSPENDING,@APMBSPENDING,@ISAPTMSFC,@APTMSFC,@ISSETTLEMENTS,@ISSETTLEMENTSOPEN,@DR,@DRFC,@CR,@CRFC,@ISBILLNO,@ISRPBILLNO,@ISFILLSERIALNO)");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36),
new SqlParameter("@FSOFTCODE", SqlDbType.Int,4),
new SqlParameter("@TVW", SqlDbType.VarChar,20),
new SqlParameter("@CPVW", SqlDbType.VarChar,20),
new SqlParameter("@CRTW", SqlDbType.VarChar,20),
new SqlParameter("@BPVW", SqlDbType.VarChar,20),
new SqlParameter("@BRTW", SqlDbType.VarChar,20),
new SqlParameter("@ISTCOIIED", SqlDbType.Bit,1),
new SqlParameter("@ISUAPGE", SqlDbType.Bit,1),
new SqlParameter("@AMCODE", SqlDbType.Int,4),
new SqlParameter("@CANAME", SqlDbType.VarChar,20),
new SqlParameter("@SANAME", SqlDbType.VarChar,20),
new SqlParameter("@DANAME", SqlDbType.VarChar,20),
new SqlParameter("@PANAEM", SqlDbType.VarChar,20),
new SqlParameter("@AFFIXNO", SqlDbType.Int,4),
new SqlParameter("@ISATTNOTCVVGV", SqlDbType.Bit,1),
new SqlParameter("@ISATBGV", SqlDbType.Bit,1),
new SqlParameter("@ISMGSC", SqlDbType.Bit,1),
new SqlParameter("@ISVBM", SqlDbType.Bit,1),
new SqlParameter("@ISCLIENTNAME", SqlDbType.Bit,1),
new SqlParameter("@ISCOTCODE", SqlDbType.Bit,1),
new SqlParameter("@ISCUSTNO", SqlDbType.Bit,1),
new SqlParameter("@ISMBLNO", SqlDbType.Bit,1),
new SqlParameter("@ISVESSEL", SqlDbType.Bit,1),
new SqlParameter("@ISVOYNO", SqlDbType.Bit,1),
new SqlParameter("@ISETD", SqlDbType.Bit,1),
new SqlParameter("@ISRPCLIENTNAME", SqlDbType.Bit,1),
new SqlParameter("@ISRPCOTCODE", SqlDbType.Bit,1),
new SqlParameter("@ISRPMBLNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPCUSTNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPVESSEL", SqlDbType.Bit,1),
new SqlParameter("@ISRPVOYNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPETD", SqlDbType.Bit,1),
new SqlParameter("@AR", SqlDbType.VarChar,20),
new SqlParameter("@ARFC", SqlDbType.VarChar,20),
new SqlParameter("@AP", SqlDbType.VarChar,20),
new SqlParameter("@APFC", SqlDbType.VarChar,20),
new SqlParameter("@MBINCOME", SqlDbType.VarChar,20),
new SqlParameter("@MBSPENDING", SqlDbType.VarChar,20),
new SqlParameter("@TMFCI", SqlDbType.VarChar,20),
new SqlParameter("@TMSFC", SqlDbType.VarChar,20),
new SqlParameter("@AABWI", SqlDbType.VarChar,20),
new SqlParameter("@AMBS", SqlDbType.VarChar,20),
new SqlParameter("@AMFCI", SqlDbType.VarChar,20),
new SqlParameter("@AMSFC", SqlDbType.VarChar,20),
new SqlParameter("@OTHERR", SqlDbType.VarChar,20),
new SqlParameter("@OTHERP", SqlDbType.VarChar,20),
new SqlParameter("@EGOL", SqlDbType.VarChar,20),
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36),
new SqlParameter("@ISAPMBSPENDING", SqlDbType.Bit,1),
new SqlParameter("@APMBSPENDING", SqlDbType.VarChar,20),
new SqlParameter("@ISAPTMSFC", SqlDbType.Bit,1),
new SqlParameter("@APTMSFC", SqlDbType.VarChar,20),
new SqlParameter("@ISSETTLEMENTS", SqlDbType.Bit,1),
new SqlParameter("@ISSETTLEMENTSOPEN", SqlDbType.Bit,1),
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
new SqlParameter("@DR", SqlDbType.VarChar,20) ,
new SqlParameter("@DRFC", SqlDbType.VarChar,20) ,
new SqlParameter("@CR", SqlDbType.VarChar,20) ,
new SqlParameter("@CRFC", SqlDbType.VarChar,20),
new SqlParameter("@ISBILLNO", SqlDbType.Bit,1) ,
new SqlParameter("@ISRPBILLNO", SqlDbType.Bit,1),
new SqlParameter("@ISFILLSERIALNO", SqlDbType.Bit,1)
//new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime)
};
parameters[0].Value = model.GID;
parameters[1].Value = model.FSOFTCODE;
parameters[2].Value = model.TVW;
parameters[3].Value = model.CPVW;
parameters[4].Value = model.CRTW;
parameters[5].Value = model.BPVW;
parameters[6].Value = model.BRTW;
parameters[7].Value = model.ISTCOIIED;
parameters[8].Value = model.ISUAPGE;
parameters[9].Value = model.AMCODE;
parameters[10].Value = model.CANAME;
parameters[11].Value = model.SANAME;
parameters[12].Value = model.DANAME;
parameters[13].Value = model.PANAEM;
parameters[14].Value = model.AFFIXNO;
parameters[15].Value = model.ISATTNOTCVVGV;
parameters[16].Value = model.ISATBGV;
parameters[17].Value = model.ISMGSC;
parameters[18].Value = model.ISVBM;
parameters[19].Value = model.ISCLIENTNAME;
parameters[20].Value = model.ISCOTCODE;
parameters[21].Value = model.ISCUSTNO;
parameters[22].Value = model.ISMBLNO;
parameters[23].Value = model.ISVESSEL;
parameters[24].Value = model.ISVOYNO;
parameters[25].Value = model.ISETD;
parameters[26].Value = model.ISRPCLIENTNAME;
parameters[27].Value = model.ISRPCOTCODE;
parameters[28].Value = model.ISRPMBLNO;
parameters[29].Value = model.ISRPCUSTNO;
parameters[30].Value = model.ISRPVESSEL;
parameters[31].Value = model.ISRPVOYNO;
parameters[32].Value = model.ISRPETD;
parameters[33].Value = model.AR;
parameters[34].Value = model.ARFC;
parameters[35].Value = model.AP;
parameters[36].Value = model.APFC;
parameters[37].Value = model.MBINCOME;
parameters[38].Value = model.MBSPENDING;
parameters[39].Value = model.TMFCI;
parameters[40].Value = model.TMSFC;
parameters[41].Value = model.AABWI;
parameters[42].Value = model.AMBS;
parameters[43].Value = model.AMFCI;
parameters[44].Value = model.AMSFC;
parameters[45].Value = model.OTHERR;
parameters[46].Value = model.OTHERP;
parameters[47].Value = model.EGOL;
parameters[48].Value = model.MODIFIEDUSER;
parameters[49].Value = model.ISAPMBSPENDING;
parameters[50].Value = model.APMBSPENDING;
parameters[51].Value = model.ISAPTMSFC;
parameters[52].Value = model.APTMSFC;
parameters[53].Value = model.ISSETTLEMENTS;
parameters[54].Value = model.ISSETTLEMENTSOPEN;
parameters[55].Value = model.DR;
parameters[56].Value = model.DRFC;
parameters[57].Value = model.CR;
parameters[58].Value = model.CRFC;
parameters[59].Value = model.ISBILLNO;
parameters[60].Value = model.ISRPBILLNO;
parameters[61].Value = model.ISFILLSERIALNO;
//parameters[49].Value = model.MODIFIEDTIME;
//
int iResult = 0;
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters);
if (existVal > 0)
{
iResult = 1;
//
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('更新op_seai海运业务信息表','更新操作','BSNO=" + infoEntity.BSNO + "','" + model.MODIFIEDUSER.ToString() + "')";
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(CwDesignEntity model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("update cw_design set ");
strSql.Append("FSOFTCODE=@FSOFTCODE,");
strSql.Append("TVW=@TVW,");
strSql.Append("CPVW=@CPVW,");
strSql.Append("CRTW=@CRTW,");
strSql.Append("BPVW=@BPVW,");
strSql.Append("BRTW=@BRTW,");
strSql.Append("ISTCOIIED=@ISTCOIIED,");
strSql.Append("ISUAPGE=@ISUAPGE,");
strSql.Append("AMCODE=@AMCODE,");
strSql.Append("CANAME=@CANAME,");
strSql.Append("SANAME=@SANAME,");
strSql.Append("DANAME=@DANAME,");
strSql.Append("PANAEM=@PANAEM,");
strSql.Append("AFFIXNO=@AFFIXNO,");
strSql.Append("ISATTNOTCVVGV=@ISATTNOTCVVGV,");
strSql.Append("ISATBGV=@ISATBGV,");
strSql.Append("ISMGSC=@ISMGSC,");
strSql.Append("ISVBM=@ISVBM,");
strSql.Append("ISCLIENTNAME=@ISCLIENTNAME,");
strSql.Append("ISCOTCODE=@ISCOTCODE,");
strSql.Append("ISCUSTNO=@ISCUSTNO,");
strSql.Append("ISMBLNO=@ISMBLNO,");
strSql.Append("ISVESSEL=@ISVESSEL,");
strSql.Append("ISVOYNO=@ISVOYNO,");
strSql.Append("ISETD=@ISETD,");
strSql.Append("ISRPCLIENTNAME=@ISRPCLIENTNAME,");
strSql.Append("ISRPCOTCODE=@ISRPCOTCODE,");
strSql.Append("ISRPMBLNO=@ISRPMBLNO,");
strSql.Append("ISRPCUSTNO=@ISRPCUSTNO,");
strSql.Append("ISRPVESSEL=@ISRPVESSEL,");
strSql.Append("ISRPVOYNO=@ISRPVOYNO,");
strSql.Append("ISRPETD=@ISRPETD,");
strSql.Append("AR=@AR,");
strSql.Append("ARFC=@ARFC,");
strSql.Append("AP=@AP,");
strSql.Append("APFC=@APFC,");
strSql.Append("MBINCOME=@MBINCOME,");
strSql.Append("MBSPENDING=@MBSPENDING,");
strSql.Append("TMFCI=@TMFCI,");
strSql.Append("TMSFC=@TMSFC,");
strSql.Append("AABWI=@AABWI,");
strSql.Append("AMBS=@AMBS,");
strSql.Append("AMFCI=@AMFCI,");
strSql.Append("AMSFC=@AMSFC,");
strSql.Append("OTHERR=@OTHERR,");
strSql.Append("OTHERP=@OTHERP,");
strSql.Append("EGOL=@EGOL,");
strSql.Append("MODIFIEDUSER=@MODIFIEDUSER,");
strSql.Append("MODIFIEDTIME=getdate(),");
strSql.Append("ISAPMBSPENDING=@ISAPMBSPENDING,");
strSql.Append("APMBSPENDING=@APMBSPENDING,");
strSql.Append("ISAPTMSFC=@ISAPTMSFC,");
strSql.Append("APTMSFC=@APTMSFC,");
strSql.Append("ISSETTLEMENTS=@ISSETTLEMENTS, ");
strSql.Append("ISSETTLEMENTSOPEN=@ISSETTLEMENTSOPEN, ");
strSql.Append(" DR = @DR , ");
strSql.Append(" DRFC = @DRFC , ");
strSql.Append(" CR = @CR , ");
strSql.Append(" CRFC = @CRFC, ");
strSql.Append(" ISBILLNO = @ISBILLNO , ");
strSql.Append(" ISRPBILLNO = @ISRPBILLNO , ");
strSql.Append(" ISFILLSERIALNO = @ISFILLSERIALNO ");
strSql.Append(" where GID = @GID ");
SqlParameter[] parameters = {
new SqlParameter("@FSOFTCODE", SqlDbType.Int,4),
new SqlParameter("@TVW", SqlDbType.VarChar,20),
new SqlParameter("@CPVW", SqlDbType.VarChar,20),
new SqlParameter("@CRTW", SqlDbType.VarChar,20),
new SqlParameter("@BPVW", SqlDbType.VarChar,20),
new SqlParameter("@BRTW", SqlDbType.VarChar,20),
new SqlParameter("@ISTCOIIED", SqlDbType.Bit,1),
new SqlParameter("@ISUAPGE", SqlDbType.Bit,1),
new SqlParameter("@AMCODE", SqlDbType.Int,4),
new SqlParameter("@CANAME", SqlDbType.VarChar,20),
new SqlParameter("@SANAME", SqlDbType.VarChar,20),
new SqlParameter("@DANAME", SqlDbType.VarChar,20),
new SqlParameter("@PANAEM", SqlDbType.VarChar,20),
new SqlParameter("@AFFIXNO", SqlDbType.Int,4),
new SqlParameter("@ISATTNOTCVVGV", SqlDbType.Bit,1),
new SqlParameter("@ISATBGV", SqlDbType.Bit,1),
new SqlParameter("@ISMGSC", SqlDbType.Bit,1),
new SqlParameter("@ISVBM", SqlDbType.Bit,1),
new SqlParameter("@ISCLIENTNAME", SqlDbType.Bit,1),
new SqlParameter("@ISCOTCODE", SqlDbType.Bit,1),
new SqlParameter("@ISCUSTNO", SqlDbType.Bit,1),
new SqlParameter("@ISMBLNO", SqlDbType.Bit,1),
new SqlParameter("@ISVESSEL", SqlDbType.Bit,1),
new SqlParameter("@ISVOYNO", SqlDbType.Bit,1),
new SqlParameter("@ISETD", SqlDbType.Bit,1),
new SqlParameter("@ISRPCLIENTNAME", SqlDbType.Bit,1),
new SqlParameter("@ISRPCOTCODE", SqlDbType.Bit,1),
new SqlParameter("@ISRPMBLNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPCUSTNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPVESSEL", SqlDbType.Bit,1),
new SqlParameter("@ISRPVOYNO", SqlDbType.Bit,1),
new SqlParameter("@ISRPETD", SqlDbType.Bit,1),
new SqlParameter("@AR", SqlDbType.VarChar,20),
new SqlParameter("@ARFC", SqlDbType.VarChar,20),
new SqlParameter("@AP", SqlDbType.VarChar,20),
new SqlParameter("@APFC", SqlDbType.VarChar,20),
new SqlParameter("@MBINCOME", SqlDbType.VarChar,20),
new SqlParameter("@MBSPENDING", SqlDbType.VarChar,20),
new SqlParameter("@TMFCI", SqlDbType.VarChar,20),
new SqlParameter("@TMSFC", SqlDbType.VarChar,20),
new SqlParameter("@AABWI", SqlDbType.VarChar,20),
new SqlParameter("@AMBS", SqlDbType.VarChar,20),
new SqlParameter("@AMFCI", SqlDbType.VarChar,20),
new SqlParameter("@AMSFC", SqlDbType.VarChar,20),
new SqlParameter("@OTHERR", SqlDbType.VarChar,20),
new SqlParameter("@OTHERP", SqlDbType.VarChar,20),
new SqlParameter("@EGOL", SqlDbType.VarChar,20),
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36),
//new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime),
new SqlParameter("@GID", SqlDbType.VarChar,36),
new SqlParameter("@ISAPMBSPENDING", SqlDbType.Bit,1),
new SqlParameter("@APMBSPENDING", SqlDbType.VarChar,20),
new SqlParameter("@ISAPTMSFC", SqlDbType.Bit,1),
new SqlParameter("@APTMSFC", SqlDbType.VarChar,20),
new SqlParameter("@ISSETTLEMENTS", SqlDbType.Bit,1),
new SqlParameter("@ISSETTLEMENTSOPEN", SqlDbType.Bit,1),
new SqlParameter("@DR", SqlDbType.VarChar,20) ,
new SqlParameter("@DRFC", SqlDbType.VarChar,20) ,
new SqlParameter("@CR", SqlDbType.VarChar,20) ,
new SqlParameter("@CRFC", SqlDbType.VarChar,20) ,
new SqlParameter("@ISBILLNO", SqlDbType.Bit,1) ,
new SqlParameter("@ISRPBILLNO", SqlDbType.Bit,1) ,
new SqlParameter("@ISFILLSERIALNO", SqlDbType.Bit,1)
};
parameters[0].Value = model.FSOFTCODE;
parameters[1].Value = model.TVW;
parameters[2].Value = model.CPVW;
parameters[3].Value = model.CRTW;
parameters[4].Value = model.BPVW;
parameters[5].Value = model.BRTW;
parameters[6].Value = model.ISTCOIIED;
parameters[7].Value = model.ISUAPGE;
parameters[8].Value = model.AMCODE;
parameters[9].Value = model.CANAME;
parameters[10].Value = model.SANAME;
parameters[11].Value = model.DANAME;
parameters[12].Value = model.PANAEM;
parameters[13].Value = model.AFFIXNO;
parameters[14].Value = model.ISATTNOTCVVGV;
parameters[15].Value = model.ISATBGV;
parameters[16].Value = model.ISMGSC;
parameters[17].Value = model.ISVBM;
parameters[18].Value = model.ISCLIENTNAME;
parameters[19].Value = model.ISCOTCODE;
parameters[20].Value = model.ISCUSTNO;
parameters[21].Value = model.ISMBLNO;
parameters[22].Value = model.ISVESSEL;
parameters[23].Value = model.ISVOYNO;
parameters[24].Value = model.ISETD;
parameters[25].Value = model.ISRPCLIENTNAME;
parameters[26].Value = model.ISRPCOTCODE;
parameters[27].Value = model.ISRPMBLNO;
parameters[28].Value = model.ISRPCUSTNO;
parameters[29].Value = model.ISRPVESSEL;
parameters[30].Value = model.ISRPVOYNO;
parameters[31].Value = model.ISRPETD;
parameters[32].Value = model.AR;
parameters[33].Value = model.ARFC;
parameters[34].Value = model.AP;
parameters[35].Value = model.APFC;
parameters[36].Value = model.MBINCOME;
parameters[37].Value = model.MBSPENDING;
parameters[38].Value = model.TMFCI;
parameters[39].Value = model.TMSFC;
parameters[40].Value = model.AABWI;
parameters[41].Value = model.AMBS;
parameters[42].Value = model.AMFCI;
parameters[43].Value = model.AMSFC;
parameters[44].Value = model.OTHERR;
parameters[45].Value = model.OTHERP;
parameters[46].Value = model.EGOL;
parameters[47].Value = model.MODIFIEDUSER;
//parameters[48].Value = model.MODIFIEDTIME;
parameters[48].Value = model.GID;
parameters[49].Value = model.ISAPMBSPENDING;
parameters[50].Value = model.APMBSPENDING;
parameters[51].Value = model.ISAPTMSFC;
parameters[52].Value = model.APTMSFC;
parameters[53].Value = model.ISSETTLEMENTS;
parameters[54].Value = model.ISSETTLEMENTSOPEN;
parameters[55].Value = model.DR;
parameters[56].Value = model.DRFC;
parameters[57].Value = model.CR;
parameters[58].Value = model.CRFC;
parameters[59].Value = model.ISBILLNO;
parameters[60].Value = model.ISRPBILLNO;
parameters[61].Value = model.ISFILLSERIALNO;
//
int iResult = 0;
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters);
if (existVal > 0)
{
iResult = 1;
//
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('更新op_seai海运业务信息表','更新操作','BSNO=" + infoEntity.BSNO + "','" + strUserID + "')";
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
/// <summary>
/// 删除一条数据
/// </summary>
public int Delete(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from cw_design ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) };
parameters[0].Value = GID;
//
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters);
iResult = 1;//状态为1表示删除成功
sqlTran.Commit();
}
catch (Exception execError)
{
iResult = -1;//有异常,删除失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
/// <summary>
/// 批量删除数据
/// </summary>
public bool DeleteList(string selGID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from cw_design ");
strSql.Append(" where 1<0 " + selGID);
bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, strSql.ToString());
return bl;
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public CwDesignEntity GetModel(string GID)
{
//初始化返回变量
CwDesignEntity model = null;
//初始化参数并赋值
StringBuilder strSql=new StringBuilder();
strSql.Append("select top 1 GID,FSOFTCODE,TVW,CPVW,CRTW,BPVW,BRTW,ISTCOIIED,ISUAPGE,AMCODE,CANAME,SANAME,DANAME,PANAEM,AFFIXNO,ISATTNOTCVVGV,ISATBGV,ISMGSC,ISVBM,ISCLIENTNAME,ISCOTCODE,ISCUSTNO,ISMBLNO,ISVESSEL,ISVOYNO,ISETD,ISRPCLIENTNAME,ISRPCOTCODE,ISRPMBLNO,ISRPCUSTNO,ISRPVESSEL,ISRPVOYNO,ISRPETD,AR,ARFC,AP,APFC,MBINCOME,MBSPENDING,TMFCI,TMSFC,AABWI,AMBS,AMFCI,AMSFC,OTHERR,OTHERP,EGOL,MODIFIEDUSER,MODIFIEDTIME,ISAPMBSPENDING,APMBSPENDING,ISAPTMSFC,APTMSFC,ISSETTLEMENTS,ISSETTLEMENTSOPEN,DR,DRFC,CR,CRFC,ISBILLNO,ISRPBILLNO,ISFILLSERIALNO from cw_design where GID=@GID ");
SqlParameter[] parameters = {new SqlParameter("@GID", SqlDbType.VarChar,36)};
parameters[0].Value = GID;
//
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), parameters))
{
try
{
model = new CwDesignEntity();
//读取字段值
while (sqlRead.Read())
{
if (!sqlRead.IsDBNull(0)) { model.GID = sqlRead.GetString(0); } // 唯一编码 NEWID()
if (!sqlRead.IsDBNull(1)) { model.FSOFTCODE = sqlRead.GetInt32(1); } // 财务软件编码
if (!sqlRead.IsDBNull(2)) { model.TVW = sqlRead.GetString(2); } // 转帐凭证字 Transfer voucher word
if (!sqlRead.IsDBNull(3)) { model.CPVW = sqlRead.GetString(3); } // 现金付款凭证字 Cash payment voucher word
if (!sqlRead.IsDBNull(4)) { model.CRTW = sqlRead.GetString(4); } // 现金收款凭证字 Cash receipts to word
if (!sqlRead.IsDBNull(5)) { model.BPVW = sqlRead.GetString(5); } // 银行付款凭证字 Bank payment voucher word
if (!sqlRead.IsDBNull(6)) { model.BRTW = sqlRead.GetString(6); } // 银行收款凭证字 Bank receipts to word
if (!sqlRead.IsDBNull(7)) { model.ISTCOIIED = sqlRead.GetBoolean(7); } // 收入成本是否核算美元 The cost of income is economical dollars
if (!sqlRead.IsDBNull(8)) { model.ISUAPGE = sqlRead.GetBoolean(8); } // 使用核算项目生成分录 Use accounting projects generate entries
if (!sqlRead.IsDBNull(9)) { model.AMCODE = sqlRead.GetInt32(9); } // 核算办法 ACCOUNTE METHOD CODE
if (!sqlRead.IsDBNull(10)) { model.CANAME = sqlRead.GetString(10); } // 客户核算名称 Customer accounting name
if (!sqlRead.IsDBNull(11)) { model.SANAME = sqlRead.GetString(11); } // 供应商核算名称Supplier accounting name
if (!sqlRead.IsDBNull(12)) { model.DANAME = sqlRead.GetString(12); } // 部门核算名称 Department accounting name
if (!sqlRead.IsDBNull(13)) { model.PANAEM = sqlRead.GetString(13); } // 人员核算名称 Personnel accounting name
if (!sqlRead.IsDBNull(14)) { model.AFFIXNO = sqlRead.GetInt32(14); } // 附件数量
if (!sqlRead.IsDBNull(15)) { model.ISATTNOTCVVGV = sqlRead.GetBoolean(15); } // 根据船名航次生成凭证 According to the name of the carrying vessel voyage generation vouchers
if (!sqlRead.IsDBNull(16)) { model.ISATBGV = sqlRead.GetBoolean(16); } // 根据帐单生成凭证 According to bill generation vouchers
if (!sqlRead.IsDBNull(17)) { model.ISMGSC = sqlRead.GetBoolean(17); } // 合并生成结算凭证 Merger generation settlement certificates
if (!sqlRead.IsDBNull(18)) { model.ISVBM = sqlRead.GetBoolean(18); } // 凭证禁止修改 Vouchers banned modify
if (!sqlRead.IsDBNull(19)) { model.ISCLIENTNAME = sqlRead.GetBoolean(19); } // 是否客户名称
if (!sqlRead.IsDBNull(20)) { model.ISCOTCODE = sqlRead.GetBoolean(20); } // 是否业务编号
if (!sqlRead.IsDBNull(21)) { model.ISCUSTNO = sqlRead.GetBoolean(21); } // 是否委托编号
if (!sqlRead.IsDBNull(22)) { model.ISMBLNO = sqlRead.GetBoolean(22); } // 是否主提单号
if (!sqlRead.IsDBNull(23)) { model.ISVESSEL = sqlRead.GetBoolean(23); } // 是否船名
if (!sqlRead.IsDBNull(24)) { model.ISVOYNO = sqlRead.GetBoolean(24); } // 是否航次
if (!sqlRead.IsDBNull(25)) { model.ISETD = sqlRead.GetBoolean(25); } // 是否航期
if (!sqlRead.IsDBNull(26)) { model.ISRPCLIENTNAME = sqlRead.GetBoolean(26); } // 是否收付客户名称
if (!sqlRead.IsDBNull(27)) { model.ISRPCOTCODE = sqlRead.GetBoolean(27); } // 是否收付业务编号
if (!sqlRead.IsDBNull(28)) { model.ISRPMBLNO = sqlRead.GetBoolean(28); } // 是否收付主提单号
if (!sqlRead.IsDBNull(29)) { model.ISRPCUSTNO = sqlRead.GetBoolean(29); } // 是否收付委托编号
if (!sqlRead.IsDBNull(30)) { model.ISRPVESSEL = sqlRead.GetBoolean(30); } // 是否收付船名
if (!sqlRead.IsDBNull(31)) { model.ISRPVOYNO = sqlRead.GetBoolean(31); } // 是否收付航次
if (!sqlRead.IsDBNull(32)) { model.ISRPETD = sqlRead.GetBoolean(32); } // 是否收付航期
if (!sqlRead.IsDBNull(33)) { model.AR = sqlRead.GetString(33); } // 应收账款 account receivable
if (!sqlRead.IsDBNull(34)) { model.ARFC = sqlRead.GetString(34); } // 应收账款外币 Accounts receivable foreign currency
if (!sqlRead.IsDBNull(35)) { model.AP = sqlRead.GetString(35); } // 应付账款 account payable
if (!sqlRead.IsDBNull(36)) { model.APFC = sqlRead.GetString(36); } // 应付账款外币 Accounts payable foreign currency
if (!sqlRead.IsDBNull(37)) { model.MBINCOME = sqlRead.GetString(37); } // 主营业务收入 main business income
if (!sqlRead.IsDBNull(38)) { model.MBSPENDING = sqlRead.GetString(38); } // 主营业务支出 Main business spending
if (!sqlRead.IsDBNull(39)) { model.TMFCI = sqlRead.GetString(39); } // 主营收入外币 The main foreign currency income
if (!sqlRead.IsDBNull(40)) { model.TMSFC = sqlRead.GetString(40); } // 主营支出外币 The main spending foreign currency
if (!sqlRead.IsDBNull(41)) { model.AABWI = sqlRead.GetString(41); } // 空运主营业务收入 Air advocate business wu income
if (!sqlRead.IsDBNull(42)) { model.AMBS = sqlRead.GetString(42); } // 空运主营业务支出 Air's main business spending
if (!sqlRead.IsDBNull(43)) { model.AMFCI = sqlRead.GetString(43); } // 空运主营收入外币 Air's main foreign currency income
if (!sqlRead.IsDBNull(44)) { model.AMSFC = sqlRead.GetString(44); } // 空运主营支出外币 Air's main spending foreign currency
if (!sqlRead.IsDBNull(45)) { model.OTHERR = sqlRead.GetString(45); } // 其他应收 Other Receivables
if (!sqlRead.IsDBNull(46)) { model.OTHERP = sqlRead.GetString(46); } // 其他应付 Other payables
if (!sqlRead.IsDBNull(47)) { model.EGOL = sqlRead.GetString(47); } // 汇兑损益 exchange gain or loss
if (!sqlRead.IsDBNull(48)) { model.MODIFIEDUSER = sqlRead.GetString(48); } // 最后一次更新操作人
if (!sqlRead.IsDBNull(49)) { model.MODIFIEDTIME = sqlRead.GetDateTime(49); } // 最后一次更新操作时间
if (!sqlRead.IsDBNull(50)) { model.ISAPMBSPENDING = sqlRead.GetBoolean(50); } // 是否默认付费结算借方科目代码
if (!sqlRead.IsDBNull(51)) { model.APMBSPENDING = sqlRead.GetString(51); } // 付费结算借方默认科目代码
if (!sqlRead.IsDBNull(52)) { model.ISAPTMSFC = sqlRead.GetBoolean(52); } // 是否默认付费结算外币借方科目代码
if (!sqlRead.IsDBNull(53)) { model.APTMSFC = sqlRead.GetString(53); } // 付费结算外币借方默认科目代码
if (!sqlRead.IsDBNull(54)) { model.ISSETTLEMENTS = sqlRead.GetBoolean(54); }
if (!sqlRead.IsDBNull(55)) { model.ISSETTLEMENTSOPEN = sqlRead.GetBoolean(55); }
if (!sqlRead.IsDBNull(56)) { model.DR = sqlRead.GetString(56); }
if (!sqlRead.IsDBNull(57)) { model.DRFC = sqlRead.GetString(57); }
if (!sqlRead.IsDBNull(58)) { model.CR = sqlRead.GetString(58); }
if (!sqlRead.IsDBNull(59)) { model.CRFC = sqlRead.GetString(59); }
if (!sqlRead.IsDBNull(60)) { model.ISBILLNO = sqlRead.GetBoolean(60); } // 是否申请单号
if (!sqlRead.IsDBNull(61)) { model.ISRPBILLNO = sqlRead.GetBoolean(61); } // 是否收付申请单号
if (!sqlRead.IsDBNull(62)) { model.ISFILLSERIALNO = sqlRead.GetBoolean(62); } // 是否收付申请单号
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return model;
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select GID,FSOFTCODE,TVW,CPVW,CRTW,BPVW,BRTW,ISTCOIIED,ISUAPGE,AMCODE,CANAME,SANAME,DANAME,PANAEM,AFFIXNO,ISATTNOTCVVGV,ISATBGV,ISMGSC,ISVBM,ISCLIENTNAME,ISCOTCODE,ISCUSTNO,ISMBLNO,ISVESSEL,ISVOYNO,ISETD,ISRPCLIENTNAME,ISRPCOTCODE,ISRPMBLNO,ISRPCUSTNO,ISRPVESSEL,ISRPVOYNO,ISRPETD,AR,ARFC,AP,APFC,MBINCOME,MBSPENDING,TMFCI,TMSFC,AABWI,AMBS,AMFCI,AMSFC,OTHERR,OTHERP,EGOL,MODIFIEDUSER,MODIFIEDTIME,ISAPMBSPENDING,APMBSPENDING,ISAPTMSFC,APTMSFC,ISSETTLEMENTS,ISSETTLEMENTSOPEN,DR,DRFC,CR,CRFC,ISBILLNO,ISRPBILLNO,ISFILLSERIALNO ");
strSql.Append(" FROM cw_design ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
//
DataSet DS = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, strSql.ToString());
try
{
if (DS.Tables[0].Rows.Count <= 0)
{
DS = null;
}
}
catch
{
DS = null;
}
return DS;
}
#endregion Method
}
}