using System;
using System.Collections.Generic;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.FJC.DAL.ODS;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.ODS;
using QMFrameWork.Data;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.ODS
{
public class VideoTypeBLL : BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public VideoTypeEntity Get(VideoTypeEntity model)
{
try
{
return new VideoTypeDAL().Get(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备停机维护--获取停机信息"
});
throw ex;
}
}
#endregion
///
/// 获取列表
///
/// 条件
/// 全部数据
public List GetAllList()
{
try
{
return new VideoTypeDAL().GetAllList();
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo {ErrorInfo = ex, Tag = ex.StackTrace, Info = "获取视频类型表错误!"});
throw;
}
}
///
/// 报警信息获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetDataPageList(VideoTypeEntity condition, DataPage page)
{
DataResult result = new DataResult();
try
{
//获取信息列表
DataPage dataPage = new VideoTypeDAL().GetDataPageList(condition, page);
result.IsSuccess = true;
result.Result = dataPage;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型异常!"
});
result.IsSuccess = false;
result.Ex = ex;
result.Msg = "视频类型异常!";
}
return result;
}
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public DataResult Insert(VideoTypeEntity model)
{
DataResult result = new DataResult();
try
{
//基本信息
model.PID = Guid.NewGuid().ToString();
model.CREATEUSER = this.LoginUser.UserID;
model.CREATEDATE = DateTime.Now;
model.UPDATEUSER = model.CREATEUSER;
model.UPDATEDATE = model.CREATEDATE;
if (ExistsVideoType(model) == true)
{
result.IsSuccess = false;
result.Msg = Resource.IsHaving;
return result;
}
result.Result = new VideoTypeDAL().Insert(model);
result.IsSuccess = true;
;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--插入视频类型信息"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
#region 信息是否重复
///
/// 判断名称是否存在
///
///
/// true:已存在;fasel:不存在。
public bool ExistsVideoType(VideoTypeEntity model)
{
try
{
return new VideoTypeDAL().ExistsVideoType(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--判断视频类型信息是否重复"
});
throw ex;
}
}
#endregion
#region 更新信息
///
/// 更新信息
///
///
/// 更新行数
public DataResult Update(VideoTypeEntity model)
{
DataResult result = new DataResult();
try
{
if (ExistsVideoType(model) == true)
{
result.IsSuccess = false;
result.Msg = Resource.IsHaving;
return result;
}
model.UPDATEDATE = DateTime.Now;
model.UPDATEUSER = this.LoginUser.UserID;
result.Result = new VideoTypeDAL().Update(model);
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--更新视频类型信息"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
#region 删除
///
/// 删除信息
///
///
/// 删除个数
public DataResult Delete(string str)
{
DataResult result = new DataResult();
//string[] list = strs.Split(":".ToCharArray());
try
{
result.Result = this.DeleteVideoType(new VideoTypeEntity { PID = str });
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--删除视频类型信息"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
///
/// 删除信息
///
/// 信息
/// 删除个数
public int DeleteVideoType(VideoTypeEntity model)
{
int count = 0;
try
{
count = new VideoTypeDAL().Delete(model);
return count;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--视频类型信息"
});
throw ex;
}
}
#endregion
}
}