303 lines
8.9 KiB
C#
303 lines
8.9 KiB
C#
/** 版本信息模板在安装目录下,可自行修改。
|
|
* pow_operation_ticket.cs
|
|
*
|
|
* 功 能: N/A
|
|
* 类 名: pow_operation_ticket
|
|
*
|
|
* Ver 变更日期 负责人 变更内容
|
|
* ───────────────────────────────────
|
|
* V0.01 2022/7/25 13:47:29 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;
|
|
|
|
namespace Competition.Mysql.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:pow_operation_ticket
|
|
/// </summary>
|
|
public partial class pow_operation_ticket
|
|
{
|
|
public pow_operation_ticket()
|
|
{}
|
|
#region BasicMethod
|
|
|
|
/// <summary>
|
|
/// 是否存在该记录
|
|
/// </summary>
|
|
public bool Exists(string OperationTicketId)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select count(1) from pow_operation_ticket");
|
|
strSql.Append(" where OperationTicketId=@OperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = OperationTicketId;
|
|
|
|
return DbHelperMySQL.Exists(strSql.ToString(), parameters);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(Competition.Mysql.Model.pow_operation_ticket model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into pow_operation_ticket(");
|
|
strSql.Append("OperationTicketId,Type,SerialNumber,Content)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@OperationTicketId,@Type,@SerialNumber,@Content)");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32),
|
|
new MySqlParameter("@Type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@SerialNumber", MySqlDbType.Int32),
|
|
new MySqlParameter("@Content", MySqlDbType.VarChar,2000)};
|
|
parameters[0].Value = model.OperationTicketId;
|
|
parameters[1].Value = model.Type;
|
|
parameters[2].Value = model.SerialNumber;
|
|
parameters[3].Value = model.Content;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public bool Update(Competition.Mysql.Model.pow_operation_ticket model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update pow_operation_ticket set ");
|
|
strSql.Append("Type=@Type,");
|
|
strSql.Append("SerialNumber=@SerialNumber,");
|
|
strSql.Append("Content=@Content");
|
|
strSql.Append(" where OperationTicketId=@OperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@Type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@SerialNumber", MySqlDbType.Int32),
|
|
new MySqlParameter("@Content", MySqlDbType.VarChar,2000),
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32)};
|
|
parameters[0].Value = model.Type;
|
|
parameters[1].Value = model.SerialNumber;
|
|
parameters[2].Value = model.Content;
|
|
parameters[3].Value = model.OperationTicketId;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(string OperationTicketId)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from pow_operation_ticket ");
|
|
strSql.Append(" where OperationTicketId=@OperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = OperationTicketId;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 批量删除数据
|
|
/// </summary>
|
|
public bool DeleteList(string OperationTicketIdlist)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from pow_operation_ticket ");
|
|
strSql.Append(" where OperationTicketId in (" + OperationTicketIdlist + ") ");
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString());
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public Competition.Mysql.Model.pow_operation_ticket GetModel(string OperationTicketId)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select OperationTicketId,Type,SerialNumber,Content from pow_operation_ticket ");
|
|
strSql.Append(" where OperationTicketId=@OperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = OperationTicketId;
|
|
|
|
Competition.Mysql.Model.pow_operation_ticket model = new Competition.Mysql.Model.pow_operation_ticket();
|
|
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 Competition.Mysql.Model.pow_operation_ticket DataRowToModel(DataRow row)
|
|
{
|
|
Competition.Mysql.Model.pow_operation_ticket model = new Competition.Mysql.Model.pow_operation_ticket();
|
|
if (row != null)
|
|
{
|
|
if (row["OperationTicketId"] != null)
|
|
{
|
|
model.OperationTicketId = row["OperationTicketId"].ToString();
|
|
}
|
|
if (row["Type"] != null)
|
|
{
|
|
model.Type = row["Type"].ToString();
|
|
}
|
|
if (row["SerialNumber"] != null && row["SerialNumber"].ToString() != "")
|
|
{
|
|
model.SerialNumber = int.Parse(row["SerialNumber"].ToString());
|
|
}
|
|
if (row["Content"] != null)
|
|
{
|
|
model.Content = row["Content"].ToString();
|
|
}
|
|
}
|
|
return model;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select OperationTicketId,Type,SerialNumber,Content ");
|
|
strSql.Append(" FROM pow_operation_ticket ");
|
|
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 pow_operation_ticket ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
object obj = DbHelperMySQL.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.OperationTicketId desc");
|
|
}
|
|
strSql.Append(")AS Row, T.* from pow_operation_ticket 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 = "pow_operation_ticket";
|
|
parameters[1].Value = "OperationTicketId";
|
|
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
|
|
}
|
|
}
|
|
|