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

276 lines
14 KiB
C#

3 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
{
//op_softproject
public partial class op_softprojectDAL
{
public bool Exists(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from [op_softproject]");
strSql.Append(" where ");
strSql.Append(" GID = @GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) };
parameters[0].Value = GID;
return DbHelperSQL.Exists(strSql.ToString(),parameters);
}
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(DSWeb.SoftMng.Model.op_softproject model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into [op_softproject](");
strSql.Append("GID,BSNO,BSSTATUS,PROJECTNAME,CUSTOMERNAME,PROJECTDATE,PLANDATE,PROJECTDETAIL,MANAGEBY,AUDITBY,AUDITTIME,AUDITRESULT,MODIFYBY,MODIFYSTTIME,MODIFYEDTIME,MODIFYDETAIL,REMARKS,INPUTBY,INPUTTIME,OVERBY,OVERTIME");
strSql.Append(") values (");
strSql.Append("@GID,@BSNO,@BSSTATUS,@PROJECTNAME,@CUSTOMERNAME,@PROJECTDATE,@PLANDATE,@PROJECTDETAIL,@MANAGEBY,@AUDITBY,@AUDITTIME,@AUDITRESULT,@MODIFYBY,@MODIFYSTTIME,@MODIFYEDTIME,@MODIFYDETAIL,@REMARKS,@INPUTBY,@INPUTTIME,@OVERBY,@OVERTIME");
strSql.Append(") ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
new SqlParameter("@BSNO", SqlDbType.VarChar,36) ,
new SqlParameter("@BSSTATUS", SqlDbType.VarChar,40) ,
new SqlParameter("@PROJECTNAME", SqlDbType.VarChar,40) ,
new SqlParameter("@CUSTOMERNAME", SqlDbType.NVarChar,150) ,
new SqlParameter("@PROJECTDATE", SqlDbType.DateTime) ,
new SqlParameter("@PLANDATE", SqlDbType.DateTime) ,
new SqlParameter("@PROJECTDETAIL", SqlDbType.VarChar,-1) ,
new SqlParameter("@MANAGEBY", SqlDbType.VarChar,36) ,
new SqlParameter("@AUDITBY", SqlDbType.VarChar,36) ,
new SqlParameter("@AUDITTIME", SqlDbType.DateTime) ,
new SqlParameter("@AUDITRESULT", SqlDbType.VarChar,36) ,
new SqlParameter("@MODIFYBY", SqlDbType.VarChar,36) ,
new SqlParameter("@MODIFYSTTIME", SqlDbType.DateTime) ,
new SqlParameter("@MODIFYEDTIME", SqlDbType.DateTime) ,
new SqlParameter("@MODIFYDETAIL", SqlDbType.VarChar,-1) ,
new SqlParameter("@REMARKS", SqlDbType.VarChar,200) ,
new SqlParameter("@INPUTBY", SqlDbType.VarChar,36) ,
new SqlParameter("@INPUTTIME", SqlDbType.DateTime) ,
new SqlParameter("@OVERBY", SqlDbType.VarChar,36) ,
new SqlParameter("@OVERTIME", SqlDbType.DateTime)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.BSNO??(Object)DBNull.Value;
parameters[2].Value = model.BSSTATUS??(Object)DBNull.Value;
parameters[3].Value = model.PROJECTNAME??(Object)DBNull.Value;
parameters[4].Value = model.CUSTOMERNAME??(Object)DBNull.Value;
parameters[5].Value = model.PROJECTDATE??(Object)DBNull.Value;
parameters[6].Value = model.PLANDATE??(Object)DBNull.Value;
parameters[7].Value = model.PROJECTDETAIL??(Object)DBNull.Value;
parameters[8].Value = model.MANAGEBY??(Object)DBNull.Value;
parameters[9].Value = model.AUDITBY??(Object)DBNull.Value;
parameters[10].Value = model.AUDITTIME??(Object)DBNull.Value;
parameters[11].Value = model.AUDITRESULT??(Object)DBNull.Value;
parameters[12].Value = model.MODIFYBY??(Object)DBNull.Value;
parameters[13].Value = model.MODIFYSTTIME??(Object)DBNull.Value;
parameters[14].Value = model.MODIFYEDTIME??(Object)DBNull.Value;
parameters[15].Value = model.MODIFYDETAIL??(Object)DBNull.Value;
parameters[16].Value = model.REMARKS??(Object)DBNull.Value;
parameters[17].Value = model.INPUTBY??(Object)DBNull.Value;
parameters[18].Value = model.INPUTTIME??(Object)DBNull.Value;
parameters[19].Value = model.OVERBY??(Object)DBNull.Value;
parameters[20].Value = model.OVERTIME??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(DSWeb.SoftMng.Model.op_softproject model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("update [op_softproject] set ");
strSql.Append(" GID = @GID,");
strSql.Append(" BSNO = @BSNO,");
strSql.Append(" BSSTATUS = @BSSTATUS,");
strSql.Append(" PROJECTNAME = @PROJECTNAME,");
strSql.Append(" CUSTOMERNAME = @CUSTOMERNAME,");
strSql.Append(" PROJECTDATE = @PROJECTDATE,");
strSql.Append(" PLANDATE = @PLANDATE,");
strSql.Append(" PROJECTDETAIL = @PROJECTDETAIL,");
strSql.Append(" MANAGEBY = @MANAGEBY,");
strSql.Append(" AUDITBY = @AUDITBY,");
strSql.Append(" AUDITTIME = @AUDITTIME,");
strSql.Append(" AUDITRESULT = @AUDITRESULT,");
strSql.Append(" MODIFYBY = @MODIFYBY,");
strSql.Append(" MODIFYSTTIME = @MODIFYSTTIME,");
strSql.Append(" MODIFYEDTIME = @MODIFYEDTIME,");
strSql.Append(" MODIFYDETAIL = @MODIFYDETAIL,");
strSql.Append(" REMARKS = @REMARKS,");
strSql.Append(" INPUTBY = @INPUTBY,");
strSql.Append(" INPUTTIME = @INPUTTIME,");
strSql.Append(" OVERBY = @OVERBY,");
strSql.Append(" OVERTIME = @OVERTIME");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
new SqlParameter("@BSNO", SqlDbType.VarChar,36) ,
new SqlParameter("@BSSTATUS", SqlDbType.VarChar,40) ,
new SqlParameter("@PROJECTNAME", SqlDbType.VarChar,40) ,
new SqlParameter("@CUSTOMERNAME", SqlDbType.NVarChar,150) ,
new SqlParameter("@PROJECTDATE", SqlDbType.DateTime) ,
new SqlParameter("@PLANDATE", SqlDbType.DateTime) ,
new SqlParameter("@PROJECTDETAIL", SqlDbType.VarChar,-1) ,
new SqlParameter("@MANAGEBY", SqlDbType.VarChar,36) ,
new SqlParameter("@AUDITBY", SqlDbType.VarChar,36) ,
new SqlParameter("@AUDITTIME", SqlDbType.DateTime) ,
new SqlParameter("@AUDITRESULT", SqlDbType.VarChar,36) ,
new SqlParameter("@MODIFYBY", SqlDbType.VarChar,36) ,
new SqlParameter("@MODIFYSTTIME", SqlDbType.DateTime) ,
new SqlParameter("@MODIFYEDTIME", SqlDbType.DateTime) ,
new SqlParameter("@MODIFYDETAIL", SqlDbType.VarChar,-1) ,
new SqlParameter("@REMARKS", SqlDbType.VarChar,200) ,
new SqlParameter("@INPUTBY", SqlDbType.VarChar,36) ,
new SqlParameter("@INPUTTIME", SqlDbType.DateTime) ,
new SqlParameter("@OVERBY", SqlDbType.VarChar,36) ,
new SqlParameter("@OVERTIME", SqlDbType.DateTime)
};
parameters[0].Value = model.GID??(Object)DBNull.Value;
parameters[1].Value = model.BSNO??(Object)DBNull.Value;
parameters[2].Value = model.BSSTATUS??(Object)DBNull.Value;
parameters[3].Value = model.PROJECTNAME??(Object)DBNull.Value;
parameters[4].Value = model.CUSTOMERNAME??(Object)DBNull.Value;
parameters[5].Value = model.PROJECTDATE??(Object)DBNull.Value;
parameters[6].Value = model.PLANDATE??(Object)DBNull.Value;
parameters[7].Value = model.PROJECTDETAIL??(Object)DBNull.Value;
parameters[8].Value = model.MANAGEBY??(Object)DBNull.Value;
parameters[9].Value = model.AUDITBY??(Object)DBNull.Value;
parameters[10].Value = model.AUDITTIME??(Object)DBNull.Value;
parameters[11].Value = model.AUDITRESULT??(Object)DBNull.Value;
parameters[12].Value = model.MODIFYBY??(Object)DBNull.Value;
parameters[13].Value = model.MODIFYSTTIME??(Object)DBNull.Value;
parameters[14].Value = model.MODIFYEDTIME??(Object)DBNull.Value;
parameters[15].Value = model.MODIFYDETAIL??(Object)DBNull.Value;
parameters[16].Value = model.REMARKS??(Object)DBNull.Value;
parameters[17].Value = model.INPUTBY??(Object)DBNull.Value;
parameters[18].Value = model.INPUTTIME??(Object)DBNull.Value;
parameters[19].Value = model.OVERBY??(Object)DBNull.Value;
parameters[20].Value = model.OVERTIME??(Object)DBNull.Value;
return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}
/// <summary>
/// 删除一条数据
/// </summary>
public int Delete(string GID)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from [op_softproject] ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) };
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 [op_softproject] ");
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, BSNO, BSSTATUS, PROJECTNAME, CUSTOMERNAME, PROJECTDATE, PLANDATE, PROJECTDETAIL, MANAGEBY, AUDITBY, AUDITTIME, AUDITRESULT, MODIFYBY, MODIFYSTTIME, MODIFYEDTIME, MODIFYDETAIL, REMARKS, INPUTBY, INPUTTIME, OVERBY, OVERTIME ");
strSql.Append(" from [op_softproject] ");
strSql.Append(" where GID=@GID ");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,36) };
parameters[0].Value = GID;
DSWeb.SoftMng.Model.op_softproject model=new DSWeb.SoftMng.Model.op_softproject();
return DbHelperSQL.Query(strSql.ToString(),parameters);
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM [op_softproject] ");
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 [op_softproject] ");
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 [op_softproject] 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 [op_softproject] ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.ExcuteScalarSQL(strSql.ToString());
}
}
}