using HL_FristAidPlatform_DataBase;
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase.Service;
using HL_FristAidPlatform_Models;
using System;
using System.Collections.Generic;
namespace HL_FristAidPlatform_Bussiness
{
///
///
///
public class T_Base_AccidentInfoBLL
{
private IT_Base_AccidentInfo IService = new T_Base_AccidentInfoDB();
///
///
///
///
public List GetListAccidentInfo()
{
return IService.GetListAccidentInfo();
}
///
/// 查询所有的事故 Tree eDataTable
///
///
//public TableModel GetListAccidentInfoeDataTable()
//{
// return IService.GetListAccidentInfoeDataTable();
//}
///
///
///
///
public TableModel GetListAccident()
{
return IService.GetListAccident();
}
///
/// 重大事故/群伤事件数据集合
///
///
public List GetAccidentInfoClass()
{
return IService.GetAccidentInfoClass();
}
public List GetList(string name, int accidentLevel)
{
return IService.GetList(name, accidentLevel);
}
public MessageModel SaveAccidentInfo(T_Base_AccidentInfo department)
{
var oneClass = IService.GetByName(department.ParentName, department.AccidentLevel);
if (oneClass != null)
{
return new MessageModel { Success = false, Msg = "该事件已存在,无法重复添加" };
}
department.GUID = Guid.NewGuid().ToString();
department.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
if (IService.SaveAccidentInfo(department))
{
return new MessageModel { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel { Success = false, Msg = "保存失败" };
}
}
public MessageModel UpdateAccidentInfo(T_Base_AccidentInfo model)
{
var oneClass = IService.GetAccidentLevelById(model.ID);
if (oneClass == null)
{
return new MessageModel { Success = false, Msg = "该事件不存在,无法修改" };
}
T_Base_AccidentInfo department = new T_Base_AccidentInfo();
department.ID = model.ID;
department.GUID = oneClass.GUID;
department.ParentName = model.ParentName;
department.AccidentLevel = model.AccidentLevel;
if (IService.UpdateAccidentInfo(department))
{
return new MessageModel { Success = true, Msg = "更新成功" };
}
else
{
return new MessageModel { Success = false, Msg = "更新失败" };
}
}
#region 群伤等级
public List GetAccidentLevelList(string name, int accidentLevel)
{
return IService.GetAccidentLevelList(name, accidentLevel);
}
public MessageModel SaveAccidentLevel(T_Base_AccidentLevel department)
{
var oneClass = IService.GetAccidentLevelByName(department.LevelName, department.AccidentLevel);
if (oneClass != null)
{
return new MessageModel { Success = false, Msg = "该事故已存在,无法重复添加" };
}
department.GUID = Guid.NewGuid().ToString();
department.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
if (IService.SaveAccidentLevel(department))
{
return new MessageModel { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel { Success = false, Msg = "保存失败" };
}
}
public MessageModel UpdateAccidentLevel(T_Base_AccidentLevel model)
{
var oneClass = IService.GetAccidentLevelById(model.ID);
if (oneClass == null)
{
return new MessageModel { Success = false, Msg = "该事故等级不存在,无法修改" };
}
T_Base_AccidentLevel department = new T_Base_AccidentLevel();
department.ID = model.ID;
department.GUID = oneClass.GUID;
department.LevelName = model.LevelName;
department.AccidentLevel = model.AccidentLevel;
department.Describe = model.Describe;
if (IService.UpdateAccidentLevel(department))
{
return new MessageModel { Success = true, Msg = "更新成功" };
}
else
{
return new MessageModel { Success = false, Msg = "更新失败" };
}
}
#endregion
}
}