using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.DAL.Basic;
using QMFrameWork.Data;
using QMAPP.FJC.Entity;
using QMAPP.FJC.BLL.Dict;
using QMAPP.Entity;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.Basic
{
///
/// 模块编号:
/// 作 用:设备的模具列表
/// 作 者:王庆男
/// 编写日期:2015年06月19日
///
public class MachineInfoModelBLL : BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public MachineInfoModels Get(MachineInfoModels model)
{
try
{
return new MachineInfoModelDAL().Get(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataPage GetList(MachineInfoModels condition, DataPage page)
{
try
{
return new MachineInfoModelDAL().GetList(condition, page);
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public List GetAllList(MachineInfoModels condition)
{
try
{
return new MachineInfoModelDAL().GetList(condition);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 信息是否重复
///
/// 判断名称是否存在
///
///
/// true:已存在;fasel:不存在。
public bool ExistsMachineInfoModel(MachineInfoModels model)
{
try
{
return new MachineInfoModelDAL().ExistsMachineInfoModel(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public int Insert(MachineInfoModels model)
{
try
{
//基本信息
model.PID = Guid.NewGuid().ToString();
model.CREATEUSER = this.LoginUser.UserID;
model.CREATEDATE = DateTime.Now;
model.UPDATEUSER = model.CREATEUSER;
model.UPDATEDATE = model.CREATEDATE;
MachineInfoModelDAL cmdDAL = new MachineInfoModelDAL();
if (ExistsMachineInfoModel(model) == true)
return -1;
return new MachineInfoModelDAL().Insert(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 更新信息
///
/// 更新信息
///
///
/// 更新行数
public int Update(MachineInfoModels model)
{
try
{
//if (ExistsMachineInfoModel(Model) == true)
//return -1;
//基本信息
model.UPDATEUSER = this.LoginUser.UserID;
return new MachineInfoModelDAL().Update(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除
///
/// 删除信息
///
///
/// 删除个数
public int Delete(string strs)
{
int count = 0;
string[] list = strs.Split(":".ToCharArray());
try
{
foreach (string str in list)
{
count += this.DeleteMachineInfoModel(new MachineInfoModels { PID = str });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 删除信息
///
/// 信息
/// 删除个数
public int DeleteMachineInfoModel(MachineInfoModels model)
{
int count = 0;
try
{
count = new MachineInfoModelDAL().Delete(model);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}