首次推送
This commit is contained in:
256
Mtxfw.DAL/user_livefile.cs
Normal file
256
Mtxfw.DAL/user_livefile.cs
Normal file
@@ -0,0 +1,256 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Mtxfw.DAL
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>:user_livefile
|
||||
/// </summary>
|
||||
public partial class user_livefile : Mtxfw.Utility.Myabstract
|
||||
{
|
||||
public user_livefile()
|
||||
: base("user_livefile")
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public int Add(Mtxfw.Model.user_livefile model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("insert into user_livefile(");
|
||||
strSql.Append("MemberId,liveid,stream_id,channel_id,file_id,file_format,start_time,end_time,duration,width,height,file_size,stream_param,video_url,seef,LinkID,ttype,addtime,gtype)");
|
||||
strSql.Append(" values (");
|
||||
strSql.Append("@MemberId,@liveid,@stream_id,@channel_id,@file_id,@file_format,@start_time,@end_time,@duration,@width,@height,@file_size,@stream_param,@video_url,@seef,@LinkID,@ttype,@addtime,@gtype)");
|
||||
strSql.Append(";select SCOPE_IDENTITY()");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@MemberId", SqlDbType.Int),
|
||||
new SqlParameter("@liveid", SqlDbType.Int),
|
||||
new SqlParameter("@stream_id", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@channel_id", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@file_id", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@file_format", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@start_time", SqlDbType.BigInt),
|
||||
new SqlParameter("@end_time", SqlDbType.BigInt),
|
||||
new SqlParameter("@duration", SqlDbType.BigInt),
|
||||
new SqlParameter("@width", SqlDbType.BigInt),
|
||||
new SqlParameter("@height", SqlDbType.BigInt),
|
||||
new SqlParameter("@file_size", SqlDbType.BigInt),
|
||||
new SqlParameter("@stream_param", SqlDbType.VarChar,50),
|
||||
new SqlParameter("@video_url", SqlDbType.VarChar,250),
|
||||
new SqlParameter("@seef", SqlDbType.BigInt),
|
||||
new SqlParameter("@LinkID", SqlDbType.Int),
|
||||
new SqlParameter("@ttype", SqlDbType.Int),
|
||||
new SqlParameter("@addtime", SqlDbType.DateTime),
|
||||
new SqlParameter("@gtype", SqlDbType.Int)};
|
||||
parameters[0].Value = model.MemberId;
|
||||
parameters[1].Value = model.liveid;
|
||||
parameters[2].Value = model.stream_id;
|
||||
parameters[3].Value = model.channel_id;
|
||||
parameters[4].Value = model.file_id;
|
||||
parameters[5].Value = model.file_format;
|
||||
parameters[6].Value = model.start_time;
|
||||
parameters[7].Value = model.end_time;
|
||||
parameters[8].Value = model.duration;
|
||||
parameters[9].Value = model.width;
|
||||
parameters[10].Value = model.height;
|
||||
parameters[11].Value = model.file_size;
|
||||
parameters[12].Value = model.stream_param;
|
||||
parameters[13].Value = model.video_url;
|
||||
parameters[14].Value = model.seef;
|
||||
parameters[15].Value = model.LinkID;
|
||||
parameters[16].Value = model.ttype;
|
||||
parameters[17].Value = model.addtime;
|
||||
parameters[18].Value = model.gtype;
|
||||
string obj = Mtxfw.Utility.SqlDbHelper_U.GetObject(strSql.ToString(), parameters).ToString();
|
||||
if (obj == "")
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public bool Update(Mtxfw.Model.user_livefile model)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("update user_livefile set ");
|
||||
strSql.Append("seef=@seef,");
|
||||
strSql.Append("LinkID=@LinkID");
|
||||
strSql.Append(" where ID=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.Int),
|
||||
new SqlParameter("@seef", SqlDbType.Int),
|
||||
new SqlParameter("@LinkID", SqlDbType.Int)};
|
||||
parameters[0].Value = model.Id;
|
||||
parameters[1].Value = model.seef;
|
||||
parameters[2].Value = model.LinkID;
|
||||
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_livefile GetModel(int Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select top 1 * from user_livefile ");
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.Int,4)};
|
||||
parameters[0].Value = Id;
|
||||
|
||||
Mtxfw.Model.user_livefile model = new Mtxfw.Model.user_livefile();
|
||||
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
||||
model.MemberId = int.Parse(ds.Tables[0].Rows[0]["MemberId"].ToString());
|
||||
model.liveid = int.Parse(ds.Tables[0].Rows[0]["liveid"].ToString());
|
||||
model.stream_id = ds.Tables[0].Rows[0]["stream_id"].ToString();
|
||||
model.channel_id = ds.Tables[0].Rows[0]["channel_id"].ToString();
|
||||
model.file_id = ds.Tables[0].Rows[0]["file_id"].ToString();
|
||||
model.file_format = ds.Tables[0].Rows[0]["file_format"].ToString();
|
||||
model.start_time = Int64.Parse(ds.Tables[0].Rows[0]["start_time"].ToString());
|
||||
model.end_time = Int64.Parse(ds.Tables[0].Rows[0]["end_time"].ToString());
|
||||
model.duration = Int64.Parse(ds.Tables[0].Rows[0]["duration"].ToString());
|
||||
model.width = Int64.Parse(ds.Tables[0].Rows[0]["width"].ToString());
|
||||
model.height = Int64.Parse(ds.Tables[0].Rows[0]["height"].ToString());
|
||||
model.file_size = UInt64.Parse(ds.Tables[0].Rows[0]["file_size"].ToString());
|
||||
model.stream_param = ds.Tables[0].Rows[0]["stream_param"].ToString();
|
||||
model.video_url = ds.Tables[0].Rows[0]["video_url"].ToString();
|
||||
model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString());
|
||||
model.LinkID = int.Parse(ds.Tables[0].Rows[0]["LinkID"].ToString());
|
||||
model.ttype = int.Parse(ds.Tables[0].Rows[0]["ttype"].ToString());
|
||||
model.addtime = Convert.ToDateTime(ds.Tables[0].Rows[0]["addtime"].ToString());
|
||||
return model;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <20>õ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
||||
/// </summary>
|
||||
public Mtxfw.Model.user_livefile GetModelByliveid(int liveid)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select top 1 * from user_livefile ");
|
||||
strSql.Append(" where ttype=0 and liveid=@liveid");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@liveid", SqlDbType.Int,4)};
|
||||
parameters[0].Value = liveid;
|
||||
Mtxfw.Model.user_livefile model = new Mtxfw.Model.user_livefile();
|
||||
DataSet ds = Mtxfw.Utility.SqlDbHelper_U.GetDataSet(strSql.ToString(), parameters);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
||||
model.MemberId = int.Parse(ds.Tables[0].Rows[0]["MemberId"].ToString());
|
||||
model.liveid = int.Parse(ds.Tables[0].Rows[0]["liveid"].ToString());
|
||||
model.stream_id = ds.Tables[0].Rows[0]["stream_id"].ToString();
|
||||
model.channel_id = ds.Tables[0].Rows[0]["channel_id"].ToString();
|
||||
model.file_id = ds.Tables[0].Rows[0]["file_id"].ToString();
|
||||
model.file_format = ds.Tables[0].Rows[0]["file_format"].ToString();
|
||||
model.start_time = Int64.Parse(ds.Tables[0].Rows[0]["start_time"].ToString());
|
||||
model.end_time = Int64.Parse(ds.Tables[0].Rows[0]["end_time"].ToString());
|
||||
model.duration = Int64.Parse(ds.Tables[0].Rows[0]["duration"].ToString());
|
||||
model.width = Int64.Parse(ds.Tables[0].Rows[0]["width"].ToString());
|
||||
model.height = Int64.Parse(ds.Tables[0].Rows[0]["height"].ToString());
|
||||
model.file_size = UInt64.Parse(ds.Tables[0].Rows[0]["file_size"].ToString());
|
||||
model.stream_param = ds.Tables[0].Rows[0]["stream_param"].ToString();
|
||||
model.video_url = ds.Tables[0].Rows[0]["video_url"].ToString();
|
||||
model.seef = int.Parse(ds.Tables[0].Rows[0]["seef"].ToString());
|
||||
model.LinkID = int.Parse(ds.Tables[0].Rows[0]["LinkID"].ToString());
|
||||
model.ttype = int.Parse(ds.Tables[0].Rows[0]["ttype"].ToString());
|
||||
model.addtime = Convert.ToDateTime(ds.Tables[0].Rows[0]["addtime"].ToString());
|
||||
return model;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// ɾ<><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public bool Delete(int Id)
|
||||
{
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("delete from user_livefile ");
|
||||
strSql.Append(" where Id=@Id");
|
||||
SqlParameter[] parameters = {
|
||||
new SqlParameter("@Id", SqlDbType.Int,4)
|
||||
};
|
||||
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
/// </summary>
|
||||
public DataSet GetList(string strWhere)
|
||||
{
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append("select * ");
|
||||
strSql.Append(" FROM user_livefile ");
|
||||
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_livefile ");
|
||||
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