using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.Entity.Basic;
using QMFrameWork.Data;
using System.Data;
using QMAPP.Entity;
using QMAPP.FJC.Entity.MD;
namespace QMAPP.FJC.DAL.Basic
{
///
/// 模块名称:配置表
/// 作 者:张松男
/// 编写日期:2021年03月17日
///
public class AppConfigDAL
{
///
/// 获取全部规则
///
///
public AppConfig Get(string Code)
{
try
{
string sql = $"SELECT * FROM [T_MD_AppConfig_QD] where Code = '{Code}'";
List parameters = new List();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.Get(sql, parameters.ToArray());
}
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 获取全部规则
///
///
public MaterialClass GetMATERIAL(string MATERIALCode,ref string msg)
{
try
{
var sql = $" select MATERIAL_TYPE_NAME,LAYER_NUM,UP_MATERIAL_TYPE_CODE from T_MD_MATERIAL_CLASS where MATERIAL_TYPE_CODE = '{MATERIALCode}'";
var MaterialClass = new MaterialClass();
List parameters = new List();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
MaterialClass = session.Get(sql, parameters.ToArray());
}
if (MaterialClass.LAYER_NUM == "2")
{
msg = MaterialClass.MATERIAL_TYPE_NAME;
return MaterialClass;
}
else
{
GetMATERIAL(MaterialClass.UP_MATERIAL_TYPE_CODE,ref msg);
}
return MaterialClass;
}
catch (Exception ex)
{
throw ex;
}
}
}
}