Exemple #1
0
        internal static TemplateCollection CreateDataObjectCollection(DataTable data)
        {
            var result = new TemplateCollection();

            foreach (DataRow row in data.Rows)
            {
                result.Add(Template.CreateFromData(row));
            }

            return(result);
        }
        public TemplateCollection GetTemplates(TemplateSearchParameters searchParameters)
        {
            var command = SqlDbAccess.CreateTextCommand();
            var sb      = new StringBuilder(@"
				SELECT 
					TemplateId,
					Name,
					CreatedByUserId,
					CreatedDate,
					LastModifiedDate,
					VisualProperties
				FROM 
					[Cerberus.TemplateEngine.Template] "                    );

            if (searchParameters.CreatedByUserId > 0)
            {
                sb.AppendLine(" WHERE CreatedByUserId = @CreatedByUserId ");
                SqlDbAccess.AddParameter(command, "@CreatedByUserId", SqlDbType.Int, searchParameters.CreatedByUserId);
            }

            command.CommandText = sb.ToString();

            return(TemplateCollection.CreateDataObjectCollection(SqlDbAccess.ExecuteSelect(command)));
        }