208 lines
7.8 KiB
C#
208 lines
7.8 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Mtxfw.DAL
|
|
{
|
|
/// <summary>
|
|
/// 数据访问类:user_Results
|
|
/// </summary>
|
|
public partial class user_zzjf_log : Mtxfw.Utility.Myabstract
|
|
{
|
|
public user_zzjf_log()
|
|
: base("user_zzjf_log")
|
|
{ }
|
|
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public Int64 Add(Mtxfw.Model.user_zzjf_log model)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into user_zzjf_log(");
|
|
strSql.Append("num,zznum,zzjg,zzjf,xzjf,addtime,seef,seeftime,gtype)");
|
|
strSql.Append(" values (");
|
|
strSql.Append("@num,@zznum,@zzjg,@zzjf,@xzjf,@addtime,@seef,@seeftime,@gtype)");
|
|
strSql.Append(";select SCOPE_IDENTITY()");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@num", SqlDbType.Decimal),
|
|
new SqlParameter("@zznum", SqlDbType.Decimal),
|
|
new SqlParameter("@zzjg", SqlDbType.Decimal),
|
|
new SqlParameter("@zzjf", SqlDbType.Decimal),
|
|
new SqlParameter("@xzjf", SqlDbType.Decimal),
|
|
new SqlParameter("@addtime", SqlDbType.DateTime),
|
|
new SqlParameter("@seef", SqlDbType.Int),
|
|
new SqlParameter("@seeftime", SqlDbType.DateTime),
|
|
new SqlParameter("@gtype", SqlDbType.Int)};
|
|
parameters[0].Value = model.num;
|
|
parameters[1].Value = model.zznum;
|
|
parameters[2].Value = model.zzjg;
|
|
parameters[3].Value = model.zzjf;
|
|
parameters[4].Value = model.xzjf;
|
|
parameters[5].Value = model.addtime;
|
|
parameters[6].Value = model.seef;
|
|
parameters[7].Value = model.seeftime;
|
|
parameters[8].Value = model.gtype;
|
|
string obj = Mtxfw.Utility.SqlDbHelper_U.GetObject(strSql.ToString(), parameters).ToString();
|
|
if (obj == "")
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return Convert.ToInt64(obj);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 审核或者假删除
|
|
/// </summary>
|
|
public int UpdateSeef(string Sel, int SelValue, string Sel2, DateTime dt, Int64 id)
|
|
{
|
|
String sql = "update user_zzjf_log set " + Sel + "=@SelValue," + Sel2 + "=@dt where id=@id";
|
|
SqlParameter[] para = { new SqlParameter("@SelValue", SqlDbType.Int),
|
|
new SqlParameter("@dt", SqlDbType.DateTime),
|
|
new SqlParameter("@id", SqlDbType.BigInt) };
|
|
para[0].Value = SelValue;
|
|
para[1].Value = dt;
|
|
para[2].Value = id;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新激活状态
|
|
/// </summary>
|
|
public int UpdateSeef(int SelValue, Int64 id)
|
|
{
|
|
String sql = "update user_zzjf_log set seef=@SelValue where id=@id";
|
|
SqlParameter[] para = { new SqlParameter("@SelValue", SqlDbType.Int),
|
|
new SqlParameter("@id", SqlDbType.BigInt)};
|
|
para[0].Value = SelValue;
|
|
para[1].Value = id;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
|
}
|
|
/// <summary>
|
|
/// 更新激活时间
|
|
/// </summary>
|
|
public int UpdateSeef(DateTime dt, Int64 id)
|
|
{
|
|
String sql = "update user_zzjf_log set seeftime=@dt where id=@id";
|
|
SqlParameter[] para = { new SqlParameter("@dt", SqlDbType.DateTime),
|
|
new SqlParameter("@id", SqlDbType.BigInt)};
|
|
para[0].Value = dt;
|
|
para[1].Value = id;
|
|
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(Int64 id)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("delete from user_zzjf_log");
|
|
strSql.Append(" where id=@id");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@id", SqlDbType.BigInt)
|
|
};
|
|
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 Mtxfw.Model.user_zzjf_log GetModel(Int64 id)
|
|
{
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select top 1 * from user_zzjf_log");
|
|
strSql.Append(" where id=@id");
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@id", SqlDbType.BigInt)
|
|
};
|
|
parameters[0].Value = id;
|
|
|
|
Mtxfw.Model.user_zzjf_log model = new Mtxfw.Model.user_zzjf_log();
|
|
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
model.id = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString());
|
|
model.num = Convert.ToDecimal(ds.Tables[0].Rows[0]["num"].ToString());
|
|
model.zznum = Convert.ToDecimal(ds.Tables[0].Rows[0]["zznum"].ToString());
|
|
model.zzjg = Convert.ToDecimal(ds.Tables[0].Rows[0]["zzjg"].ToString());
|
|
model.zzjf = Convert.ToDecimal(ds.Tables[0].Rows[0]["zzjf"].ToString());
|
|
if (ds.Tables[0].Rows[0]["addtime"].ToString() != "")
|
|
{
|
|
model.addtime = DateTime.Parse(ds.Tables[0].Rows[0]["addtime"].ToString());
|
|
}
|
|
model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString());
|
|
if (ds.Tables[0].Rows[0]["seeftime"].ToString() != "")
|
|
{
|
|
model.seeftime = DateTime.Parse(ds.Tables[0].Rows[0]["seeftime"].ToString());
|
|
}
|
|
model.IFDelete = int.Parse(ds.Tables[0].Rows[0]["IFDelete"].ToString());
|
|
if (ds.Tables[0].Rows[0]["IFDeleteTime"].ToString() != "")
|
|
{
|
|
model.IFDeleteTime = DateTime.Parse(ds.Tables[0].Rows[0]["IFDeleteTime"].ToString());
|
|
}
|
|
model.gtype = int.Parse(ds.Tables[0].Rows[0]["gtype"].ToString());
|
|
return model;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public DataSet GetList(string strWhere)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select * ");
|
|
strSql.Append(" FROM user_zzjf_log ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得前几行数据
|
|
/// </summary>
|
|
public DataSet GetList(int Top, string strWhere, string filedOrder)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select ");
|
|
if (Top > 0)
|
|
{
|
|
strSql.Append(" top " + Top.ToString());
|
|
}
|
|
strSql.Append(" * ");
|
|
strSql.Append(" FROM user_zzjf_log ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
strSql.Append(" order by " + filedOrder);
|
|
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
|
}
|
|
|
|
}
|
|
}
|
|
|