383 lines
12 KiB
C#
383 lines
12 KiB
C#
/** 版本信息模板在安装目录下,可自行修改。
|
|
* draught_fan.cs
|
|
*
|
|
* 功 能: N/A
|
|
* 类 名: draught_fan
|
|
*
|
|
* Ver 变更日期 负责人 变更内容
|
|
* ───────────────────────────────────
|
|
* V0.01 2024/3/1 14:54:50 N/A 初版
|
|
*
|
|
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
|
*┌──────────────────────────────────┐
|
|
*│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
|
|
*│ 版权所有:动软卓越(北京)科技有限公司 │
|
|
*└──────────────────────────────────┘
|
|
*/
|
|
using System;
|
|
using System.Data;
|
|
using System.Text;
|
|
using MySql.Data.MySqlClient;
|
|
using Maticsoft.DBUtility;//Please add references
|
|
namespace DataServer.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:draught_fan
|
|
/// </summary>
|
|
public partial class draught_fan
|
|
{
|
|
public draught_fan()
|
|
{}
|
|
#region BasicMethod
|
|
|
|
/// <summary>
|
|
/// 是否存在该记录
|
|
/// </summary>
|
|
public bool Exists(string DraughtId)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select count(1) from draught_fan");
|
|
strSql.Append(" where DraughtId=@DraughtId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@DraughtId", MySqlDbType.VarChar,255) };
|
|
parameters[0].Value = DraughtId;
|
|
|
|
return DbHelperMySQL.Exists(strSql.ToString(),parameters);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(DataServer.Model.draught_fan model)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("insert into draught_fan(");
|
|
strSql.Append("DraughtId,DraughtName,DeviceNumber,DraughtNumberOne,DraughtNumberTwo,DraughtStateOne,DraughtStateTwo,ClientId,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@DraughtId,@DraughtName,@DeviceNumber,@DraughtNumberOne,@DraughtNumberTwo,@DraughtStateOne,@DraughtStateTwo,@ClientId,@Reserve1,@Reserve2,@Reserve3,@Reserve4,@Reserve5)");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@DraughtId", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtName", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DeviceNumber", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtNumberOne", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtNumberTwo", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtStateOne", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtStateTwo", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@ClientId", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve1", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve2", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve3", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve4", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve5", MySqlDbType.VarChar,255)};
|
|
parameters[0].Value = model.DraughtId;
|
|
parameters[1].Value = model.DraughtName;
|
|
parameters[2].Value = model.DeviceNumber;
|
|
parameters[3].Value = model.DraughtNumberOne;
|
|
parameters[4].Value = model.DraughtNumberTwo;
|
|
parameters[5].Value = model.DraughtStateOne;
|
|
parameters[6].Value = model.DraughtStateTwo;
|
|
parameters[7].Value = model.ClientId;
|
|
parameters[8].Value = model.Reserve1;
|
|
parameters[9].Value = model.Reserve2;
|
|
parameters[10].Value = model.Reserve3;
|
|
parameters[11].Value = model.Reserve4;
|
|
parameters[12].Value = model.Reserve5;
|
|
|
|
int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public bool Update(DataServer.Model.draught_fan model)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("update draught_fan set ");
|
|
strSql.Append("DraughtName=@DraughtName,");
|
|
strSql.Append("DeviceNumber=@DeviceNumber,");
|
|
strSql.Append("DraughtNumberOne=@DraughtNumberOne,");
|
|
strSql.Append("DraughtNumberTwo=@DraughtNumberTwo,");
|
|
strSql.Append("DraughtStateOne=@DraughtStateOne,");
|
|
strSql.Append("DraughtStateTwo=@DraughtStateTwo,");
|
|
strSql.Append("ClientId=@ClientId,");
|
|
strSql.Append("Reserve1=@Reserve1,");
|
|
strSql.Append("Reserve2=@Reserve2,");
|
|
strSql.Append("Reserve3=@Reserve3,");
|
|
strSql.Append("Reserve4=@Reserve4,");
|
|
strSql.Append("Reserve5=@Reserve5");
|
|
strSql.Append(" where DraughtId=@DraughtId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@DraughtName", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DeviceNumber", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtNumberOne", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtNumberTwo", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtStateOne", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtStateTwo", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@ClientId", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve1", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve2", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve3", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve4", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@Reserve5", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@DraughtId", MySqlDbType.VarChar,255)};
|
|
parameters[0].Value = model.DraughtName;
|
|
parameters[1].Value = model.DeviceNumber;
|
|
parameters[2].Value = model.DraughtNumberOne;
|
|
parameters[3].Value = model.DraughtNumberTwo;
|
|
parameters[4].Value = model.DraughtStateOne;
|
|
parameters[5].Value = model.DraughtStateTwo;
|
|
parameters[6].Value = model.ClientId;
|
|
parameters[7].Value = model.Reserve1;
|
|
parameters[8].Value = model.Reserve2;
|
|
parameters[9].Value = model.Reserve3;
|
|
parameters[10].Value = model.Reserve4;
|
|
parameters[11].Value = model.Reserve5;
|
|
parameters[12].Value = model.DraughtId;
|
|
|
|
int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(string DraughtId)
|
|
{
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("delete from draught_fan ");
|
|
strSql.Append(" where DraughtId=@DraughtId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@DraughtId", MySqlDbType.VarChar,255) };
|
|
parameters[0].Value = DraughtId;
|
|
|
|
int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 批量删除数据
|
|
/// </summary>
|
|
public bool DeleteList(string DraughtIdlist )
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("delete from draught_fan ");
|
|
strSql.Append(" where DraughtId in ("+DraughtIdlist + ") ");
|
|
int rows=DbHelperMySQL.ExecuteSql(strSql.ToString());
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public DataServer.Model.draught_fan GetModel(string DraughtId)
|
|
{
|
|
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select DraughtId,DraughtName,DeviceNumber,DraughtNumberOne,DraughtNumberTwo,DraughtStateOne,DraughtStateTwo,ClientId,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from draught_fan ");
|
|
strSql.Append(" where DraughtId=@DraughtId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@DraughtId", MySqlDbType.VarChar,255) };
|
|
parameters[0].Value = DraughtId;
|
|
|
|
DataServer.Model.draught_fan model=new DataServer.Model.draught_fan();
|
|
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
|
|
if(ds.Tables[0].Rows.Count>0)
|
|
{
|
|
return DataRowToModel(ds.Tables[0].Rows[0]);
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public DataServer.Model.draught_fan DataRowToModel(DataRow row)
|
|
{
|
|
DataServer.Model.draught_fan model=new DataServer.Model.draught_fan();
|
|
if (row != null)
|
|
{
|
|
if(row["DraughtId"]!=null)
|
|
{
|
|
model.DraughtId=row["DraughtId"].ToString();
|
|
}
|
|
if(row["DraughtName"]!=null)
|
|
{
|
|
model.DraughtName=row["DraughtName"].ToString();
|
|
}
|
|
if(row["DeviceNumber"]!=null)
|
|
{
|
|
model.DeviceNumber=row["DeviceNumber"].ToString();
|
|
}
|
|
if(row["DraughtNumberOne"]!=null)
|
|
{
|
|
model.DraughtNumberOne=row["DraughtNumberOne"].ToString();
|
|
}
|
|
if(row["DraughtNumberTwo"]!=null)
|
|
{
|
|
model.DraughtNumberTwo=row["DraughtNumberTwo"].ToString();
|
|
}
|
|
if(row["DraughtStateOne"]!=null)
|
|
{
|
|
model.DraughtStateOne=row["DraughtStateOne"].ToString();
|
|
}
|
|
if(row["DraughtStateTwo"]!=null)
|
|
{
|
|
model.DraughtStateTwo=row["DraughtStateTwo"].ToString();
|
|
}
|
|
if(row["ClientId"]!=null)
|
|
{
|
|
model.ClientId=row["ClientId"].ToString();
|
|
}
|
|
if(row["Reserve1"]!=null)
|
|
{
|
|
model.Reserve1=row["Reserve1"].ToString();
|
|
}
|
|
if(row["Reserve2"]!=null)
|
|
{
|
|
model.Reserve2=row["Reserve2"].ToString();
|
|
}
|
|
if(row["Reserve3"]!=null)
|
|
{
|
|
model.Reserve3=row["Reserve3"].ToString();
|
|
}
|
|
if(row["Reserve4"]!=null)
|
|
{
|
|
model.Reserve4=row["Reserve4"].ToString();
|
|
}
|
|
if(row["Reserve5"]!=null)
|
|
{
|
|
model.Reserve5=row["Reserve5"].ToString();
|
|
}
|
|
}
|
|
return model;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select DraughtId,DraughtName,DeviceNumber,DraughtNumberOne,DraughtNumberTwo,DraughtStateOne,DraughtStateTwo,ClientId,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 ");
|
|
strSql.Append(" FROM draught_fan ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return DbHelperMySQL.Query(strSql.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取记录总数
|
|
/// </summary>
|
|
public int GetRecordCount(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select count(1) FROM draught_fan ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
object obj = DbHelperSQL.GetSingle(strSql.ToString());
|
|
if (obj == null)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return Convert.ToInt32(obj);
|
|
}
|
|
}
|
|
/// <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 );
|
|
}
|
|
else
|
|
{
|
|
strSql.Append("order by T.DraughtId desc");
|
|
}
|
|
strSql.Append(")AS Row, T.* from draught_fan T ");
|
|
if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|
{
|
|
strSql.Append(" WHERE " + strWhere);
|
|
}
|
|
strSql.Append(" ) TT");
|
|
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
|
|
return DbHelperMySQL.Query(strSql.ToString());
|
|
}
|
|
|
|
/*
|
|
/// <summary>
|
|
/// 分页获取数据列表
|
|
/// </summary>
|
|
public DataSet GetList(int PageSize,int PageIndex,string strWhere)
|
|
{
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@tblName", MySqlDbType.VarChar, 255),
|
|
new MySqlParameter("@fldName", MySqlDbType.VarChar, 255),
|
|
new MySqlParameter("@PageSize", MySqlDbType.Int32),
|
|
new MySqlParameter("@PageIndex", MySqlDbType.Int32),
|
|
new MySqlParameter("@IsReCount", MySqlDbType.Bit),
|
|
new MySqlParameter("@OrderType", MySqlDbType.Bit),
|
|
new MySqlParameter("@strWhere", MySqlDbType.VarChar,1000),
|
|
};
|
|
parameters[0].Value = "draught_fan";
|
|
parameters[1].Value = "DraughtId";
|
|
parameters[2].Value = PageSize;
|
|
parameters[3].Value = PageIndex;
|
|
parameters[4].Value = 0;
|
|
parameters[5].Value = 0;
|
|
parameters[6].Value = strWhere;
|
|
return DbHelperMySQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
|
|
}*/
|
|
|
|
#endregion BasicMethod
|
|
#region ExtensionMethod
|
|
|
|
#endregion ExtensionMethod
|
|
}
|
|
}
|
|
|