代码修改后的版本,全部提交
This commit is contained in:
104
Mtxfw.DAL/User_AppLine.cs
Normal file
104
Mtxfw.DAL/User_AppLine.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Mtxfw.DAL
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>:User_AppLine
|
||||
/// </summary>
|
||||
public partial class User_AppLine : Mtxfw.Utility.Myabstract
|
||||
{
|
||||
public User_AppLine()
|
||||
: base("User_AppLine")
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Add(Mtxfw.Model.User_AppLine model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("insert into User_AppLine(");
|
||||
strSql.Append("MemberId,InNum,InTime,IP,TType)");
|
||||
strSql.Append(" values (");
|
||||
strSql.Append("@MemberId,@InNum,@InTime,@IP,@TType)");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@MemberId", SqlDbType.Int),
|
||||
new SqlParameter("@InNum", SqlDbType.Int),
|
||||
new SqlParameter("@InTime", SqlDbType.DateTime),
|
||||
new SqlParameter("@IP", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@TType", SqlDbType.Int)};
|
||||
parameters[0].Value = model.MemberId;
|
||||
parameters[1].Value = model.InNum;
|
||||
parameters[2].Value = model.InTime;
|
||||
parameters[3].Value = model.IP;
|
||||
parameters[4].Value = model.TType;
|
||||
object obj = Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
|
||||
if (obj == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Update(string strIP)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("Update User_OnLine Set ");
|
||||
strSql.Append("InNum=InNum+1");
|
||||
strSql.Append(" Where IP=@strIP and DateDiff(day,InTime,getdate())=0");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@strIP", SqlDbType.VarChar,50)};
|
||||
parameters[0].Value = strIP;
|
||||
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_AppLine ");
|
||||
int rows = 0;
|
||||
if (Id > 0)
|
||||
{
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.BigInt)};
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user