|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using DSWeb.SoftMng.DBUtility;
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
namespace DSWeb.SoftMng.DAL
|
|
|
|
|
{
|
|
|
|
|
//DecSign
|
|
|
|
|
public partial class DecSignDAL
|
|
|
|
|
{
|
|
|
|
|
public bool Exists(string GID)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("select count(1) from DecSign");
|
|
|
|
|
strSql.Append(" where ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" GID = @GID ");
|
|
|
|
|
SqlParameter[] parameters = {
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar,50) };
|
|
|
|
|
parameters[0].Value = GID;
|
|
|
|
|
|
|
|
|
|
return DbHelperSQL.Exists(strSql.ToString(),parameters);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加一条数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Add(DSWeb.SoftMng.Model.DecSign model)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("insert into DecSign(");
|
|
|
|
|
strSql.Append("GID,OperType,ICCode,CopCode,OperName,ClientSeqNo,Sign,SignDate,Certificate,HostId");
|
|
|
|
|
strSql.Append(") values (");
|
|
|
|
|
strSql.Append("@GID,@OperType,@ICCode,@CopCode,@OperName,@ClientSeqNo,@Sign,@SignDate,@Certificate,@HostId");
|
|
|
|
|
strSql.Append(") ");
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parameters = {
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@OperType", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@ICCode", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@CopCode", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@OperName", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@ClientSeqNo", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@Sign", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@SignDate", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@Certificate", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@HostId", SqlDbType.VarChar,50)
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parameters[0].Value = model.GID??(Object)DBNull.Value;
|
|
|
|
|
parameters[1].Value = model.OperType??(Object)DBNull.Value;
|
|
|
|
|
parameters[2].Value = model.ICCode??(Object)DBNull.Value;
|
|
|
|
|
parameters[3].Value = model.CopCode??(Object)DBNull.Value;
|
|
|
|
|
parameters[4].Value = model.OperName??(Object)DBNull.Value;
|
|
|
|
|
parameters[5].Value = model.ClientSeqNo??(Object)DBNull.Value;
|
|
|
|
|
parameters[6].Value = model.Sign??(Object)DBNull.Value;
|
|
|
|
|
parameters[7].Value = model.SignDate??(Object)DBNull.Value;
|
|
|
|
|
parameters[8].Value = model.Certificate??(Object)DBNull.Value;
|
|
|
|
|
parameters[9].Value = model.HostId??(Object)DBNull.Value;
|
|
|
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新一条数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Update(DSWeb.SoftMng.Model.DecSign model)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("update DecSign set ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" GID = @GID,");
|
|
|
|
|
strSql.Append(" OperType = @OperType,");
|
|
|
|
|
strSql.Append(" ICCode = @ICCode,");
|
|
|
|
|
strSql.Append(" CopCode = @CopCode,");
|
|
|
|
|
strSql.Append(" OperName = @OperName,");
|
|
|
|
|
strSql.Append(" ClientSeqNo = @ClientSeqNo,");
|
|
|
|
|
strSql.Append(" Sign = @Sign,");
|
|
|
|
|
strSql.Append(" SignDate = @SignDate,");
|
|
|
|
|
strSql.Append(" Certificate = @Certificate,");
|
|
|
|
|
strSql.Append(" HostId = @HostId");
|
|
|
|
|
strSql.Append(" where GID=@GID ");
|
|
|
|
|
SqlParameter[] parameters = {
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@OperType", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@ICCode", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@CopCode", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@OperName", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@ClientSeqNo", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@Sign", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@SignDate", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@Certificate", SqlDbType.VarChar,50) ,
|
|
|
|
|
new SqlParameter("@HostId", SqlDbType.VarChar,50)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parameters[0].Value = model.GID??(Object)DBNull.Value;
|
|
|
|
|
parameters[1].Value = model.OperType??(Object)DBNull.Value;
|
|
|
|
|
parameters[2].Value = model.ICCode??(Object)DBNull.Value;
|
|
|
|
|
parameters[3].Value = model.CopCode??(Object)DBNull.Value;
|
|
|
|
|
parameters[4].Value = model.OperName??(Object)DBNull.Value;
|
|
|
|
|
parameters[5].Value = model.ClientSeqNo??(Object)DBNull.Value;
|
|
|
|
|
parameters[6].Value = model.Sign??(Object)DBNull.Value;
|
|
|
|
|
parameters[7].Value = model.SignDate??(Object)DBNull.Value;
|
|
|
|
|
parameters[8].Value = model.Certificate??(Object)DBNull.Value;
|
|
|
|
|
parameters[9].Value = model.HostId??(Object)DBNull.Value;
|
|
|
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除一条数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Delete(string GID)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("delete from DecSign ");
|
|
|
|
|
strSql.Append(" where GID=@GID ");
|
|
|
|
|
SqlParameter[] parameters = {
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar,50) };
|
|
|
|
|
parameters[0].Value = GID;
|
|
|
|
|
|
|
|
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按条件批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int DeleteListWhere(string strWhere)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("delete from DecSign ");
|
|
|
|
|
if(strWhere.Trim()!="")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where "+strWhere);
|
|
|
|
|
}
|
|
|
|
|
return DbHelperSQL.ExecuteSql(strSql.ToString());
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 得到一个对象实体
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataSet GetModel(string GID)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("select GID, OperType, ICCode, CopCode, OperName, ClientSeqNo, Sign, SignDate, Certificate, HostId ");
|
|
|
|
|
strSql.Append(" from DecSign ");
|
|
|
|
|
strSql.Append(" where GID=@GID ");
|
|
|
|
|
SqlParameter[] parameters = {
|
|
|
|
|
new SqlParameter("@GID", SqlDbType.VarChar,50) };
|
|
|
|
|
parameters[0].Value = GID;
|
|
|
|
|
|
|
|
|
|
DSWeb.SoftMng.Model.DecSign model=new DSWeb.SoftMng.Model.DecSign();
|
|
|
|
|
return DbHelperSQL.Query(strSql.ToString(),parameters);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获得数据列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataSet GetList(string strWhere)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("select * ");
|
|
|
|
|
strSql.Append(" FROM DecSign ");
|
|
|
|
|
if(strWhere.Trim()!="")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where "+strWhere);
|
|
|
|
|
}
|
|
|
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获得前几行数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataSet GetList(int Top,string strWhere,string filedOrder)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("select ");
|
|
|
|
|
if(Top>0)
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" top "+Top.ToString());
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(" * ");
|
|
|
|
|
strSql.Append(" FROM DecSign ");
|
|
|
|
|
if(strWhere.Trim()!="")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where "+strWhere);
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(" order by " + filedOrder);
|
|
|
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页获取数据列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
|
|
|
|
|
{
|
|
|
|
|
//动软代码
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT * FROM ( ");
|
|
|
|
|
strSql.Append(" SELECT ROW_NUMBER() OVER (");
|
|
|
|
|
if (!string.IsNullOrEmpty(orderby.Trim()))
|
|
|
|
|
strSql.Append("order by T." + orderby);
|
|
|
|
|
strSql.Append(")AS Row, T.* from DecSign T ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" WHERE " + strWhere);
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(" ) TT");
|
|
|
|
|
strSql.AppendFormat(" WHERE TT.Row > {0} and TT.Row <= {1}", startIndex, endIndex);
|
|
|
|
|
//公共代码
|
|
|
|
|
return DbHelperSQL.Query(strSql.ToString());
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取记录总数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int GetRecordCount(string strWhere)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
|
|
|
strSql.Append("select count(1) FROM DecSign ");
|
|
|
|
|
if(strWhere.Trim()!="")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where "+strWhere);
|
|
|
|
|
}
|
|
|
|
|
return DbHelperSQL.ExcuteScalarSQL(strSql.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|