Files
g.hnyhua.cn/Mtxfw.DAL/timer_control.cs
2026-02-07 15:48:27 +08:00

97 lines
2.8 KiB
C#

using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
namespace Mtxfw.DAL
{
/// <summary>
/// 数据访问类:city
/// </summary>
public partial class timer_control : Mtxfw.Utility.Myabstract
{
public timer_control()
: base("timer_control")
{ }
/// <summary>
/// <summary>
/// 更新一条数据
/// </summary>
public bool UpdateZXflag(string ZXSel, int ZXflag, DateTime ZXflagTime, int gtype)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update timer_control set ");
strSql.Append(ZXSel + "=@ZXflag,");
strSql.Append(ZXSel + "_Time" + "=@ZXflagTime");
strSql.Append(" where gtype=@gtype");
SqlParameter[] parameters = {
new SqlParameter("@ZXflag", SqlDbType.Int),
new SqlParameter("@ZXflagTime", SqlDbType.DateTime),
new SqlParameter("@gtype", SqlDbType.Int)};
parameters[0].Value = ZXflag;
parameters[1].Value = ZXflagTime;
parameters[2].Value = gtype;
int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(int id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from timer_control ");
strSql.Append(" where id=@id");
SqlParameter[] parameters = {
new SqlParameter("@id", SqlDbType.Int,4)
};
parameters[0].Value = id;
int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 获得数据列表
/// </summary>
public int GetZXflag(string selflag,ref DateTime ZXflagTime)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 " + selflag + "," + selflag + "_Time");
strSql.Append(" FROM timer_control a");
int ZXflag = 0;
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
if (ds.Tables[0].Rows.Count > 0)
{
ZXflag = Convert.ToInt32(ds.Tables[0].Rows[0][selflag]);
ZXflagTime = Convert.ToDateTime(ds.Tables[0].Rows[0][selflag+"_Time"]);
}
ds.Clear();
return ZXflag;
}
}
}