352 lines
12 KiB
C#
352 lines
12 KiB
C#
/** 版本信息模板在安装目录下,可自行修改。
|
|
* pow_exam_operation_ticket.cs
|
|
*
|
|
* 功 能: N/A
|
|
* 类 名: pow_exam_operation_ticket
|
|
*
|
|
* Ver 变更日期 负责人 变更内容
|
|
* ───────────────────────────────────
|
|
* V0.01 2022/7/25 13:57:38 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;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Competition.Mysql.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:pow_exam_operation_ticket
|
|
/// </summary>
|
|
public partial class pow_exam_operation_ticket
|
|
{
|
|
public pow_exam_operation_ticket()
|
|
{ }
|
|
#region BasicMethod
|
|
|
|
/// <summary>
|
|
/// 是否存在该记录
|
|
/// </summary>
|
|
public bool Exists(string ExamOperationTicketId)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select count(1) from pow_exam_operation_ticket");
|
|
strSql.Append(" where ExamOperationTicketId=@ExamOperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamOperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = ExamOperationTicketId;
|
|
|
|
return DbHelperMySQL.Exists(strSql.ToString(), parameters);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(Competition.Mysql.Model.pow_exam_operation_ticket model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into pow_exam_operation_ticket(");
|
|
strSql.Append("ExamOperationTicketId,ExamId,OperationTicketId,Type,SerialNumber,Content)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@ExamOperationTicketId,@ExamId,@OperationTicketId,@Type,@SerialNumber,@Content)");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamOperationTicketId", MySqlDbType.VarChar,32),
|
|
new MySqlParameter("@ExamId", MySqlDbType.VarChar,32),
|
|
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.ExamOperationTicketId;
|
|
parameters[1].Value = model.ExamId;
|
|
parameters[2].Value = model.OperationTicketId;
|
|
parameters[3].Value = model.Type;
|
|
parameters[4].Value = model.SerialNumber;
|
|
parameters[5].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_exam_operation_ticket model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update pow_exam_operation_ticket set ");
|
|
strSql.Append("ExamId=@ExamId,");
|
|
strSql.Append("OperationTicketId=@OperationTicketId,");
|
|
strSql.Append("Type=@Type,");
|
|
strSql.Append("SerialNumber=@SerialNumber,");
|
|
strSql.Append("Content=@Content");
|
|
strSql.Append(" where ExamOperationTicketId=@ExamOperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamId", MySqlDbType.VarChar,32),
|
|
new MySqlParameter("@OperationTicketId", MySqlDbType.VarChar,32),
|
|
new MySqlParameter("@Type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@SerialNumber", MySqlDbType.Int32),
|
|
new MySqlParameter("@Content", MySqlDbType.VarChar,2000),
|
|
new MySqlParameter("@ExamOperationTicketId", MySqlDbType.VarChar,32)};
|
|
parameters[0].Value = model.ExamId;
|
|
parameters[1].Value = model.OperationTicketId;
|
|
parameters[2].Value = model.Type;
|
|
parameters[3].Value = model.SerialNumber;
|
|
parameters[4].Value = model.Content;
|
|
parameters[5].Value = model.ExamOperationTicketId;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(string ExamOperationTicketId)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from pow_exam_operation_ticket ");
|
|
strSql.Append(" where ExamOperationTicketId=@ExamOperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamOperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = ExamOperationTicketId;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 批量删除数据
|
|
/// </summary>
|
|
public bool DeleteList(string ExamOperationTicketIdlist)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from pow_exam_operation_ticket ");
|
|
strSql.Append(" where ExamOperationTicketId in (" + ExamOperationTicketIdlist + ") ");
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString());
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public Competition.Mysql.Model.pow_exam_operation_ticket GetModel(string ExamOperationTicketId)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select ExamOperationTicketId,ExamId,OperationTicketId,Type,SerialNumber,Content from pow_exam_operation_ticket ");
|
|
strSql.Append(" where ExamOperationTicketId=@ExamOperationTicketId ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamOperationTicketId", MySqlDbType.VarChar,32) };
|
|
parameters[0].Value = ExamOperationTicketId;
|
|
|
|
Competition.Mysql.Model.pow_exam_operation_ticket model = new Competition.Mysql.Model.pow_exam_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_exam_operation_ticket DataRowToModel(DataRow row)
|
|
{
|
|
Competition.Mysql.Model.pow_exam_operation_ticket model = new Competition.Mysql.Model.pow_exam_operation_ticket();
|
|
if (row != null)
|
|
{
|
|
if (row["ExamOperationTicketId"] != null)
|
|
{
|
|
model.ExamOperationTicketId = row["ExamOperationTicketId"].ToString();
|
|
}
|
|
if (row["ExamId"] != null)
|
|
{
|
|
model.ExamId = row["ExamId"].ToString();
|
|
}
|
|
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 ExamOperationTicketId,ExamId,OperationTicketId,Type,SerialNumber,Content ");
|
|
strSql.Append(" FROM pow_exam_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_exam_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.ExamOperationTicketId desc");
|
|
}
|
|
strSql.Append(")AS Row, T.* from pow_exam_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_exam_operation_ticket";
|
|
parameters[1].Value = "ExamOperationTicketId";
|
|
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
|
|
/// <summary>
|
|
/// 使用事务批量操作修改
|
|
/// </summary>
|
|
/// <param name="exam_ticket_list">数据</param>
|
|
/// <returns></returns>
|
|
public int OperationUpdateData(List<Competition.Mysql.Model.pow_exam_operation_ticket> exam_ticket_list)
|
|
{
|
|
List<CommandInfo> com = new List<CommandInfo>();
|
|
if (exam_ticket_list.Count == 0)
|
|
{
|
|
return 0;
|
|
}
|
|
foreach (var item in exam_ticket_list)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update pow_exam_operation_ticket set ");
|
|
strSql.Append("Content=@Content");
|
|
strSql.Append(" where ExamId=@ExamId and Type=@Type and SerialNumber=@SerialNumber ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@ExamId", MySqlDbType.VarChar,32),
|
|
new MySqlParameter("@Type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@SerialNumber", MySqlDbType.Int32),
|
|
new MySqlParameter("@Content", MySqlDbType.VarChar,2000)};
|
|
parameters[0].Value = item.ExamId;
|
|
parameters[1].Value = item.Type;
|
|
parameters[2].Value = item.SerialNumber;
|
|
parameters[3].Value = item.Content;
|
|
com.Add(new CommandInfo(strSql.ToString(), parameters));
|
|
}
|
|
return DbHelperMySQL.ExecuteSqlTran(com);
|
|
}
|
|
#endregion ExtensionMethod
|
|
}
|
|
}
|
|
|