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/ChFeeChequeDA.cs

617 lines
36 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DSWeb.DataAccess;
using DSWeb.Models;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace DSWeb.EntityDA
{
public class ChFeeChequeDA
{
private const string PARM_MODULE_GID = "@GID";
private const string SQL_SELECT_INFO = "select GID,CHEQUENO,BILLNO,PAYSETTLEBILLNO,CUSTOMERNAME,CHEQUECUSTNAME,CHEQUEMAKETIME,MAKETIMEUPPER,YEAR,MONTH,DAY,YEARUPPER,MONTHUPPER,DAYUPPER,PURPOSE,PASSWORD,CHEQUECURRENCY,CHEQUETYPE,CHEQUEAMOUNT,CHEQUEAMOUNTUPPER,BAIYI,SHIYI,YI,QIANWAN,BAIWAN,SHIWAN,WAN,QIAN,BAI,SHI,YUAN,JIAO,FEN,UNIT,ISDELETE,DELETEOPERATOR,DELETECAUSE,DELETETIME,ISPRINT,PAYBANK,PAYBANKACCOUNT,PAYEEBANK,PAYEEBANKACCOUNT,PAYEEADR,ISAUDIT,AUDITOPERATOR,AUDITDATE,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME from ch_fee_cheque where GID=@GID";
private const string SQL_DELETE_INFO = "DELETE FROM ch_fee_cheque WHERE GID = @GID";
private string strSql = "insert into ch_fee_cheque(GID,CHEQUENO,BILLNO,PAYSETTLEBILLNO,CUSTOMERNAME,CHEQUECUSTNAME,{0}MAKETIMEUPPER,[YEAR],[MONTH],[DAY],YEARUPPER,MONTHUPPER,DAYUPPER,PURPOSE,PASSWORD,CHEQUECURRENCY,CHEQUETYPE,CHEQUEAMOUNT,CHEQUEAMOUNTUPPER,BAIYI,SHIYI,YI,QIANWAN,BAIWAN,SHIWAN,WAN,QIAN,BAI,SHI,YUAN,JIAO,FEN,UNIT,ISDELETE,DELETEOPERATOR,DELETECAUSE,{2}ISPRINT,PAYBANK,PAYBANKACCOUNT,PAYEEBANK,PAYEEBANKACCOUNT,PAYEEADR,ISAUDIT,AUDITOPERATOR,{4}CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME) "
+ " values(@GID,@CHEQUENO,@BILLNO,@PAYSETTLEBILLNO,@CUSTOMERNAME,@CHEQUECUSTNAME,{1}@MAKETIMEUPPER,@YEAR,@MONTH,@DAY,@YEARUPPER,@MONTHUPPER,@DAYUPPER,@PURPOSE,@PASSWORD,@CHEQUECURRENCY,@CHEQUETYPE,@CHEQUEAMOUNT,@CHEQUEAMOUNTUPPER,@BAIYI,@SHIYI,@YI,@QIANWAN,@BAIWAN,@SHIWAN,@WAN,@QIAN,@BAI,@SHI,@YUAN,@JIAO,@FEN,@UNIT,@ISDELETE,@DELETEOPERATOR,@DELETECAUSE,{3}@ISPRINT,@PAYBANK,@PAYBANKACCOUNT,@PAYEEBANK,@PAYEEBANKACCOUNT,@PAYEEADR,@ISAUDIT,@AUDITOPERATOR,{5}@CREATEUSER,getdate(),@MODIFIEDUSER,getdate())";//@BSDATE
private string strSqlUpdateInfo = "update ch_fee_cheque set CUSTOMERNAME=@CUSTOMERNAME,CHEQUECUSTNAME=@CHEQUECUSTNAME,{0}{1}MAKETIMEUPPER=@MAKETIMEUPPER,[YEAR]=@YEAR,[MONTH]=@MONTH,[DAY]=@DAY,YEARUPPER=@YEARUPPER,MONTHUPPER=@MONTHUPPER,DAYUPPER=@DAYUPPER,PURPOSE=@PURPOSE,PASSWORD=@PASSWORD,CHEQUECURRENCY=@CHEQUECURRENCY,CHEQUETYPE=@CHEQUETYPE,CHEQUEAMOUNT=@CHEQUEAMOUNT,CHEQUEAMOUNTUPPER=@CHEQUEAMOUNTUPPER,BAIYI=@BAIYI,SHIYI=@SHIYI,YI=@YI,QIANWAN=@QIANWAN,BAIWAN=@BAIWAN,SHIWAN=@SHIWAN,WAN=@WAN,QIAN=@QIAN,BAI=@BAI,SHI=@SHI,YUAN=@YUAN,JIAO=@JIAO,FEN=@FEN,UNIT=@UNIT,PAYBANK=@PAYBANK,PAYBANKACCOUNT=@PAYBANKACCOUNT,PAYEEBANK=@PAYEEBANK,PAYEEBANKACCOUNT=@PAYEEBANKACCOUNT,PAYEEADR=@PAYEEADR,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=getdate() where GID=@GID";
public ChFeeChequeDA()
{
}
#region 根据GID获取信息
/// <summary>
/// 根据GID获取信息
/// </summary>
/// <param name="strRoleGID"></param>
/// <returns></returns>
public ChFeeChequeEntity GetID(string strGID)
{
//初始化返回变量
ChFeeChequeEntity ChFeeChequeEntity = null;
//初始化参数并赋值
SqlParameter parm = new SqlParameter(PARM_MODULE_GID, SqlDbType.VarChar, 36);
parm.Value = strGID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO, parm))
{
try
{
ChFeeChequeEntity = new ChFeeChequeEntity();
//读取字段值
while (sqlRead.Read())
{
if (!sqlRead.IsDBNull(0)){ChFeeChequeEntity.GID=sqlRead.GetString(0); }// 惟一编号 "
if (!sqlRead.IsDBNull(1)){ChFeeChequeEntity.CHEQUENO=sqlRead.GetString(1);}// 支票号码"
if (!sqlRead.IsDBNull(2)){ChFeeChequeEntity.BILLNO=sqlRead.GetString(2);}// 申请编号"
if (!sqlRead.IsDBNull(3)){ChFeeChequeEntity.PAYSETTLEBILLNO=sqlRead.GetString(3);}// 付费结算编号"
if (!sqlRead.IsDBNull(4)){ChFeeChequeEntity.CUSTOMERNAME=sqlRead.GetString(4);}// 客户名称"
if (!sqlRead.IsDBNull(5)){ChFeeChequeEntity.CHEQUECUSTNAME=sqlRead.GetString(5);}// 支票抬头/收款单位"
if (!sqlRead.IsDBNull(6)){ChFeeChequeEntity.CHEQUEMAKETIME=sqlRead.GetDateTime(6); }// 出票日期"
if (!sqlRead.IsDBNull(7)){ChFeeChequeEntity.MAKETIMEUPPER=sqlRead.GetString(7); }// 出票日期中文大写"
if (!sqlRead.IsDBNull(8)){ChFeeChequeEntity.YEAR=sqlRead.GetString(8);}// 年"
if (!sqlRead.IsDBNull(9)){ChFeeChequeEntity.MONTH=sqlRead.GetString(9);}// 月"
if (!sqlRead.IsDBNull(10)){ChFeeChequeEntity.DAY=sqlRead.GetString(10);}// 日"
if (!sqlRead.IsDBNull(11)){ChFeeChequeEntity.YEARUPPER=sqlRead.GetString(11);}// 年大写"
if (!sqlRead.IsDBNull(12)){ChFeeChequeEntity.MONTHUPPER=sqlRead.GetString(12);}// 月大写"
if (!sqlRead.IsDBNull(13)){ChFeeChequeEntity.DAYUPPER=sqlRead.GetString(13);}// 日大写"
if (!sqlRead.IsDBNull(14)){ChFeeChequeEntity.PURPOSE=sqlRead.GetString(14);}// 用途"
if (!sqlRead.IsDBNull(15)){ChFeeChequeEntity.PASSWORD=sqlRead.GetString(15);}// 密码"
if (!sqlRead.IsDBNull(16)){ChFeeChequeEntity.CHEQUECURRENCY=sqlRead.GetString(16);}// 支票币别"
if (!sqlRead.IsDBNull(17)){ChFeeChequeEntity.CHEQUETYPE=sqlRead.GetInt32(17); }// 支票类别"
if (!sqlRead.IsDBNull(18)){ChFeeChequeEntity.CHEQUEAMOUNT=sqlRead.GetDecimal(18); }// 支票金额"
if (!sqlRead.IsDBNull(19)){ChFeeChequeEntity.CHEQUEAMOUNTUPPER=sqlRead.GetString(19); }// 支票金额大写"
if (!sqlRead.IsDBNull(20)){ChFeeChequeEntity.BAIYI=sqlRead.GetString(20);}// 百亿"
if (!sqlRead.IsDBNull(21)){ChFeeChequeEntity.SHIYI=sqlRead.GetString(21);}// 十亿"
if (!sqlRead.IsDBNull(22)){ChFeeChequeEntity.YI=sqlRead.GetString(22);}// 亿"
if (!sqlRead.IsDBNull(23)){ChFeeChequeEntity.QIANWAN=sqlRead.GetString(23);}// 千万"
if (!sqlRead.IsDBNull(24)){ChFeeChequeEntity.BAIWAN=sqlRead.GetString(24);}// 百万"
if (!sqlRead.IsDBNull(25)){ChFeeChequeEntity.SHIWAN=sqlRead.GetString(25);}// 十万"
if (!sqlRead.IsDBNull(26)){ChFeeChequeEntity.WAN=sqlRead.GetString(26);}// 万"
if (!sqlRead.IsDBNull(27)){ChFeeChequeEntity.QIAN=sqlRead.GetString(27);}// 千"
if (!sqlRead.IsDBNull(28)){ChFeeChequeEntity.BAI=sqlRead.GetString(28);}// 百"
if (!sqlRead.IsDBNull(29)){ChFeeChequeEntity.SHI=sqlRead.GetString(29);}// 十"
if (!sqlRead.IsDBNull(30)){ChFeeChequeEntity.YUAN=sqlRead.GetString(30);}// 元"
if (!sqlRead.IsDBNull(31)){ChFeeChequeEntity.JIAO=sqlRead.GetString(31);}// 角"
if (!sqlRead.IsDBNull(32)){ChFeeChequeEntity.FEN=sqlRead.GetString(32);}// 分"
if (!sqlRead.IsDBNull(33)){ChFeeChequeEntity.UNIT=sqlRead.GetString(33);}// 金额单位"
if (!sqlRead.IsDBNull(34)){ChFeeChequeEntity.ISDELETE=sqlRead.GetBoolean(34); }// 是否废除"
if (!sqlRead.IsDBNull(35)){ChFeeChequeEntity.DELETEOPERATOR=sqlRead.GetString(35); }// 废除人"
if (!sqlRead.IsDBNull(36)){ChFeeChequeEntity.DELETECAUSE=sqlRead.GetString(36);}// 废除原因"
if (!sqlRead.IsDBNull(37)){ChFeeChequeEntity.DELETETIME=sqlRead.GetDateTime(37); }// 废除时间"
if (!sqlRead.IsDBNull(38)){ChFeeChequeEntity.ISPRINT=sqlRead.GetBoolean(38); }// 是否打印"
if (!sqlRead.IsDBNull(39)){ChFeeChequeEntity.PAYBANK=sqlRead.GetString(39); }// 付款行"
if (!sqlRead.IsDBNull(40)){ChFeeChequeEntity.PAYBANKACCOUNT=sqlRead.GetString(40);}// 付款行账号"
if (!sqlRead.IsDBNull(41)){ChFeeChequeEntity.PAYEEBANK=sqlRead.GetString(41);}// 收款单位银行"
if (!sqlRead.IsDBNull(42)){ChFeeChequeEntity.PAYEEBANKACCOUNT=sqlRead.GetString(42);}// 付款单位银行账号"
if (!sqlRead.IsDBNull(43)){ChFeeChequeEntity.PAYEEADR=sqlRead.GetString(43);}// 收款单位地址"
if (!sqlRead.IsDBNull(44)){ChFeeChequeEntity.ISAUDIT=sqlRead.GetBoolean(44); }// 是否审核"
if (!sqlRead.IsDBNull(45)){ChFeeChequeEntity.AUDITOPERATOR=sqlRead.GetString(45); }// 审核人"
if (!sqlRead.IsDBNull(46)){ChFeeChequeEntity.AUDITDATE=sqlRead.GetDateTime(46); }// 审核时间"
if (!sqlRead.IsDBNull(47)){ChFeeChequeEntity.CREATEUSER=sqlRead.GetString(47); }// 创建人"
if (!sqlRead.IsDBNull(48)){ChFeeChequeEntity.CREATETIME=sqlRead.GetDateTime(48); }// 创建时间"
if (!sqlRead.IsDBNull(49)){ChFeeChequeEntity.MODIFIEDUSER=sqlRead.GetString(49); }// 最后一次更新操作人GID"
if (!sqlRead.IsDBNull(50)){ChFeeChequeEntity.MODIFIEDTIME=sqlRead.GetDateTime(50); }// 最后一次更新操作时间"
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return ChFeeChequeEntity;
}
#endregion
public int InsertChFeeCheques(IList<ChFeeChequeEntity> tempChFeeChequeEntities)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
int result = 0;
//判断是否有值
if (tempChFeeChequeEntities[0].GID != null)
{
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
foreach (ChFeeChequeEntity ChFeeCheque in tempChFeeChequeEntities)
{
if (ChFeeCheque.GID != null)
{
string alt = "";
alt = T_ALL_DA.GetStrSQL("GID", "select GID from ch_fee_cheque where GID='" + ChFeeCheque.GID.Trim() + "'");
if (alt.Trim() == "")
{
result = InserInfo(ChFeeCheque);
}
else
{
result = UpdateInfo(ChFeeCheque);
}
}
}
sqlTran.Commit();
result = 1;//状态为1表示插入成功
}
catch (Exception execError)
{
result = -1;//有异常,插入失败
sqlTran.Rollback();
result = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
}
return result;
}
/// <summary>
/// 插入信息
/// </summary>
/// <param name="ChFeeChequeEntity">实体类</param>
/// <returns>值为1插入数据正常,-1操作异常</returns>
public int InserInfo(ChFeeChequeEntity infoEntity)
{
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
//获取参数
SqlParameter[] parms = GetInsertParms();
parms[0].Value = infoEntity.GID;// 惟一编号
parms[1].Value = infoEntity.CHEQUENO;// 支票号码
parms[2].Value = infoEntity.BILLNO;// 申请编号
parms[3].Value = infoEntity.PAYSETTLEBILLNO;// 付费结算编号
parms[4].Value = infoEntity.CUSTOMERNAME;// 客户名称
parms[5].Value = infoEntity.CHEQUECUSTNAME;// 支票抬头/收款单位
parms[6].Value = infoEntity.MAKETIMEUPPER;// 出票日期中文大写
parms[7].Value = infoEntity.YEAR;// 年
parms[8].Value = infoEntity.MONTH;// 月
parms[9].Value = infoEntity.DAY;// 日
parms[10].Value = infoEntity.YEARUPPER;// 年大写
parms[11].Value = infoEntity.MONTHUPPER;// 月大写
parms[12].Value = infoEntity.DAYUPPER;// 日大写
parms[13].Value = infoEntity.PURPOSE;// 用途
parms[14].Value = infoEntity.PASSWORD;// 密码
parms[15].Value = infoEntity.CHEQUECURRENCY;// 支票币别
parms[16].Value = infoEntity.CHEQUETYPE;// 支票类别
parms[17].Value = infoEntity.CHEQUEAMOUNT;// 支票金额
parms[18].Value = infoEntity.CHEQUEAMOUNTUPPER;// 支票金额大写
parms[19].Value = infoEntity.BAIYI;// 百亿
parms[20].Value = infoEntity.SHIYI;// 十亿
parms[21].Value = infoEntity.YI;// 亿
parms[22].Value = infoEntity.QIANWAN;// 千万
parms[23].Value = infoEntity.BAIWAN;// 百万
parms[24].Value = infoEntity.SHIWAN;// 十万
parms[25].Value = infoEntity.WAN;// 万
parms[26].Value = infoEntity.QIAN;// 千
parms[27].Value = infoEntity.BAI;// 百
parms[28].Value = infoEntity.SHI;// 十
parms[29].Value = infoEntity.YUAN;// 元
parms[30].Value = infoEntity.JIAO;// 角
parms[31].Value = infoEntity.FEN;// 分
parms[32].Value = infoEntity.UNIT;// 金额单位
parms[33].Value = infoEntity.ISDELETE;// 是否废除
parms[34].Value = infoEntity.DELETEOPERATOR;// 废除人
parms[35].Value = infoEntity.DELETECAUSE;// 废除原因
parms[36].Value = infoEntity.ISPRINT;// 是否打印
parms[37].Value = infoEntity.PAYBANK;// 付款行
parms[38].Value = infoEntity.PAYBANKACCOUNT;// 付款行账号
parms[39].Value = infoEntity.PAYEEBANK;// 收款单位银行
parms[40].Value = infoEntity.PAYEEBANKACCOUNT;// 付款单位银行账号
parms[41].Value = infoEntity.PAYEEADR;// 收款单位地址
parms[42].Value = infoEntity.ISAUDIT;// 是否审核
parms[43].Value = infoEntity.AUDITOPERATOR;// 审核人
parms[44].Value = infoEntity.CREATEUSER;// 创建人
parms[45].Value = infoEntity.MODIFIEDUSER;// 最后一次更新操作人GID
//parms[46 ] .Value = infoEntity.CHEQUEMAKETIME;// 出票日期
//parms[47 ] .Value = infoEntity.DELETETIME;// 废除时间
//parms[48 ] .Value = infoEntity.AUDITDATE;// 审核时间
//parms[49 ] .Value = infoEntity.CREATETIME;// 创建时间
//parms[50 ] .Value = infoEntity.MODIFIEDTIME;// 最后一次更新操作时间
string strCHEQUEMAKETIME = infoEntity.CHEQUEMAKETIME.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.CHEQUEMAKETIME.ToString() + "',";
string strCHEQUEMAKETIME_name = strCHEQUEMAKETIME.Equals("") ? "" : "CHEQUEMAKETIME,";
string strDELETETIME = infoEntity.DELETETIME.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.DELETETIME.ToString() + "',";
string strDELETETIME_name = strDELETETIME.Equals("") ? "" : "DELETETIME,";
string strAUDITDATE = infoEntity.AUDITDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.AUDITDATE.ToString() + "',";
string strAUDITDATE_name = strAUDITDATE.Equals("") ? "" : "AUDITDATE,";
strSql = String.Format(strSql, strCHEQUEMAKETIME_name, strCHEQUEMAKETIME, strDELETETIME_name, strDELETETIME, strAUDITDATE_name, strAUDITDATE);
//
iResult = -3;//插入支票开出信息失败
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parms);
//
iResult = -4;//更改支票明细中支票号的开出状态失败
strSql = "update ch_fee_chequeitems set ISMAKEOUT='True',MAKEOUTUSER='" + infoEntity.CREATEUSER + "',MAKEOUTTIME=getdate() where CHEQUENUM='" + infoEntity.CHEQUENO + "'";
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parms);
//
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//
iResult = 1;//状态为1表示开出成功
sqlTran.Commit();
}
catch (Exception execError)
{
iResult = -1;//有异常,支票开出失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
/// <summary>
/// 更新信息
/// </summary>
/// <param name="ChFeeChequeEntity">实体类</param>
/// <returns>值为1更新数据正常,-1操作异常</returns>
public int UpdateInfo(ChFeeChequeEntity infoEntity)
{
int iResult = 0;
//获取参数
SqlParameter[] parms = GetUpdateParms();
parms[0].Value = infoEntity.GID;// 惟一编号 "
parms[1].Value = infoEntity.CUSTOMERNAME;// 客户名称"
parms[2].Value = infoEntity.CHEQUECUSTNAME;// 支票抬头/收款单位"
parms[3].Value = infoEntity.MAKETIMEUPPER;// 出票日期中文大写"
parms[4].Value = infoEntity.YEAR;// 年"
parms[5].Value = infoEntity.MONTH;// 月"
parms[6].Value = infoEntity.DAY;// 日"
parms[7].Value = infoEntity.YEARUPPER;// 年大写"
parms[8].Value = infoEntity.MONTHUPPER;// 月大写"
parms[9].Value = infoEntity.DAYUPPER;// 日大写"
parms[10].Value = infoEntity.PURPOSE;// 用途"
parms[11].Value = infoEntity.PASSWORD;// 密码"
parms[12].Value = infoEntity.CHEQUECURRENCY;// 支票币别"
parms[13].Value = infoEntity.CHEQUETYPE;// 支票类别"
parms[14].Value = infoEntity.CHEQUEAMOUNT;// 支票金额"
parms[15].Value = infoEntity.CHEQUEAMOUNTUPPER;// 支票金额大写"
parms[16].Value = infoEntity.BAIYI;// 百亿"
parms[17].Value = infoEntity.SHIYI;// 十亿"
parms[18].Value = infoEntity.YI;// 亿"
parms[19].Value = infoEntity.QIANWAN;// 千万"
parms[20].Value = infoEntity.BAIWAN;// 百万"
parms[21].Value = infoEntity.SHIWAN;// 十万"
parms[22].Value = infoEntity.WAN;// 万"
parms[23].Value = infoEntity.QIAN;// 千"
parms[24].Value = infoEntity.BAI;// 百"
parms[25].Value = infoEntity.SHI;// 十"
parms[26].Value = infoEntity.YUAN;// 元"
parms[27].Value = infoEntity.JIAO;// 角"
parms[28].Value = infoEntity.FEN;// 分"
parms[29].Value = infoEntity.UNIT;// 金额单位"
parms[30].Value = infoEntity.PAYBANK;// 付款行"
parms[31].Value = infoEntity.PAYBANKACCOUNT;// 付款行账号"
parms[32].Value = infoEntity.PAYEEBANK;// 收款单位银行"
parms[33].Value = infoEntity.PAYEEBANKACCOUNT;// 付款单位银行账号"
parms[34].Value = infoEntity.PAYEEADR;// 收款单位地址"
parms[35].Value = infoEntity.MODIFIEDUSER;// 最后一次更新操作人GID"
//parms[36] .Value = infoEntity.CHEQUEMAKETIME;// 出票日期"
//parms[37] .Value = infoEntity.MODIFIEDTIME;// 最后一次更新操作时间"
string strCHEQUEMAKETIME = infoEntity.CHEQUEMAKETIME.ToString().IndexOf("0001")>-1 ? "null,":"'"+infoEntity.CHEQUEMAKETIME.ToString()+"',";
string strCHEQUEMAKETIME_name = "CHEQUEMAKETIME=";
strSqlUpdateInfo = String.Format(strSqlUpdateInfo, strCHEQUEMAKETIME_name, strCHEQUEMAKETIME);
//
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlUpdateInfo, parms);
if (existVal > 0)
{
iResult = 1;
//
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('更新ch_fee_cheque海运业务信息表','更新操作','GID=" + infoEntity.GID + "','" + strUserID + "')";
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
#region 生成插入语句参数
/// <summary>
/// 生成插入语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetInsertParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@GID",SqlDbType.VarChar,100),//惟一编号
new SqlParameter("@CHEQUENO",SqlDbType.VarChar,200),//支票号码
new SqlParameter("@BILLNO",SqlDbType.VarChar,20),//申请编号
new SqlParameter("@PAYSETTLEBILLNO",SqlDbType.VarChar,20),//付费结算编号
new SqlParameter("@CUSTOMERNAME",SqlDbType.VarChar,20),//客户名称
new SqlParameter("@CHEQUECUSTNAME",SqlDbType.VarChar,100),//支票抬头/收款单位
//new SqlParameter("@CHEQUEMAKETIME",SqlDbType.DateTime),//出票日期
new SqlParameter("@MAKETIMEUPPER",SqlDbType.VarChar,50),//出票日期中文大写
new SqlParameter("@YEAR",SqlDbType.VarChar,4),//年
new SqlParameter("@MONTH",SqlDbType.VarChar,2),//月
new SqlParameter("@DAY",SqlDbType.VarChar,2),//日
new SqlParameter("@YEARUPPER",SqlDbType.VarChar,10),//年大写
new SqlParameter("@MONTHUPPER",SqlDbType.VarChar,10),//月大写
new SqlParameter("@DAYUPPER",SqlDbType.VarChar,10),//日大写
new SqlParameter("@PURPOSE",SqlDbType.VarChar,100),//用途
new SqlParameter("@PASSWORD",SqlDbType.VarChar,100),//密码
new SqlParameter("@CHEQUECURRENCY",SqlDbType.VarChar,20),//支票币别
new SqlParameter("@CHEQUETYPE",SqlDbType.Int),//支票类别
new SqlParameter("@CHEQUEAMOUNT",SqlDbType.Decimal),//支票金额
new SqlParameter("@CHEQUEAMOUNTUPPER",SqlDbType.VarChar,100),//支票金额大写
new SqlParameter("@BAIYI",SqlDbType.VarChar,1),//百亿
new SqlParameter("@SHIYI",SqlDbType.VarChar,1),//十亿
new SqlParameter("@YI",SqlDbType.VarChar,1),//亿
new SqlParameter("@QIANWAN",SqlDbType.VarChar,1),//千万
new SqlParameter("@BAIWAN",SqlDbType.VarChar,1),//百万
new SqlParameter("@SHIWAN",SqlDbType.VarChar,1),//十万
new SqlParameter("@WAN",SqlDbType.VarChar,1),//万
new SqlParameter("@QIAN",SqlDbType.VarChar,1),//千
new SqlParameter("@BAI",SqlDbType.VarChar,1),//百
new SqlParameter("@SHI",SqlDbType.VarChar,1),//十
new SqlParameter("@YUAN",SqlDbType.VarChar,1),//元
new SqlParameter("@JIAO",SqlDbType.VarChar,1),//角
new SqlParameter("@FEN",SqlDbType.VarChar,1),//分
new SqlParameter("@UNIT",SqlDbType.VarChar,1),//金额单位
new SqlParameter("@ISDELETE",SqlDbType.Bit),//是否废除
new SqlParameter("@DELETEOPERATOR",SqlDbType.VarChar,36),//废除人
new SqlParameter("@DELETECAUSE",SqlDbType.VarChar,100),//废除原因
//new SqlParameter("@DELETETIME",SqlDbType.DateTime),//废除时间
new SqlParameter("@ISPRINT",SqlDbType.Bit),//是否打印
new SqlParameter("@PAYBANK",SqlDbType.VarChar,100),//付款行
new SqlParameter("@PAYBANKACCOUNT",SqlDbType.VarChar,100),//付款行账号
new SqlParameter("@PAYEEBANK",SqlDbType.VarChar,100),//收款单位银行
new SqlParameter("@PAYEEBANKACCOUNT",SqlDbType.VarChar,100),//付款单位银行账号
new SqlParameter("@PAYEEADR",SqlDbType.VarChar,100),//收款单位地址
new SqlParameter("@ISAUDIT",SqlDbType.Bit),//是否审核
new SqlParameter("@AUDITOPERATOR",SqlDbType.VarChar,36),//审核人
//new SqlParameter("@AUDITDATE",SqlDbType.DateTime),//审核时间
new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人
//new SqlParameter("@CREATETIME",SqlDbType.DateTime),//创建时间
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//最后一次更新操作人GID
//new SqlParameter("@MODIFIEDTIME",SqlDbType.DateTime )// 最后一次更新操作时间
};
return parms;
}
#endregion
#region 生成更新语句参数
/// <summary>
/// 生成更新语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetUpdateParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@GID",SqlDbType.VarChar,100),//惟一编号
//new SqlParameter("@CHEQUENO",SqlDbType.VarChar,200),//支票号码
//new SqlParameter("@BILLNO",SqlDbType.VarChar,20),//申请编号
//new SqlParameter("@PAYSETTLEBILLNO",SqlDbType.VarChar,20),//付费结算编号
new SqlParameter("@CUSTOMERNAME",SqlDbType.VarChar,20),//客户名称
new SqlParameter("@CHEQUECUSTNAME",SqlDbType.VarChar,100),//支票抬头/收款单位
//new SqlParameter("@CHEQUEMAKETIME",SqlDbType.DateTime),//出票日期
new SqlParameter("@MAKETIMEUPPER",SqlDbType.VarChar,50),//出票日期中文大写
new SqlParameter("@YEAR",SqlDbType.VarChar,4),//年
new SqlParameter("@MONTH",SqlDbType.VarChar,2),//月
new SqlParameter("@DAY",SqlDbType.VarChar,2),//日
new SqlParameter("@YEARUPPER",SqlDbType.VarChar,10),//年大写
new SqlParameter("@MONTHUPPER",SqlDbType.VarChar,10),//月大写
new SqlParameter("@DAYUPPER",SqlDbType.VarChar,10),//日大写
new SqlParameter("@PURPOSE",SqlDbType.VarChar,100),//用途
new SqlParameter("@PASSWORD",SqlDbType.VarChar,100),//密码
new SqlParameter("@CHEQUECURRENCY",SqlDbType.VarChar,20),//支票币别
new SqlParameter("@CHEQUETYPE",SqlDbType.Int),//支票类别
new SqlParameter("@CHEQUEAMOUNT",SqlDbType.Decimal),//支票金额
new SqlParameter("@CHEQUEAMOUNTUPPER",SqlDbType.VarChar,100),//支票金额大写
new SqlParameter("@BAIYI",SqlDbType.VarChar,1),//百亿
new SqlParameter("@SHIYI",SqlDbType.VarChar,1),//十亿
new SqlParameter("@YI",SqlDbType.VarChar,1),//亿
new SqlParameter("@QIANWAN",SqlDbType.VarChar,1),//千万
new SqlParameter("@BAIWAN",SqlDbType.VarChar,1),//百万
new SqlParameter("@SHIWAN",SqlDbType.VarChar,1),//十万
new SqlParameter("@WAN",SqlDbType.VarChar,1),//万
new SqlParameter("@QIAN",SqlDbType.VarChar,1),//千
new SqlParameter("@BAI",SqlDbType.VarChar,1),//百
new SqlParameter("@SHI",SqlDbType.VarChar,1),//十
new SqlParameter("@YUAN",SqlDbType.VarChar,1),//元
new SqlParameter("@JIAO",SqlDbType.VarChar,1),//角
new SqlParameter("@FEN",SqlDbType.VarChar,1),//分
new SqlParameter("@UNIT",SqlDbType.VarChar,1),//金额单位
//new SqlParameter("@ISDELETE",SqlDbType.Bit),//是否废除
//new SqlParameter("@DELETEOPERATOR",SqlDbType.VarChar,36),//废除人
//new SqlParameter("@DELETECAUSE",SqlDbType.VarChar,100),//废除原因
//new SqlParameter("@DELETETIME",SqlDbType.DateTime),//废除时间
//new SqlParameter("@ISPRINT",SqlDbType.Bit),//是否打印
new SqlParameter("@PAYBANK",SqlDbType.VarChar,100),//付款行
new SqlParameter("@PAYBANKACCOUNT",SqlDbType.VarChar,100),//付款行账号
new SqlParameter("@PAYEEBANK",SqlDbType.VarChar,100),//收款单位银行
new SqlParameter("@PAYEEBANKACCOUNT",SqlDbType.VarChar,100),//付款单位银行账号
new SqlParameter("@PAYEEADR",SqlDbType.VarChar,100),//收款单位地址
//new SqlParameter("@ISAUDIT",SqlDbType.Bit),//是否审核
//new SqlParameter("@AUDITOPERATOR",SqlDbType.VarChar,36),//审核人
//new SqlParameter("@AUDITDATE",SqlDbType.DateTime),//审核时间
//new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人
//new SqlParameter("@CREATETIME",SqlDbType.DateTime),//创建时间
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36)//最后一次更新操作人GID
//new SqlParameter("@MODIFIEDTIME",SqlDbType.DateTime )// 最后一次更新操作时间
};
return parms;
}
#endregion
#region 废除GID信息
/// <summary>
/// 删除GID信息
/// </summary>
/// <param name="tempGID">GID信息</param>
/// <returns>值1表示删除成功 值-1表示有异常删除失败 值-2表示插入异常,事务已回滚成功</returns>
public int RepealInfo(string tempGID, string strDELETECAUSE, string strUserID, string strCHEQUENUM)
{
int iResult = 0;
string strRepeal = "";
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
iResult = -3;//更改支票废除状态失败
strRepeal = "update ch_fee_cheque set ISDELETE='True',DELETEOPERATOR='" + strUserID + "',DELETECAUSE='" + strDELETECAUSE + "',DELETETIME=getdate() where GID='" + tempGID + "'";
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strRepeal, null);
//
iResult = -4;//更改支票明细中支票号的废除状态失败
strRepeal = "update ch_fee_chequeitems set ISDELETE='True',DELETEUSER='" + strUserID + "',DELETETIME=getdate() where CHEQUENUM='" + strCHEQUENUM + "'";
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strRepeal, null);
//
iResult = 1;//状态为1表示删除成功
sqlTran.Commit();
}
catch (Exception execError)
{
iResult = -1;//有异常,支票废除失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
#region 返回所有支票信息数据集
/// <summary>
/// 返回所有支票信息数据集
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public DataSet GetSeaExportList()
{
DataSet userSet = new DataSet();
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO);
return userSet;
}
#endregion
#region 根据SQL语句查询支票信息数据集
/// <summary>
/// 根据SQL语句查询支票信息数据集
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public DataSet GetSeaExportListByCondition(string strSql)
{
DataSet userSet = new DataSet();
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
return userSet;
}
#endregion
#region 获取支票信息GID记录总页数
/// <summary>
/// 获取支票信息GID记录总页数
/// </summary>
/// <param name="strSql">sql查询语句</param>
/// <returns>返回int型支票信息GID记录总页数</returns>
public int GetPageTotal(string strSql)
{
int iResult = 0;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql, null))
{
try
{
while (sqlRead.Read())
{
iResult = sqlRead.GetInt32(0);
}
}
catch (Exception error)
{
throw error;
}
}
return iResult;
}
#endregion
#region 删除GID信息
/// <summary>
/// 删除GID信息
/// </summary>
/// <param name="tempGID">GID信息GID</param>
/// <returns>值1表示删除成功 值-1表示有异常删除失败 值-2表示插入异常,事务已回滚成功</returns>
public int DeleteOrder(string tempGID)
{
int iResult = 0;
SqlParameter parm = new SqlParameter(PARM_MODULE_GID, SqlDbType.VarChar, 100);
parm.Value = tempGID;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_DELETE_INFO, parm);
iResult = 1;//状态为1表示删除成功
sqlTran.Commit();
}
catch (Exception execError)
{
iResult = -1;//有异常,删除失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
}
}