using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.MD.Entity;
using QMAPP.Entity;
using QMAPP.MD.DAL;
using QMFrameWork.Data;
using QMFrameWork.Log;
namespace QMAPP.MD.BLL
{
///
/// 物料类别信息
/// 20180117
///
public class MaterialClassBLL : BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public DataResult Get(MaterialClass model)
{
DataResult result = new DataResult();
try
{
result.Result = new MaterialClassDAL().Get(model);
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
///
/// 获取信息
///
/// 条件
/// 信息
public DataResult GetMP4(MaterialClass model)
{
DataResult result = new DataResult();
try
{
result.Result = new MaterialClassDAL().GetMP4(model);
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
#endregion
#region 获取分页列表
///
/// 获取分页列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(MaterialClass condition, DataPage page)
{
DataResult result = new DataResult();
try
{
//获取物料信息列表
DataPage dataPage = new MaterialClassDAL().GetList(condition, page);
#region 外购件标识
List materielList = dataPage.Result as List;
#endregion
result.Result = dataPage;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
///
/// 获取列表
///
/// 条件
/// 全部集合
public List GetAllList(MaterialClass condition)
{
try
{
//获取物料信息列表
List list = new MaterialClassDAL().GetList(condition);
return list;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织机构树形列表
///
/// 获取组织机构树形列表
///
/// 数据页
public List GetSubTreeList(MaterialClass materialcalss)
{
try
{
return new MaterialClassDAL().GetSubTreeList(materialcalss);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取SEQ_NUM最大号
///
/// 获取信息
///
/// 条件
/// 信息
public int GetMaxSeqNum(MaterialClass model)
{
try
{
var pi = new MaterialClassDAL().GetMaxSeqNum(model);
return pi.SEQ_NUM;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "获取SEQ_NUM最大号"
});
throw ex;
}
}
#endregion
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public DataResult Insert(MaterialClass model)
{
DataResult result = new DataResult();
//基本信息
model.PID = Guid.NewGuid().ToString();
model.FLGDEL = "0";
model.CREATEUSER = this.LoginUser.UserID;
model.UPDATEUSER = model.CREATEUSER;
try
{
//if (ExistsMateriel(model) == true)
//{
// result.IsSuccess = false;
// result.Msg = Resource.MaterielCodeIsHave;
// return result;
//}
result.Result = new MaterialClassDAL().Insert(model);
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
#endregion
#region 删除信息
///
/// 删除信息
///
/// 信息
/// 插入行数
public DataResult Delete(string pid)
{
DataResult result = new DataResult();
try
{
result.Result = new MaterialClassDAL().Delete(pid);
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
return result;
}
result.IsSuccess = true;
return result;
}
#endregion
}
}