예제 #1
0
        /// <summary>
        /// Creates a new Business.PortfolioCategory object from the data in the DataTableReader
        /// </summary>
        /// <param name="dtr">DataTableReader containing the PortfolioCategory's data</param>
        /// <returns>Business.PortfolioCategory object</returns>
        private static Business.PortfolioCategory GetPortfolioCategoryFromDataTableReader(DataTableReader dtr)
        {
            Business.PortfolioCategory portfolioCategory = new Business.PortfolioCategory();
            portfolioCategory.Id           = (Int16)dtr["Id"];
            portfolioCategory.Name         = (String)dtr["Name"];
            portfolioCategory.Images       = GetPortfolioImagesByParentId(portfolioCategory.Id);
            portfolioCategory.IsInDatabase = true;

            return(portfolioCategory);
        }
예제 #2
0
 /// <summary>
 /// Updates the category's details in the database
 /// </summary>
 /// <param name="portfolioCategory">PortfolioCategory object being updated in the database</param>
 public static void UpdatePortfolioCategory(Business.PortfolioCategory portfolioCategory)
 {
     try
     {
         Control.ExecuteNonQuery("UpdatePortfolioCategory", portfolioCategory.GetParametersForStoredProcedure(true));
     }
     catch (System.Exception e)
     {
         throw new Exception.UpdateDbObjectException("Could not update category in the database", e);
     }
 }
예제 #3
0
 /// <summary>
 /// Adds the category's details to the database
 /// </summary>
 /// <param name="portfolioCategory">PortfolioCategory object being added to the database</param>
 /// <returns>New unique identifier for the PortfolioCategory, generated by the database</returns>
 public static Int16 AddPortfolioCategory(Business.PortfolioCategory portfolioCategory)
 {
     try
     {
         return((Int16)Control.ExecuteScalar("AddPortfolioCategory", portfolioCategory.GetParametersForStoredProcedure(false)));
     }
     catch (System.Exception e)
     {
         throw new Exception.AddDbObjectException("Could not add category to database", e);
     }
 }