437 lines
18 KiB
C#
437 lines
18 KiB
C#
/** 版本信息模板在安装目录下,可自行修改。
|
|
* app_place_check.cs
|
|
*
|
|
* 功 能: N/A
|
|
* 类 名: app_place_check
|
|
*
|
|
* Ver 变更日期 负责人 变更内容
|
|
* ───────────────────────────────────
|
|
* V0.01 2024/11/13 14:49:43 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 Competition.Mysql.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:app_place_check
|
|
/// </summary>
|
|
public partial class app_place_check
|
|
{
|
|
public app_place_check()
|
|
{}
|
|
#region BasicMethod
|
|
|
|
/// <summary>
|
|
/// 是否存在该记录
|
|
/// </summary>
|
|
public bool Exists(string id)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select count(1) from app_place_check");
|
|
strSql.Append(" where id=@id ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@id", MySqlDbType.VarChar,50) };
|
|
parameters[0].Value = id;
|
|
|
|
return DbHelperMySQL.Exists(strSql.ToString(), parameters);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(Competition.Mysql.Model.app_place_check model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into app_place_check(");
|
|
strSql.Append("id,client_id,verify_capacity,power_voltage,power_type,if_has_project_flag,if_jiakong,if_yulinbiao,if_new_point,power_plan_note,accept_power_time,zhuangong_flag,plan_notice_client,accept_plan_id,collect_id,create_time,r1,r2,r3)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@id,@client_id,@verify_capacity,@power_voltage,@power_type,@if_has_project_flag,@if_jiakong,@if_yulinbiao,@if_new_point,@power_plan_note,@accept_power_time,@zhuangong_flag,@plan_notice_client,@accept_plan_id,@collect_id,@create_time,@r1,@r2,@r3)");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@id", MySqlDbType.VarChar,50),
|
|
new MySqlParameter("@client_id", MySqlDbType.VarChar,50),
|
|
new MySqlParameter("@verify_capacity", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_voltage", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_has_project_flag", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_jiakong", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_yulinbiao", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_new_point", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_plan_note", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@accept_power_time", MySqlDbType.DateTime),
|
|
new MySqlParameter("@zhuangong_flag", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@plan_notice_client", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@accept_plan_id", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@collect_id", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@create_time", MySqlDbType.DateTime),
|
|
new MySqlParameter("@r1", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@r2", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@r3", MySqlDbType.VarChar,255)};
|
|
parameters[0].Value = model.id;
|
|
parameters[1].Value = model.client_id;
|
|
parameters[2].Value = model.verify_capacity;
|
|
parameters[3].Value = model.power_voltage;
|
|
parameters[4].Value = model.power_type;
|
|
parameters[5].Value = model.if_has_project_flag;
|
|
parameters[6].Value = model.if_jiakong;
|
|
parameters[7].Value = model.if_yulinbiao;
|
|
parameters[8].Value = model.if_new_point;
|
|
parameters[9].Value = model.power_plan_note;
|
|
parameters[10].Value = model.accept_power_time;
|
|
parameters[11].Value = model.zhuangong_flag;
|
|
parameters[12].Value = model.plan_notice_client;
|
|
parameters[13].Value = model.accept_plan_id;
|
|
parameters[14].Value = model.collect_id;
|
|
parameters[15].Value = model.create_time;
|
|
parameters[16].Value = model.r1;
|
|
parameters[17].Value = model.r2;
|
|
parameters[18].Value = model.r3;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public bool Update(Competition.Mysql.Model.app_place_check model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update app_place_check set ");
|
|
strSql.Append("client_id=@client_id,");
|
|
strSql.Append("verify_capacity=@verify_capacity,");
|
|
strSql.Append("power_voltage=@power_voltage,");
|
|
strSql.Append("power_type=@power_type,");
|
|
strSql.Append("if_has_project_flag=@if_has_project_flag,");
|
|
strSql.Append("if_jiakong=@if_jiakong,");
|
|
strSql.Append("if_yulinbiao=@if_yulinbiao,");
|
|
strSql.Append("if_new_point=@if_new_point,");
|
|
strSql.Append("power_plan_note=@power_plan_note,");
|
|
strSql.Append("accept_power_time=@accept_power_time,");
|
|
strSql.Append("zhuangong_flag=@zhuangong_flag,");
|
|
strSql.Append("plan_notice_client=@plan_notice_client,");
|
|
strSql.Append("accept_plan_id=@accept_plan_id,");
|
|
strSql.Append("collect_id=@collect_id,");
|
|
strSql.Append("create_time=@create_time,");
|
|
strSql.Append("r1=@r1,");
|
|
strSql.Append("r2=@r2,");
|
|
strSql.Append("r3=@r3");
|
|
strSql.Append(" where id=@id ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@client_id", MySqlDbType.VarChar,50),
|
|
new MySqlParameter("@verify_capacity", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_voltage", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_type", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_has_project_flag", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_jiakong", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_yulinbiao", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@if_new_point", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@power_plan_note", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@accept_power_time", MySqlDbType.DateTime),
|
|
new MySqlParameter("@zhuangong_flag", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@plan_notice_client", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@accept_plan_id", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@collect_id", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@create_time", MySqlDbType.DateTime),
|
|
new MySqlParameter("@r1", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@r2", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@r3", MySqlDbType.VarChar,255),
|
|
new MySqlParameter("@id", MySqlDbType.VarChar,50)};
|
|
parameters[0].Value = model.client_id;
|
|
parameters[1].Value = model.verify_capacity;
|
|
parameters[2].Value = model.power_voltage;
|
|
parameters[3].Value = model.power_type;
|
|
parameters[4].Value = model.if_has_project_flag;
|
|
parameters[5].Value = model.if_jiakong;
|
|
parameters[6].Value = model.if_yulinbiao;
|
|
parameters[7].Value = model.if_new_point;
|
|
parameters[8].Value = model.power_plan_note;
|
|
parameters[9].Value = model.accept_power_time;
|
|
parameters[10].Value = model.zhuangong_flag;
|
|
parameters[11].Value = model.plan_notice_client;
|
|
parameters[12].Value = model.accept_plan_id;
|
|
parameters[13].Value = model.collect_id;
|
|
parameters[14].Value = model.create_time;
|
|
parameters[15].Value = model.r1;
|
|
parameters[16].Value = model.r2;
|
|
parameters[17].Value = model.r3;
|
|
parameters[18].Value = model.id;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(string id)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from app_place_check ");
|
|
strSql.Append(" where id=@id ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@id", MySqlDbType.VarChar,50) };
|
|
parameters[0].Value = id;
|
|
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 批量删除数据
|
|
/// </summary>
|
|
public bool DeleteList(string idlist)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from app_place_check ");
|
|
strSql.Append(" where id in (" + idlist + ") ");
|
|
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString());
|
|
if (rows > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 得到一个对象实体
|
|
/// </summary>
|
|
public Competition.Mysql.Model.app_place_check GetModel(string id)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select id,client_id,verify_capacity,power_voltage,power_type,if_has_project_flag,if_jiakong,if_yulinbiao,if_new_point,power_plan_note,accept_power_time,zhuangong_flag,plan_notice_client,accept_plan_id,collect_id,create_time,r1,r2,r3 from app_place_check ");
|
|
strSql.Append(" where id=@id ");
|
|
MySqlParameter[] parameters = {
|
|
new MySqlParameter("@id", MySqlDbType.VarChar,50) };
|
|
parameters[0].Value = id;
|
|
|
|
Competition.Mysql.Model.app_place_check model = new Competition.Mysql.Model.app_place_check();
|
|
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.app_place_check DataRowToModel(DataRow row)
|
|
{
|
|
Competition.Mysql.Model.app_place_check model = new Competition.Mysql.Model.app_place_check();
|
|
if (row != null)
|
|
{
|
|
if (row["id"] != null)
|
|
{
|
|
model.id = row["id"].ToString();
|
|
}
|
|
if (row["client_id"] != null)
|
|
{
|
|
model.client_id = row["client_id"].ToString();
|
|
}
|
|
if (row["verify_capacity"] != null)
|
|
{
|
|
model.verify_capacity = row["verify_capacity"].ToString();
|
|
}
|
|
if (row["power_voltage"] != null)
|
|
{
|
|
model.power_voltage = row["power_voltage"].ToString();
|
|
}
|
|
if (row["power_type"] != null)
|
|
{
|
|
model.power_type = row["power_type"].ToString();
|
|
}
|
|
if (row["if_has_project_flag"] != null)
|
|
{
|
|
model.if_has_project_flag = row["if_has_project_flag"].ToString();
|
|
}
|
|
if (row["if_jiakong"] != null)
|
|
{
|
|
model.if_jiakong = row["if_jiakong"].ToString();
|
|
}
|
|
if (row["if_yulinbiao"] != null)
|
|
{
|
|
model.if_yulinbiao = row["if_yulinbiao"].ToString();
|
|
}
|
|
if (row["if_new_point"] != null)
|
|
{
|
|
model.if_new_point = row["if_new_point"].ToString();
|
|
}
|
|
if (row["power_plan_note"] != null)
|
|
{
|
|
model.power_plan_note = row["power_plan_note"].ToString();
|
|
}
|
|
if (row["accept_power_time"] != null && row["accept_power_time"].ToString() != "")
|
|
{
|
|
model.accept_power_time = DateTime.Parse(row["accept_power_time"].ToString());
|
|
}
|
|
if (row["zhuangong_flag"] != null)
|
|
{
|
|
model.zhuangong_flag = row["zhuangong_flag"].ToString();
|
|
}
|
|
if (row["plan_notice_client"] != null)
|
|
{
|
|
model.plan_notice_client = row["plan_notice_client"].ToString();
|
|
}
|
|
if (row["accept_plan_id"] != null)
|
|
{
|
|
model.accept_plan_id = row["accept_plan_id"].ToString();
|
|
}
|
|
if (row["collect_id"] != null)
|
|
{
|
|
model.collect_id = row["collect_id"].ToString();
|
|
}
|
|
if (row["create_time"] != null && row["create_time"].ToString() != "")
|
|
{
|
|
model.create_time = DateTime.Parse(row["create_time"].ToString());
|
|
}
|
|
if (row["r1"] != null)
|
|
{
|
|
model.r1 = row["r1"].ToString();
|
|
}
|
|
if (row["r2"] != null)
|
|
{
|
|
model.r2 = row["r2"].ToString();
|
|
}
|
|
if (row["r3"] != null)
|
|
{
|
|
model.r3 = row["r3"].ToString();
|
|
}
|
|
}
|
|
return model;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select id,client_id,verify_capacity,power_voltage,power_type,if_has_project_flag,if_jiakong,if_yulinbiao,if_new_point,power_plan_note,accept_power_time,zhuangong_flag,plan_notice_client,accept_plan_id,collect_id,create_time,r1,r2,r3 ");
|
|
strSql.Append(" FROM app_place_check ");
|
|
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 app_place_check ");
|
|
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.id desc");
|
|
}
|
|
strSql.Append(")AS Row, T.* from app_place_check 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 = "app_place_check";
|
|
parameters[1].Value = "id";
|
|
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
|
|
}
|
|
}
|
|
|