189 lines
6.3 KiB
C#
189 lines
6.3 KiB
C#
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
|
|||
|
|
namespace Mtxfw.DAL
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>:User_zhongjiang
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class User_zhongjiang : Mtxfw.Utility.Myabstract
|
|||
|
|
{
|
|||
|
|
public User_zhongjiang()
|
|||
|
|
: base("User_zhongjiang")
|
|||
|
|
{ }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public int Add(Mtxfw.Model.User_zhongjiang model)
|
|||
|
|
{
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("insert into User_zhongjiang(");
|
|||
|
|
strSql.Append("cjqId,zjdj,zjje,MemberId,utype)");
|
|||
|
|
strSql.Append(" values (");
|
|||
|
|
strSql.Append("@cjqId,@zjdj,@zjje,@MemberId,@utype);select SCOPE_IDENTITY()");
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@cjqId", SqlDbType.Int),
|
|||
|
|
new SqlParameter("@zjdj", SqlDbType.Int),
|
|||
|
|
new SqlParameter("@zjje", SqlDbType.Money),
|
|||
|
|
new SqlParameter("@MemberId", SqlDbType.Int),
|
|||
|
|
new SqlParameter("@utype", SqlDbType.Int)};
|
|||
|
|
parameters[0].Value = model.cjqId;
|
|||
|
|
parameters[1].Value = model.zjdj;
|
|||
|
|
parameters[2].Value = model.zjje;
|
|||
|
|
parameters[3].Value = model.MemberId;
|
|||
|
|
parameters[4].Value = model.utype;
|
|||
|
|
string obj = Mtxfw.Utility.SqlDbHelper_U.GetObject(strSql.ToString(), parameters).ToString();
|
|||
|
|
if (obj == "")
|
|||
|
|
{
|
|||
|
|
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_zhongjiang ");
|
|||
|
|
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><CBBB><EFBFBD>ɾ<EFBFBD><C9BE>
|
|||
|
|
/// </summary>
|
|||
|
|
public int UpdateSel(string Sel, int SelValue, Int64 Id)
|
|||
|
|
{
|
|||
|
|
String sql = "update User_zhongjiang set " + Sel + "=@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>
|
|||
|
|
/// <20>õ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|||
|
|
/// </summary>
|
|||
|
|
public Mtxfw.Model.User_zhongjiang GetModel(int Id)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
StringBuilder strSql = new StringBuilder();
|
|||
|
|
strSql.Append("select top 1 * from User_zhongjiang ");
|
|||
|
|
strSql.Append(" where Id=@Id");
|
|||
|
|
SqlParameter[] parameters = {
|
|||
|
|
new SqlParameter("@Id", SqlDbType.Int,4)
|
|||
|
|
};
|
|||
|
|
parameters[0].Value = Id;
|
|||
|
|
|
|||
|
|
Mtxfw.Model.User_zhongjiang model = new Mtxfw.Model.User_zhongjiang();
|
|||
|
|
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]["cjqId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
model.cjqId = int.Parse(ds.Tables[0].Rows[0]["cjqId"].ToString());
|
|||
|
|
}
|
|||
|
|
if (ds.Tables[0].Rows[0]["zjdj"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
model.zjdj = int.Parse(ds.Tables[0].Rows[0]["zjdj"].ToString());
|
|||
|
|
}
|
|||
|
|
if (ds.Tables[0].Rows[0]["zjje"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
model.zjje = Convert.ToDouble(ds.Tables[0].Rows[0]["zjje"].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]["seef"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString());
|
|||
|
|
}
|
|||
|
|
if (ds.Tables[0].Rows[0]["utype"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
model.utype = int.Parse(ds.Tables[0].Rows[0]["utype"].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_zhongjiang ");
|
|||
|
|
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_zhongjiang ");
|
|||
|
|
if (strWhere.Trim() != "")
|
|||
|
|
{
|
|||
|
|
strSql.Append(" where " + strWhere);
|
|||
|
|
}
|
|||
|
|
strSql.Append(" order by " + filedOrder);
|
|||
|
|
return Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|