代码修改后的版本,全部提交
This commit is contained in:
247
Mtxfw.DAL/User_tuiguang.cs
Normal file
247
Mtxfw.DAL/User_tuiguang.cs
Normal file
@@ -0,0 +1,247 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Mtxfw.DAL
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>:User_tuiguang
|
||||
/// </summary>
|
||||
public partial class User_tuiguang : Mtxfw.Utility.Myabstract
|
||||
{
|
||||
public User_tuiguang()
|
||||
: base("User_tuiguang")
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Add(Mtxfw.Model.User_tuiguang model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("insert into User_tuiguang(");
|
||||
strSql.Append("MemberId,Totalmoney,datatype,datatype2,Name,Tel,province,city,Conent,addTime)");
|
||||
strSql.Append(" values (");
|
||||
strSql.Append("@MemberId,@Totalmoney,@datatype,@datatype2,@Name,@Tel,@province,@city,@Conent,@addTime)");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@MemberId", SqlDbType.Int),
|
||||
new SqlParameter("@Totalmoney", SqlDbType.Money),
|
||||
new SqlParameter("@datatype", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@datatype2", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Name", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Tel", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@province", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@city", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Conent", SqlDbType.VarChar,2000),
|
||||
new SqlParameter("@addTime", SqlDbType.DateTime)};
|
||||
parameters[0].Value = model.MemberId;
|
||||
parameters[1].Value = model.Totalmoney;
|
||||
parameters[2].Value = model.datatype;
|
||||
parameters[3].Value = model.datatype2;
|
||||
parameters[4].Value = model.Name;
|
||||
parameters[5].Value = model.Tel;
|
||||
parameters[6].Value = model.province;
|
||||
parameters[7].Value = model.city;
|
||||
parameters[8].Value = model.Conent;
|
||||
parameters[9].Value = model.addTime;
|
||||
object obj = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
if (obj == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Update(Mtxfw.Model.User_tuiguang model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("Update User_tuiguang Set ");
|
||||
strSql.Append("Totalmoney=@Totalmoney,datatype=@datatype,datatype2=@datatype2,Name=@Name,Tel=@Tel,province=@province,city=@city,Conent=@Conent");
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Totalmoney", SqlDbType.Money),
|
||||
new SqlParameter("@datatype", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@datatype2", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Name", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Tel", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@province", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@city", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@Conent", SqlDbType.VarChar,2000),
|
||||
new SqlParameter("@Id", SqlDbType.Int)};
|
||||
parameters[0].Value = model.Totalmoney;
|
||||
parameters[1].Value = model.datatype;
|
||||
parameters[2].Value = model.datatype2;
|
||||
parameters[3].Value = model.Name;
|
||||
parameters[4].Value = model.Tel;
|
||||
parameters[5].Value = model.province;
|
||||
parameters[6].Value = model.city;
|
||||
parameters[7].Value = model.Conent;
|
||||
parameters[8].Value = model.Id;
|
||||
object obj = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
if (obj == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ɾ<EFBFBD><C9BE>
|
||||
/// </summary>
|
||||
public int UpdateSeef(int Seef, DateTime dt, int Id, int ifdel)
|
||||
{
|
||||
String sql = "update [User_tuiguang] set Seef=@Seef,seeftime=@dt where Id=@Id";
|
||||
if (ifdel == 1)
|
||||
{
|
||||
sql = "update [User_tuiguang] set IFDelete=@Seef,IFDeleteTime=@dt where Id=@Id";
|
||||
}
|
||||
SqlParameter[] para = { new SqlParameter("@Seef", SqlDbType.Int),
|
||||
new SqlParameter("@dt", SqlDbType.DateTime),
|
||||
new SqlParameter("@Id", SqlDbType.Int) };
|
||||
para[0].Value = Seef;
|
||||
para[1].Value = dt;
|
||||
para[2].Value = Id;
|
||||
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(sql, para);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ɾ<><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public bool Delete(int Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("delete from User_tuiguang ");
|
||||
int rows = 0;
|
||||
if (Id > 0)
|
||||
{
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.Int)};
|
||||
parameters[0].Value = Id;
|
||||
|
||||
rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString());
|
||||
}
|
||||
if (rows > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20>õ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
||||
/// </summary>
|
||||
public Mtxfw.Model.User_tuiguang GetModel(Int64 Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select top 1 * from User_tuiguang");
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.BigInt)
|
||||
};
|
||||
parameters[0].Value = Id;
|
||||
|
||||
Mtxfw.Model.User_tuiguang model = new Mtxfw.Model.User_tuiguang();
|
||||
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());
|
||||
}
|
||||
if (ds.Tables[0].Rows[0]["Totalmoney"].ToString() != "")
|
||||
{
|
||||
model.Totalmoney = Double.Parse(ds.Tables[0].Rows[0]["Totalmoney"].ToString());
|
||||
}
|
||||
model.datatype = ds.Tables[0].Rows[0]["datatype"].ToString();
|
||||
model.datatype2 = ds.Tables[0].Rows[0]["datatype2"].ToString();
|
||||
model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
|
||||
model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
|
||||
model.province = ds.Tables[0].Rows[0]["province"].ToString();
|
||||
model.city = ds.Tables[0].Rows[0]["city"].ToString();
|
||||
model.Conent = ds.Tables[0].Rows[0]["Conent"].ToString();
|
||||
if (ds.Tables[0].Rows[0]["addTime"].ToString() != "")
|
||||
{
|
||||
model.addTime = DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString());
|
||||
}
|
||||
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]["addTime"].ToString() != "")
|
||||
{
|
||||
model.addTime = DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString());
|
||||
}
|
||||
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]["addTime"].ToString() != "")
|
||||
{
|
||||
model.addTime = DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].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_tuiguang ");
|
||||
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_tuiguang ");
|
||||
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