|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.DataAccess;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.EntityDA
|
|
|
|
|
{
|
|
|
|
|
public class CodeCtnSetDA
|
|
|
|
|
{
|
|
|
|
|
private const string PARM_CodeCtnSet_GID = "@CTNID";
|
|
|
|
|
private const string PARM_CodeCtnSet_CTN = "@CTN";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_CodeCtnSet_ALL = " SELECT CTNID,CTNSIZE,CTNTYPE,CTN,EDICODE,CTNWEIGHT,EEXPLAIN,CEXPLAIN FROM code_ctn order by CTNID";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_CodeCtnSet_BYGID = " SELECT CTNID,CTNSIZE,CTNTYPE,CTN,EDICODE,CTNWEIGHT,EEXPLAIN,CEXPLAIN FROM code_ctn WHERE CTNID = @CTNID";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_CodeCtnSet_CTN = " SELECT CTNID,CTNSIZE,CTNTYPE,CTN,EDICODE,CTNWEIGHT,EEXPLAIN,CEXPLAIN FROM code_ctn WHERE CTN = @CTN";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_CodeCtnSet_TOP1 = " SELECT top 1 CTNID,CTNSIZE,CTNTYPE,CTN,EDICODE,CTNWEIGHT,EEXPLAIN,CEXPLAIN FROM code_ctn order by STATUS";
|
|
|
|
|
|
|
|
|
|
private string strSqlInsertInfo = "insert into [code_ctn](CTNID,CTNSIZE,CTNTYPE,CTN,EDICODE,CTNWEIGHT,EEXPLAIN,CEXPLAIN) values(@CTNID,@CTNSIZE,@CTNTYPE,@CTN,@EDICODE,@CTNWEIGHT,@EEXPLAIN,@CEXPLAIN)";
|
|
|
|
|
|
|
|
|
|
private string strSqlUpdateInfo = "update [code_ctn] set CTNSIZE=@CTNSIZE,CTNTYPE=@CTNTYPE,CTN=@CTN,EDICODE=@EDICODE,CTNWEIGHT=@CTNWEIGHT,EEXPLAIN=@EEXPLAIN,CEXPLAIN=@CEXPLAIN where CTNID=@CTNID";
|
|
|
|
|
|
|
|
|
|
private const string SQL_DELETE_CodeCtnSet_BY_GID = "DELETE FROM code_ctn WHERE CTNID = @CTNID";
|
|
|
|
|
|
|
|
|
|
#region 获取所有业务状态信息信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取所有业务状态信息信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>List<CodeCtnSetEntity></returns>
|
|
|
|
|
public IList<CodeCtnSetEntity> GetAllCodeCtnSet()
|
|
|
|
|
{
|
|
|
|
|
IList<CodeCtnSetEntity> CodeCtnSetEntites = new List<CodeCtnSetEntity>();
|
|
|
|
|
// = null;
|
|
|
|
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_CodeCtnSet_ALL, null))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity CodeCtnSetEntity = new CodeCtnSetEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNSIZE = sqlRead.GetString(1);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNTYPE = sqlRead.GetString(2);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTN = sqlRead.GetString(3);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EDICODE = sqlRead.GetString(4);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNWEIGHT = sqlRead.GetDecimal(5);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EEXPLAIN = sqlRead.GetString(6);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CEXPLAIN = sqlRead.GetString(7);
|
|
|
|
|
}
|
|
|
|
|
CodeCtnSetEntites.Add(CodeCtnSetEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return CodeCtnSetEntites;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strGid"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public CodeCtnSetEntity GetCodeCtnSetCTN(string strCTN)
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity CodeCtnSetEntity = null;
|
|
|
|
|
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_CodeCtnSet_CTN, SqlDbType.VarChar, 10);
|
|
|
|
|
parm.Value = strCTN;
|
|
|
|
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_CodeCtnSet_CTN, parm))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity = new CodeCtnSetEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNSIZE = sqlRead.GetString(1);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNTYPE = sqlRead.GetString(2);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTN = sqlRead.GetString(3);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EDICODE = sqlRead.GetString(4);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNWEIGHT = sqlRead.GetDecimal(5);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EEXPLAIN = sqlRead.GetString(6);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CEXPLAIN = sqlRead.GetString(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return CodeCtnSetEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strGid"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public CodeCtnSetEntity GetCodeCtnSetByID(string strGid)
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity CodeCtnSetEntity = null;
|
|
|
|
|
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_CodeCtnSet_GID, SqlDbType.VarChar, 36);
|
|
|
|
|
parm.Value = strGid;
|
|
|
|
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_CodeCtnSet_BYGID, parm))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity = new CodeCtnSetEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNSIZE = sqlRead.GetString(1);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNTYPE = sqlRead.GetString(2);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTN = sqlRead.GetString(3);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EDICODE = sqlRead.GetString(4);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNWEIGHT = sqlRead.GetDecimal(5);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EEXPLAIN = sqlRead.GetString(6);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CEXPLAIN = sqlRead.GetString(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return CodeCtnSetEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据业务状态信息GID获取业务状态信息信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strGid"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public CodeCtnSetEntity GetCodeCtnSetTop1()
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity CodeCtnSetEntity = null;
|
|
|
|
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_CodeCtnSet_TOP1, null))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity = new CodeCtnSetEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNSIZE = sqlRead.GetString(2);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNTYPE = sqlRead.GetString(1);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTN = sqlRead.GetString(3);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EDICODE = sqlRead.GetString(4);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CTNWEIGHT = sqlRead.GetDecimal(5);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.EEXPLAIN = sqlRead.GetString(6);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
CodeCtnSetEntity.CEXPLAIN = sqlRead.GetString(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return CodeCtnSetEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodeCtnSetEntity">实体类</param>
|
|
|
|
|
/// <returns>值为1插入数据正常,-1操作异常</returns>
|
|
|
|
|
public int InserInfo(CodeCtnSetEntity infoEntity)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
//获取参数
|
|
|
|
|
SqlParameter[] parms = GetInsertParms();
|
|
|
|
|
parms[0].Value = infoEntity.CTNSIZE;//集装箱尺寸
|
|
|
|
|
parms[1].Value = infoEntity.CTNTYPE;//集装箱类型
|
|
|
|
|
parms[2].Value = infoEntity.CTN;//表现形式
|
|
|
|
|
parms[3].Value = infoEntity.EDICODE;//EDI代码
|
|
|
|
|
parms[4].Value = infoEntity.CTNWEIGHT;//箱皮重
|
|
|
|
|
parms[5].Value = infoEntity.EEXPLAIN;//英文说明
|
|
|
|
|
parms[6].Value = infoEntity.CEXPLAIN;//中文说明
|
|
|
|
|
parms[7].Value = infoEntity.CTNID;//集装箱编码
|
|
|
|
|
//
|
|
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlInsertInfo, parms);
|
|
|
|
|
if (existVal > 0)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CodeCtnSetEntity">实体类</param>
|
|
|
|
|
/// <returns>值为1更新数据正常,-1操作异常</returns>
|
|
|
|
|
public int UpdateInfo(CodeCtnSetEntity infoEntity)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
//获取参数
|
|
|
|
|
SqlParameter[] parms = GetUpdateParms();
|
|
|
|
|
parms[0].Value = infoEntity.CTNSIZE;//集装箱尺寸
|
|
|
|
|
parms[1].Value = infoEntity.CTNTYPE;//集装箱类型
|
|
|
|
|
parms[2].Value = infoEntity.CTN;//表现形式
|
|
|
|
|
parms[3].Value = infoEntity.EDICODE;//EDI代码
|
|
|
|
|
parms[4].Value = infoEntity.CTNWEIGHT;//箱皮重
|
|
|
|
|
parms[5].Value = infoEntity.EEXPLAIN;//英文说明
|
|
|
|
|
parms[6].Value = infoEntity.CEXPLAIN;//中文说明
|
|
|
|
|
parms[7].Value = infoEntity.CTNID;//惟一编号
|
|
|
|
|
//
|
|
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlUpdateInfo, parms);
|
|
|
|
|
if (existVal > 0)
|
|
|
|
|
{
|
|
|
|
|
iResult = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//执行异常
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 生成插入语句参数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成插入语句参数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回SqlParameter数组</returns>
|
|
|
|
|
private SqlParameter[] GetInsertParms()
|
|
|
|
|
{
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]
|
|
|
|
|
{
|
|
|
|
|
new SqlParameter("@CTNSIZE",SqlDbType.VarChar,5),//集装箱尺寸
|
|
|
|
|
new SqlParameter("@CTNTYPE",SqlDbType.VarChar,10),//集装箱类型
|
|
|
|
|
new SqlParameter("@CTN",SqlDbType.VarChar,10),//表现形式
|
|
|
|
|
new SqlParameter("@EDICODE",SqlDbType.VarChar,5),//EDI代码
|
|
|
|
|
new SqlParameter("@CTNWEIGHT",SqlDbType.Decimal),//箱皮重
|
|
|
|
|
new SqlParameter("@EEXPLAIN",SqlDbType.VarChar,100),//英文说明
|
|
|
|
|
new SqlParameter("@CEXPLAIN",SqlDbType.VarChar,100),//中文说明
|
|
|
|
|
new SqlParameter("@CTNID",SqlDbType.VarChar,36)//惟一编号
|
|
|
|
|
};
|
|
|
|
|
return parms;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 生成更新语句参数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成更新语句参数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回SqlParameter数组</returns>
|
|
|
|
|
private SqlParameter[] GetUpdateParms()
|
|
|
|
|
{
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter("@CTNSIZE",SqlDbType.VarChar,5),//集装箱尺寸
|
|
|
|
|
new SqlParameter("@CTNTYPE",SqlDbType.VarChar,10),//集装箱类型
|
|
|
|
|
new SqlParameter("@CTN",SqlDbType.VarChar,10),//表现形式
|
|
|
|
|
new SqlParameter("@EDICODE",SqlDbType.VarChar,5),//EDI代码
|
|
|
|
|
new SqlParameter("@CTNWEIGHT",SqlDbType.Decimal),//箱皮重
|
|
|
|
|
new SqlParameter("@EEXPLAIN",SqlDbType.VarChar,100),//英文说明
|
|
|
|
|
new SqlParameter("@CEXPLAIN",SqlDbType.VarChar,100),//中文说明
|
|
|
|
|
new SqlParameter("@CTNID",SqlDbType.VarChar,36)//惟一编号
|
|
|
|
|
};
|
|
|
|
|
return parms;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 返回数据集 业务状态信息表(CodeCtnSet)信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回 业务状态信息表(CodeCtnSet)信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataSet GetCodeCtnSetSQL(string strSQL)
|
|
|
|
|
{
|
|
|
|
|
string str = "select * from [code_ctn] where 1=1 " + strSQL;
|
|
|
|
|
DataSet DS = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, str);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (DS.Tables[0].Rows.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
DS = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
DS = null;
|
|
|
|
|
}
|
|
|
|
|
return DS;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 返回数据集 业务状态信息表(CodeCtnSet)信息
|
|
|
|
|
/// 返回 业务状态信息表(CodeCtnSet)删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/// <summary>
|
|
|
|
|
public String GetCodeCtnSetDel(string strGid, string strUserID)
|
|
|
|
|
{
|
|
|
|
|
string alt = "";
|
|
|
|
|
string str = "delete from code_ctn where CTNID='" + strGid + "'";
|
|
|
|
|
bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str);
|
|
|
|
|
if (bl == false)
|
|
|
|
|
{
|
|
|
|
|
alt = "账户表(code_ctn)删除操作出错!";
|
|
|
|
|
return alt;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//string str1 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,STATUS_OPSEAE) values('删除账户表(code_ctn)的信息','更新操作','" + str + "','" + strUserID + "')";
|
|
|
|
|
//bool bl1 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str1);
|
|
|
|
|
}
|
|
|
|
|
return alt;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据SQL语句查询账户数据集
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strSql"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataSet GetExcuteSql(string strSql)
|
|
|
|
|
{
|
|
|
|
|
DataSet userSet = new DataSet();
|
|
|
|
|
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
|
|
|
|
|
return userSet;
|
|
|
|
|
}
|
|
|
|
|
#region 插入账户列表信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入账户列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sqlList">插入SQL语句组,将所有要执行的插入语句写入ArrayList,每个索引对应一条SQL语句,执行时需要遍历操作</param>
|
|
|
|
|
/// <returns>返回状态值 为1表示插入完成;为-1插入出现异常但未正确回滚事务;为-2插入异常,事务已经成功回滚;默认状态为0</returns>
|
|
|
|
|
public int InsertCodeCtnSetFromGrid(ArrayList sqlList)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < sqlList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
string strInsertSql = sqlList[i].ToString();
|
|
|
|
|
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strInsertSql, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
|
|
result = 1;//状态为1表示插入成功
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
result = -1;//有异常,插入失败
|
|
|
|
|
sqlTran.Rollback();
|
|
|
|
|
result = -2;//插入异常,事务已回滚成功
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.CloseConnection();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 更新账户列表信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新账户列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sqlList">更新SQL语句组,将所有要执行的更新语句写入ArrayList,每个索引对应一条SQL语句,执行时需要遍历操作</param>
|
|
|
|
|
/// <returns>返回状态值 为1表示更新完成;为-1更新出现异常但未正确回滚事务;为-2更新异常,事务已经成功回滚;默认状态为0</returns>
|
|
|
|
|
public int UpdateCodeCtnSetFromGrid(ArrayList sqlList)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < sqlList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
string strUpdateSql = sqlList[i].ToString();
|
|
|
|
|
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strUpdateSql, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
|
|
result = 1;//状态为1表示更新成功
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
result = -1;//有异常,更新失败
|
|
|
|
|
sqlTran.Rollback();
|
|
|
|
|
result = -2;//更新异常,事务已回滚成功
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.CloseConnection();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 通过账户GID删除单条账户
|
|
|
|
|
public int DeleteCodeCtnSetByGid(string tempGid)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_CodeCtnSet_GID, SqlDbType.VarChar, 36);
|
|
|
|
|
parm.Value = tempGid;
|
|
|
|
|
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_DELETE_CodeCtnSet_BY_GID, parm);
|
|
|
|
|
|
|
|
|
|
result = 1;//状态为1表示删除成功
|
|
|
|
|
sqlTran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
result = -1;//有异常,插入失败
|
|
|
|
|
sqlTran.Rollback();
|
|
|
|
|
result = -2;//插入异常,事务已回滚成功
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.CloseConnection();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|