You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
264 lines
8.0 KiB
264 lines
8.0 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.DAL;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.Entity.Equipment;
|
||
|
using QMAPP.FJC.Entity.MesB9;
|
||
|
using QMAPP.FJC.Entity.ODS;
|
||
|
using QMAPP.FJC.Entity.WarnManage;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMFrameWork.Log;
|
||
|
|
||
|
namespace QMAPP.FJC.DAL.ODS
|
||
|
{
|
||
|
public class VideoTypeDAL : BaseDAL
|
||
|
{
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>*信息</returns>
|
||
|
public VideoTypeEntity Get(VideoTypeEntity model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
//获取信息
|
||
|
model = session.Get<VideoTypeEntity>(model);
|
||
|
}
|
||
|
return model;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
public List<VideoTypeEntity> GetAllList()
|
||
|
{
|
||
|
//DataParameter[] parameters;
|
||
|
List<DataParameter> parameters = new List<DataParameter>();
|
||
|
//string sql = this.GetQuerySql(condition, ref parameters);
|
||
|
string sql = "SELECT * FROM T_ODS_VideoType ";
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
return session.GetList<VideoTypeEntity>(sql, parameters.ToArray()).ToList();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#region 获取页面
|
||
|
/// <summary>
|
||
|
/// 播放视频
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataPage GetDataPageList(VideoTypeEntity condition, DataPage page)
|
||
|
{
|
||
|
string sql = null;
|
||
|
List<DataParameter> parameters = new List<DataParameter>();
|
||
|
try
|
||
|
{
|
||
|
sql = this.GetQuerySql(condition, ref parameters);
|
||
|
|
||
|
//分页关键字段及排序
|
||
|
page.KeyName = "VideoType";
|
||
|
page.SortExpression = "VideoType DESC";
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
page = session.GetDataPage<VideoTypeEntity>(sql, parameters.ToArray(), page);
|
||
|
}
|
||
|
return page;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "视频类型数据层-视频类型页面"
|
||
|
});
|
||
|
throw;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 播放视频查询语句
|
||
|
/// <summary>
|
||
|
/// 播放类型查询语句
|
||
|
/// </summary>
|
||
|
/// <param name="user">查询条件</param>
|
||
|
/// <param name="parameters">参数</param>
|
||
|
/// <returns>查询语句</returns>
|
||
|
private string GetQuerySql(VideoTypeEntity condition, ref List<DataParameter> parameters)
|
||
|
{
|
||
|
StringBuilder sqlBuilder = new StringBuilder();
|
||
|
StringBuilder whereBuilder = new StringBuilder();
|
||
|
try
|
||
|
{
|
||
|
//构成查询语句
|
||
|
sqlBuilder.Append(@"SELECT PID
|
||
|
,VideoType
|
||
|
,MEMO
|
||
|
,CREATEDATE
|
||
|
,CREATEUSER
|
||
|
,UPDATEUSER
|
||
|
,UPDATEDATE
|
||
|
FROM T_ODS_VideoType T ");
|
||
|
|
||
|
|
||
|
return sqlBuilder.ToString();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region 插入信息
|
||
|
/// <summary>
|
||
|
/// 插入信息(单表)
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public int Insert(VideoTypeEntity model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
//插入基本信息
|
||
|
count = session.Insert<VideoTypeEntity>(model);
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region 更新信息
|
||
|
/// <summary>
|
||
|
/// 更新信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>更新行数</returns>
|
||
|
public int Update(VideoTypeEntity model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
count = session.Update<VideoTypeEntity>(model);
|
||
|
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 信息是否重复
|
||
|
/// <summary>
|
||
|
/// 判断名称是否存在
|
||
|
/// </summary>
|
||
|
/// <param name="info"></param>
|
||
|
/// <returns>true:已存在;fasel:不存在。</returns>
|
||
|
public bool ExistsVideoType(VideoTypeEntity model)
|
||
|
{
|
||
|
StringBuilder sqlBuilder = new StringBuilder();
|
||
|
StringBuilder whereBuilder = new StringBuilder();
|
||
|
List<DataParameter> parameters = new List<DataParameter>();
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
sqlBuilder.Append("SELECT COUNT(VideoType) FROM T_ODS_VideoType");
|
||
|
if (string.IsNullOrEmpty(model.VideoType) == false)
|
||
|
{
|
||
|
whereBuilder.Append(" AND VideoType = @VideoType ");
|
||
|
parameters.Add(new DataParameter { ParameterName = "VideoType", DataType = DbType.String, Value = model.VideoType });
|
||
|
}
|
||
|
if (whereBuilder.Length > 0)
|
||
|
{
|
||
|
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
|
||
|
}
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
count = Convert.ToInt32(session.ExecuteSqlScalar(sqlBuilder.ToString(), parameters.ToArray()));
|
||
|
}
|
||
|
if (count > 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 删除
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public int Delete(VideoTypeEntity model)
|
||
|
{
|
||
|
StringBuilder sqlBuilder = new StringBuilder();
|
||
|
List<DataParameter> parameters = new List<DataParameter>();
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
//删除基本信息
|
||
|
sqlBuilder.Append("DELETE T_ODS_VideoType ");
|
||
|
sqlBuilder.Append("WHERE PID = @PID ");
|
||
|
parameters.Add(new DataParameter { ParameterName = "PID", DataType = DbType.String, Value = model.PID });
|
||
|
count = session.ExecuteSql(sqlBuilder.ToString(), parameters.ToArray());
|
||
|
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|