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/Areas/SoftMng/DAL/Info_Client_ACCDATE.cs

241 lines
11 KiB
C#

2 years ago
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
{
//Info_Client_ACCDATE
public partial class Info_Client_ACCDATEDAL
{
public bool Exists(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from Info_Client_ACCDATE");
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.Info_Client_ACCDATE model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into Info_Client_ACCDATE(");
strSql.Append("GID,LINKGID,BGNDATE,ENDDATE,OPLBNAME,SALE,ACCTYPE,ACCSTARTDATE,ACCMONTH,ACCDAYS,ALLOWAMOUNT,MODIFIEDUSER,MODIFIEDTIME,REMARK");
strSql.Append(") values (");
strSql.Append("@GID,@LINKGID,@BGNDATE,@ENDDATE,@OPLBNAME,@SALE,@ACCTYPE,@ACCSTARTDATE,@ACCMONTH,@ACCDAYS,@ALLOWAMOUNT,@MODIFIEDUSER,@MODIFIEDTIME,@REMARK");
strSql.Append(") ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
new SqlParameter("@LINKGID", SqlDbType.VarChar,50) ,
new SqlParameter("@BGNDATE", SqlDbType.DateTime) ,
new SqlParameter("@ENDDATE", SqlDbType.DateTime) ,
new SqlParameter("@OPLBNAME", SqlDbType.VarChar,20) ,
new SqlParameter("@SALE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCTYPE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCSTARTDATE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCMONTH", SqlDbType.TinyInt,1) ,
new SqlParameter("@ACCDAYS", SqlDbType.TinyInt,1) ,
new SqlParameter("@ALLOWAMOUNT", SqlDbType.Decimal,9) ,
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,50) ,
new SqlParameter("@MODIFIEDTIME", SqlDbType.VarChar,50) ,
new SqlParameter("@REMARK", SqlDbType.VarChar,250)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.LINKGID??(Object)DBNull.Value;
parameters[2].Value = model.BGNDATE??(Object)DBNull.Value;
parameters[3].Value = model.ENDDATE??(Object)DBNull.Value;
parameters[4].Value = model.OPLBNAME??(Object)DBNull.Value;
parameters[5].Value = model.SALE??(Object)DBNull.Value;
parameters[6].Value = model.ACCTYPE??(Object)DBNull.Value;
parameters[7].Value = model.ACCSTARTDATE??(Object)DBNull.Value;
parameters[8].Value = model.ACCMONTH??(Object)DBNull.Value;
parameters[9].Value = model.ACCDAYS??(Object)DBNull.Value;
parameters[10].Value = model.ALLOWAMOUNT??(Object)DBNull.Value;
parameters[11].Value = model.MODIFIEDUSER??(Object)DBNull.Value;
parameters[12].Value = model.MODIFIEDTIME??(Object)DBNull.Value;
parameters[13].Value = model.REMARK??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(DSWeb.SoftMng.Model.Info_Client_ACCDATE model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("update Info_Client_ACCDATE set ");
strSql.Append(" GID = @GID,");
strSql.Append(" LINKGID = @LINKGID,");
strSql.Append(" BGNDATE = @BGNDATE,");
strSql.Append(" ENDDATE = @ENDDATE,");
strSql.Append(" OPLBNAME = @OPLBNAME,");
strSql.Append(" SALE = @SALE,");
strSql.Append(" ACCTYPE = @ACCTYPE,");
strSql.Append(" ACCSTARTDATE = @ACCSTARTDATE,");
strSql.Append(" ACCMONTH = @ACCMONTH,");
strSql.Append(" ACCDAYS = @ACCDAYS,");
strSql.Append(" ALLOWAMOUNT = @ALLOWAMOUNT,");
strSql.Append(" MODIFIEDUSER = @MODIFIEDUSER,");
strSql.Append(" MODIFIEDTIME = @MODIFIEDTIME,");
strSql.Append(" REMARK = @REMARK");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) ,
new SqlParameter("@LINKGID", SqlDbType.VarChar,50) ,
new SqlParameter("@BGNDATE", SqlDbType.DateTime) ,
new SqlParameter("@ENDDATE", SqlDbType.DateTime) ,
new SqlParameter("@OPLBNAME", SqlDbType.VarChar,20) ,
new SqlParameter("@SALE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCTYPE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCSTARTDATE", SqlDbType.VarChar,20) ,
new SqlParameter("@ACCMONTH", SqlDbType.TinyInt,1) ,
new SqlParameter("@ACCDAYS", SqlDbType.TinyInt,1) ,
new SqlParameter("@ALLOWAMOUNT", SqlDbType.Decimal,9) ,
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,50) ,
new SqlParameter("@MODIFIEDTIME", SqlDbType.VarChar,50) ,
new SqlParameter("@REMARK", SqlDbType.VarChar,250)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.LINKGID??(Object)DBNull.Value;
parameters[2].Value = model.BGNDATE??(Object)DBNull.Value;
parameters[3].Value = model.ENDDATE??(Object)DBNull.Value;
parameters[4].Value = model.OPLBNAME??(Object)DBNull.Value;
parameters[5].Value = model.SALE??(Object)DBNull.Value;
parameters[6].Value = model.ACCTYPE??(Object)DBNull.Value;
parameters[7].Value = model.ACCSTARTDATE??(Object)DBNull.Value;
parameters[8].Value = model.ACCMONTH??(Object)DBNull.Value;
parameters[9].Value = model.ACCDAYS??(Object)DBNull.Value;
parameters[10].Value = model.ALLOWAMOUNT??(Object)DBNull.Value;
parameters[11].Value = model.MODIFIEDUSER??(Object)DBNull.Value;
parameters[12].Value = model.MODIFIEDTIME??(Object)DBNull.Value;
parameters[13].Value = model.REMARK??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 删除一条数据
/// </summary>
public int Delete(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from Info_Client_ACCDATE ");
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 Info_Client_ACCDATE ");
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, LINKGID, BGNDATE, ENDDATE, OPLBNAME, SALE, ACCTYPE, ACCSTARTDATE, ACCMONTH, ACCDAYS, ALLOWAMOUNT, MODIFIEDUSER, MODIFIEDTIME, REMARK ");
strSql.Append(" from Info_Client_ACCDATE ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50) };
parameters[0].Value = GID;
DSWeb.SoftMng.Model.Info_Client_ACCDATE model=new DSWeb.SoftMng.Model.Info_Client_ACCDATE();
return DbHelperSQL.Query(strSql.ToString(),parameters);
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM Info_Client_ACCDATE ");
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 Info_Client_ACCDATE ");
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 Info_Client_ACCDATE 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 Info_Client_ACCDATE ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.ExcuteScalarSQL(strSql.ToString());
}
}
}