public static Catman GetCatmanByCatmanId(int catmanId) { Database db = DatabaseFactory.CreateDatabase("SPARInsightManagement"); string sqlCommand = "GetCatmanByCatmanId"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@CatmanId", DbType.Int32, catmanId); db.AddOutParameter(dbCommand, "@Description", DbType.String, 50); db.ExecuteNonQuery(dbCommand); Catman catman = new Catman(); catman.CatmanId = catmanId; catman.Description = db.GetParameterValue(dbCommand, "Description").ToString(); return(catman); }
public static List <Catman> GetCatmanList() { List <Catman> list = new List <Catman>(); Database db = DatabaseFactory.CreateDatabase("SPARInsightManagement"); string sqlCommand = "GetCatmanList"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { Catman catman = new Catman(); catman.CatmanId = Convert.ToInt32(dataReader["CatmanId"]); catman.Description = dataReader["Description"].ToString(); list.Add(catman); } } return(list); }