using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL;
using System.Data.SqlClient;
using System.Data;
namespace CY.SQLDAL
{
public class OA_SuppliersOtherQualificationDAL : IOA_SuppliersOtherQualificationDAL
{
private Database _dataBase = null;
public OA_SuppliersOtherQualificationDAL()
{
_dataBase = new Database();
}
///
/// 新增
///
///
///
public bool InserModel(Infrastructure.Domain.IAggregateRoot model)
{
Model.OA_SuppliersOtherQualification trueModel = model as Model.OA_SuppliersOtherQualification;
if (trueModel == null)
{
return false;
}
IList sqlParms = new List()
{
new SqlParameter("@SuppliersId",trueModel.SuppliersId),
new SqlParameter("@FileId",trueModel.FileId)
};
try
{
_dataBase.Query("sp_OA_SuppliersOtherQualification_Insert", CommandType.StoredProcedure, sqlParms.ToArray());
}
catch (Exception ex)
{
throw ex;
}
return true;
}
///
/// 修改
///
///
///
public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model)
{
Model.OA_SuppliersOtherQualification trueModel = model as Model.OA_SuppliersOtherQualification;
if (trueModel == null)
{
return false;
}
IList sqlParms = new List()
{
new SqlParameter("@SuppliersId",trueModel.SuppliersId),
new SqlParameter("@FileId",trueModel.FileId)
};
try
{
_dataBase.Query("sp_OA_SuppliersOtherQualification_Update", CommandType.StoredProcedure, sqlParms.ToArray());
}
catch (Exception ex)
{
throw ex;
}
return true;
}
///
/// 删除
///
///
///
public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model)
{
Model.OA_SuppliersOtherQualification trueModel = model as Model.OA_SuppliersOtherQualification;
if (trueModel == null)
{
return false;
}
IList sqlParms = new List()
{
new SqlParameter("@SuppliersId",trueModel.SuppliersId)
};
try
{
_dataBase.Query("sp_OA_SuppliersOtherQualification_DeleteRow", CommandType.StoredProcedure, sqlParms.ToArray());
}
catch (Exception ex)
{
throw ex;
}
return true;
}
///
/// 分页查询
///
///
///
///
public IEnumerable SelectModelPage(Infrastructure.Query.Query query, Infrastructure.Query.Pagination pagination)
{
throw new NotImplementedException();
}
///
/// 单个查询
///
///
///
public IEnumerable SelectAllModel(Infrastructure.Query.Query query)
{
throw new NotImplementedException();
}
///
/// 删除供应商对应的全部其他资质
///
///
///
public int DeleteAll(string SuppliersId)
{
string sqlStr = "DELETE FROM dbo.OA_SuppliersOtherQualification WHERE SuppliersId= '" + SuppliersId + "'";
return _dataBase.ExecuteSql(sqlStr, null);
}
///
/// 返回供应商对应的其他资质
///
///
///
public DataTable selectOtherQuBySuppliersId(string SupplierId)
{
string selTarget = " * ";
string fromSource = " OA_SuppliersOtherQualification where SuppliersId= '" + SupplierId + "'";
return _dataBase.SelectModel(selTarget, fromSource);
}
}
}