首次推送
This commit is contained in:
190
Mtxfw.DAL/user_RestDay.cs
Normal file
190
Mtxfw.DAL/user_RestDay.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Mtxfw.DAL
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>:user_Results
|
||||
/// </summary>
|
||||
public partial class user_RestDay : Mtxfw.Utility.Myabstract
|
||||
{
|
||||
public user_RestDay()
|
||||
: base("user_RestDay")
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Add(Mtxfw.Model.user_RestDay model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("insert into user_RestDay(");
|
||||
strSql.Append("MemberId,IFLeday,Startdate,Enddate,utype,addtime,gtype)");
|
||||
strSql.Append(" values (");
|
||||
strSql.Append("@MemberId,@IFLeday,@Startdate,@Enddate,@utype,@addtime,@gtype)");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@MemberId", SqlDbType.Int),
|
||||
new SqlParameter("@IFLeday", SqlDbType.Int),
|
||||
new SqlParameter("@Startdate", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Enddate", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@utype", SqlDbType.Int),
|
||||
new SqlParameter("@addtime", SqlDbType.DateTime),
|
||||
new SqlParameter("@gtype", SqlDbType.Int)};
|
||||
parameters[0].Value = model.MemberId;
|
||||
parameters[1].Value = model.IFLeday;
|
||||
parameters[2].Value = model.Startdate;
|
||||
parameters[3].Value = model.Enddate;
|
||||
parameters[4].Value = model.utype;
|
||||
parameters[5].Value = model.addtime;
|
||||
parameters[6].Value = model.gtype;
|
||||
object obj = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
if (obj == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>¸<EFBFBD><C2B8><EFBFBD>
|
||||
/// </summary>
|
||||
public int Update(int IFLeday, string Startdate,string Enddate, Int64 Id)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("Update user_RestDay Set ");
|
||||
strSql.Append("IFLeday=@IFLeday");
|
||||
strSql.Append(",Startdate=@Startdate");
|
||||
strSql.Append(",Enddate=@Enddate");
|
||||
strSql.Append(" Where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@IFLeday", SqlDbType.Int),
|
||||
new SqlParameter("@Startdate", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Enddate", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Id", SqlDbType.BigInt)};
|
||||
parameters[0].Value = IFLeday;
|
||||
parameters[1].Value = Startdate;
|
||||
parameters[2].Value = Enddate;
|
||||
parameters[3].Value = Id;
|
||||
object obj = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
if (obj == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ɾ<><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public bool Delete(Int64 Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("delete from user_RestDay");
|
||||
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>
|
||||
/// <20>õ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
||||
/// </summary>
|
||||
public Mtxfw.Model.user_RestDay GetModel(Int64 Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select top 1 * from user_RestDay");
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.BigInt)
|
||||
};
|
||||
parameters[0].Value = Id;
|
||||
|
||||
Mtxfw.Model.user_RestDay model = new Mtxfw.Model.user_RestDay();
|
||||
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 = int.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.IFLeday = Convert.ToInt32(ds.Tables[0].Rows[0]["IFLeday"].ToString());
|
||||
model.Startdate = ds.Tables[0].Rows[0]["Startdate"].ToString();
|
||||
model.Enddate = ds.Tables[0].Rows[0]["Enddate"].ToString();
|
||||
model.utype = Convert.ToInt32(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>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
/// </summary>
|
||||
public DataSet GetList(string strWhere)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select * ");
|
||||
strSql.Append(" FROM user_RestDay ");
|
||||
if (strWhere.Trim() != "")
|
||||
{
|
||||
strSql.Append(" where " + strWhere);
|
||||
}
|
||||
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </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_RestDay ");
|
||||
if (strWhere.Trim() != "")
|
||||
{
|
||||
strSql.Append(" where " + strWhere);
|
||||
}
|
||||
strSql.Append(" order by " + filedOrder);
|
||||
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user