using System;
using System.Collections.Generic;
using QMAPP.BLL;
using QMAPP.Entity;
using QMFrameWork.Data;
using QMFrameWork.Log;
using QMAPP.FJC.Entity.Dianjian;
using QMAPP.FJC.DAL.Dianjian;
namespace QMAPP.FJC.BLL.Dianjian
{
///
/// 模块名称:注塑料筒信息
/// 作 者:张松男
/// 编写日期:2021年07月13日
///
public class PutMachineClassBLL : BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public DataResult Get(PutMachineClass model)
{
DataResult result = new DataResult();
try
{
result.Result = new PutMachineClassDAL().Get(model);
result.IsSuccess = true;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "获取异常!"
});
result.IsSuccess = false;
result.Ex = ex;
result.Msg = "获取异常";
}
return result;
}
#endregion
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(PutMachineClass condition, DataPage page)
{
DataResult result = new DataResult();
try
{
DataPage dataPage = new PutMachineClassDAL().GetList(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;
}
///
/// 获取列表
///
/// 条件
/// 全部集合
public List GetAllList()
{
try
{
//获取信息列表
return new PutMachineClassDAL().GetALL();
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "获取列表异常!"
});
throw ex;
}
}
#endregion
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public DataResult Insert(PutMachineClass info)
{
DataResult result = new DataResult();
try
{
//基本信息
info.PID = Guid.NewGuid().ToString();
PutMachineClassDAL cmdDAL = new PutMachineClassDAL();
result.Result = cmdDAL.Insert(info);
result.IsSuccess = true;
return result;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 更新信息
///
/// 更新信息
///
///
/// 更新行数
public DataResult Update(PutMachineClass model)
{
DataResult result = new DataResult();
result.IsSuccess = true;
try
{
PutMachineClass info = new PutMachineClassDAL().Get(model);
//基本信息
info.MachineCode = model.MachineCode;
info.Name = model.Name;
info.Content = model.Content;
info.Position = model.Position;
info.Methond = model.Methond;
info.Type = model.Type;
info.SerialNumber = model.SerialNumber;
int temp = new PutMachineClassDAL().Update(info);
if (temp == 0)
{
result.IsSuccess = false;
result.Msg = "更新失败!";
return result;
}
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "更新异常!"
});
result.IsSuccess = false;
result.Ex = ex;
result.Msg = "更新异常";
}
return result;
}
#endregion
#region 删除
///
/// 删除信息
///
/// 信息
/// 删除个数
public int Delete(string model)
{
int count = 0;
try
{
count = new PutMachineClassDAL().Delete(model);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}