/// <summary>
        /// Creates an instance from a database record.
        /// It's optimized for large field names so can be used with SQLs
        /// that retrieve mixed categories&attributes information without naming collision.
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        public static PublicServiceAttributeCategory FromDB(dynamic record, IEnumerable <dynamic> list = null)
        {
            var cat = new PublicServiceAttributeCategory
            {
                serviceAttributeCategoryID = record.serviceAttributeCategoryID,
                name        = record.serviceAttributeCategoryName,
                description = record.serviceAttributeCategoryDescription
            };

            if (list != null)
            {
                cat.serviceAttributes = list.Select(ServiceAttribute.FromDB);
            }

            return(cat);
        }
Beispiel #2
0
 /// <summary>
 /// Get all service attributes assigned to the given userID and jobTitleID
 /// in groups indexed by the serviceAttributeCategoryID.
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="jobTitleID"></param>
 /// <param name="languageID"></param>
 /// <param name="countryID"></param>
 /// <returns></returns>
 public static IEnumerable <PublicServiceAttributeCategory> GetGroupedUserJobTitleAttributes(int jobTitleID, int userID, int languageID, int countryID)
 {
     return(GetUserJobTitleListData(userID, jobTitleID, 0, languageID, countryID)
            .GroupBy(att => (int)att.serviceAttributeCategoryID, (k, l) => (PublicServiceAttributeCategory)PublicServiceAttributeCategory.FromDB(l.First(), l)));
 }