public PaperStrategy GetPaperStrategy(int PaperStrategyId) { PaperStrategy paperStrategy = null; Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_PAPER_STRATEGY_G"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_Paper_Strategy_id", DbType.Int32, PaperStrategyId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { paperStrategy = CreateModelObject(dataReader); } } PaperCategoryDAL paperCategoryDAL = new PaperCategoryDAL(); PaperCategory paperCategory = paperCategoryDAL.GetPaperCategory(paperStrategy.PaperCategoryId); paperStrategy.CategoryNames = GetPaperCategoryNames("/" + paperCategory.CategoryName, paperCategory.ParentId); return(paperStrategy); }
private string GetPaperCategoryNames(string strName, int nID) { string strPaperCategoryName = string.Empty; if (nID != 0) { PaperCategoryDAL paperCategoryDAL = new PaperCategoryDAL(); PaperCategory paperCategory = paperCategoryDAL.GetPaperCategory(nID); if (paperCategory.ParentId != 0) { strPaperCategoryName = GetPaperCategoryNames("/" + paperCategory.CategoryName, paperCategory.ParentId) + strName; } else { strPaperCategoryName = paperCategory.CategoryName + strName; } } return(strPaperCategoryName); }