123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- 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";
- /// <summary>
- /// 获取数据表名
- /// </summary>
- public override string TableName
- {
- get { return _tableName; }
- set { this._tableName = value; }
- }
- /// <summary>
- /// 获取当前新的数据表模型对象
- /// </summary>
- public override object ObjModel
- {
- get
- {
- return this.CurrentModel;
- }
- }
- /// <summary>
- /// 获取当前新的MOdel
- /// </summary>
- public AMYields CurrentModel
- {
- get { return new AMYields(); }
- }
- string _tableFieldNameString = "";
- /// <summary>
- /// 数据表字段名数组
- /// </summary>
- public override string TableFieldNameString
- {
- get { return this._tableFieldNameString; }
- set { this._tableFieldNameString = value; }
- }
- #endregion
- #region 检查记录
- //基类已经实现
- #endregion
- #region 增加数据
- /// <summary>
- /// 增加一条数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <returns></returns>
- public bool Add(AMYields model)
- {
- return base.Add(model);
- }
- /// <summary>
- /// 增加一条数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Add(AMYields model, string overlookFieldList = "ID")
- {
- return base.Add(model, overlookFieldList);
- }
- #endregion
- #region 删除数据
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public bool Delete(AMYields model)
- {
- return base.Delete(model.ID);
- }
- #endregion
- #region 更新数据
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(AMYields model)
- {
- return base.Update(model);
- }
- /// <summary>
- /// 根据筛选字段和SQL筛选运算符号更新数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="filterFieldName">筛选字段名称</param>
- /// <param name="operators">SQL筛选运算符号</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Update(AMYields model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
- {
- return base.Update(model, filterFieldName, operators, overlookFieldList);
- }
- #endregion
- #region 查询数据
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public AMYields GetModel(string strWhere)
- {
- return DataRowToModel(GetDataRow(strWhere));
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- 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)));
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- /// <param name="row"></param>
- /// <returns></returns>
- public AMYields DataRowToModel(DataRow row)
- {
- return DataRowToModelObject(row) as AMYields;
- }
- /// <summary>
- /// 获得数据Model列表
- /// </summary>
- /// <param name="strWhere">条件 不包含 where 关键字</param>
- public List<AMYields> GetModelList(string strWhere)
- {
- DataSet ds = base.GetList(strWhere);
- return DataTableToList(ds.Tables[0]);
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- /// <param name="dt">DataTable</param>
- public List<AMYields> DataTableToList(DataTable dt)
- {
- List<AMYields> modelList = new List<AMYields>();
- List<object> ObjList = base.GetDataTableToOblList(dt);
- foreach (object obj in ObjList)
- {
- modelList.Add((AMYields)obj);
- }
- return modelList;
- }
- #endregion
- }
- public class DAL_AMYields_TR : BaseDAL
- {
- public DAL_AMYields_TR(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_TR";
- /// <summary>
- /// 获取数据表名
- /// </summary>
- public override string TableName
- {
- get { return _tableName; }
- set { this._tableName = value; }
- }
- /// <summary>
- /// 获取当前新的数据表模型对象
- /// </summary>
- public override object ObjModel
- {
- get
- {
- return this.CurrentModel;
- }
- }
- /// <summary>
- /// 获取当前新的MOdel
- /// </summary>
- public AMYields_TR CurrentModel
- {
- get { return new AMYields_TR(); }
- }
- string _tableFieldNameString = "";
- /// <summary>
- /// 数据表字段名数组
- /// </summary>
- public override string TableFieldNameString
- {
- get { return this._tableFieldNameString; }
- set { this._tableFieldNameString = value; }
- }
- #endregion
- #region 检查记录
- //基类已经实现
- #endregion
- #region 增加数据
- /// <summary>
- /// 增加一条数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <returns></returns>
- public bool Add(AMYields_TR model)
- {
- return base.Add(model);
- }
- /// <summary>
- /// 增加一条数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Add(AMYields_TR model, string overlookFieldList = "ID")
- {
- return base.Add(model, overlookFieldList);
- }
- #endregion
- #region 删除数据
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public bool Delete(AMYields_TR model)
- {
- return base.Delete(model.ID);
- }
- #endregion
- #region 更新数据
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(AMYields_TR model)
- {
- return base.Update(model);
- }
- /// <summary>
- /// 根据筛选字段和SQL筛选运算符号更新数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="filterFieldName">筛选字段名称</param>
- /// <param name="operators">SQL筛选运算符号</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Update(AMYields_TR model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
- {
- return base.Update(model, filterFieldName, operators, overlookFieldList);
- }
- #endregion
- #region 查询数据
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public AMYields_TR GetModel(string strWhere)
- {
- return DataRowToModel(GetDataRow(strWhere));
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public AMYields_TR 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)));
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- /// <param name="row"></param>
- /// <returns></returns>
- public AMYields_TR DataRowToModel(DataRow row)
- {
- return DataRowToModelObject(row) as AMYields_TR;
- }
- /// <summary>
- /// 获得数据Model列表
- /// </summary>
- /// <param name="strWhere">条件 不包含 where 关键字</param>
- public List<AMYields_TR> GetModelList(string strWhere)
- {
- DataSet ds = base.GetList(strWhere);
- return DataTableToList(ds.Tables[0]);
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- /// <param name="dt">DataTable</param>
- public List<AMYields_TR> DataTableToList(DataTable dt)
- {
- List<AMYields_TR> modelList = new List<AMYields_TR>();
- List<object> ObjList = base.GetDataTableToOblList(dt);
- foreach (object obj in ObjList)
- {
- modelList.Add((AMYields_TR)obj);
- }
- return modelList;
- }
- #endregion
- }
- }
|