using MOKA_Factory_Tools.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MOKA_Factory_Tools.DAL
{
public class DAL_AMYields : BaseDAL
{
public DAL_AMYields(int NTFposion)
{
this.TableFieldNameString = "";
if (NTFposion == 1)
this.cps.SetConnectParameters(databaseServer: "10.138.96.109", databaseName: "IDOtherData", databaseAccount: "usr_rd", databasePassword: "Pa55W0rd4TMSA@202207#");
else if (NTFposion == 2)
this.cps.SetConnectParameters(databaseServer: "10.146.0.53", databaseName: "Amazon", databaseAccount: "GGuest", databasePassword: "Kintsugi$23");
}
#region 属性和字段
string _tableName = "AMYields";
///
/// 获取数据表名
///
public override string TableName
{
get { return _tableName; }
set { this._tableName = value; }
}
///
/// 获取当前新的数据表模型对象
///
public override object ObjModel
{
get
{
return this.CurrentModel;
}
}
///
/// 获取当前新的MOdel
///
public AMYields CurrentModel
{
get { return new AMYields(); }
}
string _tableFieldNameString = "";
///
/// 数据表字段名数组
///
public override string TableFieldNameString
{
get { return this._tableFieldNameString; }
set { this._tableFieldNameString = value; }
}
#endregion
#region 检查记录
//基类已经实现
#endregion
#region 增加数据
///
/// 增加一条数据
///
/// Model对象
///
public bool Add(AMYields model)
{
return base.Add(model);
}
///
/// 增加一条数据
///
/// Model对象
/// 忽略字段名列表 字段名之间用“,”号分隔
///
public bool Add(AMYields model, string overlookFieldList = "ID")
{
return base.Add(model, overlookFieldList);
}
#endregion
#region 删除数据
///
/// 删除数据
///
///
///
public bool Delete(AMYields model)
{
return base.Delete(model.ID);
}
#endregion
#region 更新数据
///
/// 更新一条数据
///
public bool Update(AMYields model)
{
return base.Update(model);
}
///
/// 根据筛选字段和SQL筛选运算符号更新数据
///
/// Model对象
/// 筛选字段名称
/// SQL筛选运算符号
/// 忽略字段名列表 字段名之间用“,”号分隔
///
public bool Update(AMYields model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
{
return base.Update(model, filterFieldName, operators, overlookFieldList);
}
#endregion
#region 查询数据
///
/// 得到一个对象实体
///
public AMYields GetModel(string strWhere)
{
return DataRowToModel(GetDataRow(strWhere));
}
///
/// 得到一个对象实体
///
public AMYields GetModel(string strLine, string strStation, string ODF, DateTime TestDate, int TestHour)
{
return DataRowToModel(GetDataRow(string.Format("Line = '{0}' and Station = '{1}' and ODF='{2}' and TestDate='{3}' and TestHour='{4}'", strLine, strStation, ODF, TestDate, TestHour)));
}
///
/// 得到一个对象实体
///
///
///
public AMYields DataRowToModel(DataRow row)
{
return DataRowToModelObject(row) as AMYields;
}
///
/// 获得数据Model列表
///
/// 条件 不包含 where 关键字
public List GetModelList(string strWhere)
{
DataSet ds = base.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
///
/// 获得数据列表
///
/// DataTable
public List DataTableToList(DataTable dt)
{
List modelList = new List();
List