public ProposalTrackerRelationEntity GetProposalTrackerByTid(int Tid) { ProposalTrackerRelationEntity model = new ProposalTrackerRelationEntity(); StringBuilder strSql = new StringBuilder(); strSql.Append(@"SELECT * from ProposalTrackerRelation where TID=@Tid"); Database db = DatabaseFactory.CreateDatabase(); using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString())) { try { db.AddInParameter(dbCommand, "Tid", DbType.Int32, Tid); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) while (dataReader.Read()) { model = (ProposalTrackerRelationEntity.ReaderBind(dataReader)); } } catch (Exception ex) { WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]" , strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message)); return(null); } } return(model); }
public ProposalTrackerRelationEntity Get(int WID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,WID,TID,CreatedOn,CreatedBy from ProposalTrackerRelation "); strSql.Append(" where WID=@WID "); Database db = DatabaseFactory.CreateDatabase(); using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString())) { db.AddInParameter(dbCommand, "WID", DbType.Int32, WID); ProposalTrackerRelationEntity model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ProposalTrackerRelationEntity.ReaderBind(dataReader); } } return(model); } }