天津投入产出系统后端
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.

261 lines
7.8 KiB

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 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
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
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>全部数据</returns>
public List<VideoTypeEntity> GetAllList()
{
try
{
return new VideoTypeDAL().GetAllList();
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo {ErrorInfo = ex, Tag = ex.StackTrace, Info = "获取视频类型表错误!"});
throw;
}
}
/// <summary>
/// 报警信息获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataResult<DataPage> GetDataPageList(VideoTypeEntity condition, DataPage page)
{
DataResult<DataPage> result = new DataResult<DataPage>();
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 插入信息
/// <summary>
/// 插入信息(单表)
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public DataResult<int> Insert(VideoTypeEntity model)
{
DataResult<int> result = new DataResult<int>();
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 信息是否重复
/// <summary>
/// 判断名称是否存在
/// </summary>
/// <param name="info"></param>
/// <returns>true:已存在;fasel:不存在。</returns>
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 更新信息
/// <summary>
/// 更新信息
/// </summary>
/// <param name=""></param>
/// <returns>更新行数</returns>
public DataResult<int> Update(VideoTypeEntity model)
{
DataResult<int> result = new DataResult<int>();
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 删除
/// <summary>
/// 删除信息
/// </summary>
/// <param name=""></param>
/// <returns>删除个数</returns>
public DataResult<int> Delete(string str)
{
DataResult<int> result = new DataResult<int>();
//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;
}
/// <summary>
/// 删除信息
/// </summary>
/// <param name="">信息</param>
/// <returns>删除个数</returns>
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
}
}