protected void LoadFromReader(IDataReader dr, Os.Brain.iBxg.Core.Entity.News_Types model) { if (dr != null && !dr.IsClosed) { if (!dr.IsDBNull(0)) { model.NT_Serial = dr.GetInt32(0); } if (!dr.IsDBNull(1)) { model.Types_ID = dr.GetString(1); } if (!dr.IsDBNull(2)) { model.News_ID = dr.GetString(2); } if (!dr.IsDBNull(3)) { model.NT_AddTime = dr.GetDateTime(3); } if (!dr.IsDBNull(4)) { model.NT_AddUser = dr.GetString(4); } if (!dr.IsDBNull(5)) { model.NT_IsDel = dr.GetBoolean(5); } } }
/// <summary> /// GetList 获取数据集 /// </summary> /// <param name="dataParams">dataParams 查询参数</param> /// <returns>返回 数据集</returns> public IList <Os.Brain.iBxg.Core.Entity.News_Types> GetList(params DbParameter[] dataParams) { if (DataActions.select != this.Action) { return(null); } IList <Os.Brain.iBxg.Core.Entity.News_Types> returnList = new List <Os.Brain.iBxg.Core.Entity.News_Types>(); Os.Brain.iBxg.Core.Entity.News_Types _model = null; Database db = DatabaseFactory.CreateDatabase(Os.Brain.iBxg.Core.Entity.News_Types.CONN); DbCommand dbc = db.GetStoredProcCommand("News_Types_Get"); if (null != dataParams) { dbc.Parameters.AddRange(dataParams); } using (IDataReader dr = db.ExecuteReader(dbc)) { while (dr.Read()) { _model = new Os.Brain.iBxg.Core.Entity.News_Types(); LoadFromReader(dr, _model); returnList.Add(_model); } } return(returnList); }
/// <summary> /// GetItem 获取单个实体 /// </summary> /// <param name="ids">ids 主键值</param> /// <returns>返回 空或实体</returns> public Os.Brain.iBxg.Core.Entity.News_Types GetItem(string ids) { #region DEBUG Debug.WriteLine(string.Format(TSQL.DEBUG_START_LINE, "Os.Brain.iBxg.Core.Dal.GetItem START")); Debug.WriteLine(string.Format(TSQL.SELECT_ITEM, "[dbo].[News_Types]", "[NT_Serial]", "@NT_Serial")); Debug.WriteLine(string.Format(TSQL.DEBUG_END_LINE, "Os.Brain.iBxg.Core.Dal.GetItem END")); #endregion if (DataActions.select != this.Action) { return(null); } Os.Brain.iBxg.Core.Entity.News_Types _model = null; Database db = DatabaseFactory.CreateDatabase(Os.Brain.iBxg.Core.Entity.News_Types.CONN); DbCommand dbc = db.GetSqlStringCommand(string.Format(TSQL.SELECT_ITEM, "[dbo].[News_Types]", "[NT_Serial]", "@NT_Serial")); db.AddInParameter(dbc, "@NT_Serial", DbType.Int32, ids); using (IDataReader dr = db.ExecuteReader(dbc)) { if (dr.Read()) { _model = new Os.Brain.iBxg.Core.Entity.News_Types(); LoadFromReader(dr, _model); } } return(_model); }
protected void LoadFromReader1(IDataReader dr, Os.Brain.iBxg.Core.Entity.News_Types model) { if (dr != null && !dr.IsClosed) { model.NT_Serial = (int)dr["NT_Serial"]; model.Types_ID = dr["Types_ID"].ToString(); model.News_ID = dr["News_ID"].ToString(); model.NT_AddTime = (DateTime)dr["NT_AddTime"]; model.NT_AddUser = dr["NT_AddUser"].ToString(); model.NT_IsDel = (bool)dr["NT_IsDel"]; } }
/// <summary> /// Edit 编辑(新增,修改)一条数据 /// </summary> /// <param name="model">model 实体</param> /// <returns>返回 实体主键</returns> public object Edit(Os.Brain.iBxg.Core.Entity.News_Types model) { if (DataActions.insert == this.Action) { return(model.Insert()); } if (DataActions.update == this.Action) { return(model.Update()); } if (DataActions.delete == this.Action) { return(model.Delete()); } return(null); }
/// <summary> /// GetList 获取分页数据集 /// </summary> /// <param name="pageSize">pageSize 每页条数</param> /// <param name="currPage">currPage 当前页码</param> /// <param name="recordCount">recordCount 总记录数</param> /// <param name="dataParams">dataParams 查询参数</param> /// <returns>返回 数据集</returns> public IList <Os.Brain.iBxg.Core.Entity.News_Types> GetList(int pageSize, int currPage, out int recordCount, params DbParameter[] dataParams) { recordCount = 0; if (DataActions.select != this.Action) { return(null); } IList <Os.Brain.iBxg.Core.Entity.News_Types> returnList = new List <Os.Brain.iBxg.Core.Entity.News_Types>(); Os.Brain.iBxg.Core.Entity.News_Types _model = null; Database db = DatabaseFactory.CreateDatabase(Os.Brain.iBxg.Core.Entity.News_Types.CONN); DbCommand dbc = db.GetStoredProcCommand("News_Types_Get"); if (null != dataParams) { dbc.Parameters.AddRange(dataParams); } db.AddInParameter(dbc, "@PageIndex", DbType.Int32, currPage); db.AddInParameter(dbc, "@PageSize", DbType.Int32, pageSize); db.AddOutParameter(dbc, "@RecordCount", DbType.Int32, 4); using (IDataReader dr = db.ExecuteReader(dbc)) { while (dr.Read()) { _model = new Os.Brain.iBxg.Core.Entity.News_Types(); LoadFromReader(dr, _model); returnList.Add(_model); } } recordCount = (int)dbc.Parameters["@RecordCount"].Value; return(returnList); }
/// <summary> /// Edit 编辑(新增,修改)一条数据 /// </summary> /// <param name="model">model 实体</param> /// <returns>returns 实体主键</returns> public object Edit(Os.Brain.iBxg.Core.Entity.News_Types model) { return(this.dal.Edit(model)); }