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

224 lines
8.4 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_Results_jl : Mtxfw.Utility.Myabstract
{
public user_Results_jl()
: base("user_Results_jl")
{ }
/// <summary>
/// 增加一条数据
/// </summary>
public Int64 Add(Mtxfw.Model.user_Results_jl model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into user_Results_jl(");
strSql.Append("MemberId,MemberIds,conent,Count1,Count2,Count3,Count4,SHFX,utype,addtime,gtype)");
strSql.Append(" values (");
strSql.Append("@MemberId,@MemberIds,@conent,@Count1,@Count2,@Count3,@Count4,@SHFX,@utype,@addtime,@gtype)");
strSql.Append(";select SCOPE_IDENTITY()");
SqlParameter[] parameters = {
new SqlParameter("@MemberId", SqlDbType.Int),
new SqlParameter("@MemberIds", SqlDbType.VarChar,8000),
new SqlParameter("@conent", SqlDbType.VarChar,8000),
new SqlParameter("@Count1", SqlDbType.Money),
new SqlParameter("@Count2", SqlDbType.Money),
new SqlParameter("@Count3", SqlDbType.Money),
new SqlParameter("@Count4", SqlDbType.Money),
new SqlParameter("@SHFX", SqlDbType.Int),
new SqlParameter("@utype", SqlDbType.Int),
new SqlParameter("@addtime", SqlDbType.DateTime),
new SqlParameter("@gtype", SqlDbType.Int)};
parameters[0].Value = model.MemberId;
parameters[1].Value = model.MemberIds;
parameters[2].Value = model.conent;
parameters[3].Value = model.Count1;
parameters[4].Value = model.Count2;
parameters[5].Value = model.Count3;
parameters[6].Value = model.Count4;
parameters[7].Value = model.SHFX;
parameters[8].Value = model.utype;
parameters[9].Value = model.addtime;
parameters[10].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 bool Delete(Int64 Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from user_Results_jl");
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;
}
}
public bool Delete(string where)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from user_Results_jl where " + where);
int rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString());
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 更新余额
/// </summary>
public int Updatemoney(string Sel,Double Addmoney, Int64 Id)
{
String sql = "update user_Results_jl set " + Sel + "=@Addmoney where Id=@Id";
SqlParameter[] para = { new SqlParameter("@Addmoney", SqlDbType.Money),
new SqlParameter("@Id", SqlDbType.BigInt) };
para[0].Value = Addmoney;
para[1].Value = Id;
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
}
/// <summary>
/// 更新余额
/// </summary>
public int Updatemoney0(string Sel,Double Addmoney, Int64 Id)
{
String sql = "update user_Results_jl set " + Sel + "=" + Sel + "+@Addmoney where Id=@Id";
SqlParameter[] para = { new SqlParameter("@Addmoney", SqlDbType.Money),
new SqlParameter("@Id", SqlDbType.BigInt) };
para[0].Value = Addmoney;
para[1].Value = Id;
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public Mtxfw.Model.user_Results_jl GetModel(Int64 Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 * from user_Results_jl");
strSql.Append(" where Id=@Id");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.BigInt)
};
parameters[0].Value = Id;
Mtxfw.Model.user_Results_jl model = new Mtxfw.Model.user_Results_jl();
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
{
model.Id = Int64.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
}
if (ds.Tables[0].Rows[0]["MemberId"].ToString() != "")
{
model.MemberId = int.Parse(ds.Tables[0].Rows[0]["MemberId"].ToString());
}
model.MemberIds = ds.Tables[0].Rows[0]["MemberIds"].ToString();
model.conent = ds.Tables[0].Rows[0]["conent"].ToString();
if (ds.Tables[0].Rows[0]["Count1"].ToString() != "")
{
model.Count1 = Double.Parse(ds.Tables[0].Rows[0]["Count1"].ToString());
}
if (ds.Tables[0].Rows[0]["Count2"].ToString() != "")
{
model.Count2 = Double.Parse(ds.Tables[0].Rows[0]["Count2"].ToString());
}
if (ds.Tables[0].Rows[0]["Count3"].ToString() != "")
{
model.Count3 = Double.Parse(ds.Tables[0].Rows[0]["Count3"].ToString());
}
if (ds.Tables[0].Rows[0]["Count4"].ToString() != "")
{
model.Count4 = Double.Parse(ds.Tables[0].Rows[0]["Count4"].ToString());
}
model.SHFX = int.Parse(ds.Tables[0].Rows[0]["SHFX"].ToString());
model.utype = int.Parse(ds.Tables[0].Rows[0]["utype"].ToString());
if (ds.Tables[0].Rows[0]["addtime"].ToString() != "")
{
model.addtime = DateTime.Parse(ds.Tables[0].Rows[0]["addtime"].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_Results_jl ");
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_Results_jl ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
strSql.Append(" order by " + filedOrder);
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
}
}
}