/// <summary>
		/// Gets the dataset.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			// create the dataset
			var dataset = new Dataset();

			// loop over all the CMS plugin types
			foreach (var plugin in typeService.Load(context, "CmsPlugin").GetInheritingTypes(context).Select(type =>
			                                                                                                 {
			                                                                                                 	// get the plugin descriptor
			                                                                                                 	CmsPluginDescriptor descriptor;
			                                                                                                 	if (!type.TryGetDescriptor(out descriptor))
			                                                                                                 		throw new InvalidOperationException(string.Format("Type '{0}' does not contain a CMS-plugin", type.Name));

			                                                                                                 	// return the model
			                                                                                                 	return new
			                                                                                                 	       {
			                                                                                                 	       	Type = type,
			                                                                                                 	       	Descriptor = descriptor
			                                                                                                 	       };
			                                                                                                 }).OrderBy(plugin => plugin.Descriptor.GetOrder(context)))
			{
				// create the plugin row
				var row = new PropertyBag
				          {
				          	{"type", plugin.Type.Name}
				          };

				// add the row to the dataset
				dataset.AddRow(row);
			}

			return dataset;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Renders the header of the column on which this sorter is working.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		/// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
		public void RenderHeader(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (templateService == null)
				throw new ArgumentNullException("templateService");
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// determine if this column sort is active
			var activeSort = dataset.Sorts.FirstOrDefault();

			// check if there is an active sort
			var active = false;
			var ascending = false;
			if (activeSort != null && PropertyName.Equals(activeSort.PropertyName, StringComparison.OrdinalIgnoreCase))
			{
				active = true;
				ascending = activeSort.Ascending;
			}

			// create the sort properties
			var properties = new PropertyBag
			                 {
			                 	{"active", active},
			                 	{"direction", ascending},
			                 	{"sortParameter", PropertyName + " " + (ascending ? "desc" : "asc")}
			                 };

			using (context.Stack.Push("ColumnSortProperties", properties))
				templateService.Render(context, "GridControl" + GetType().Name + "Header").Dispose();
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Constructs a reader from the given <paramref name="dataset"/>.
		/// </summary>
		/// <param name="dataset">The <see cref="Dataset"/>.</param>
		/// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
		public DatasetReader(Dataset dataset)
		{
			// validate arguments
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// set the value
			this.dataset = dataset;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Constructs a loop for the specified dataset.
		/// </summary>
		/// <param name="dataset">The dataset throught which to loop.</param>
		public Loop(Dataset dataset)
		{
			// validate arguments
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// set values
			Reader = new DatasetReader(dataset);
			offset = dataset.IsPaged ? (dataset.CurrentPage - 1)*dataset.PageSize : 0;
			start = 0;
			end = dataset.RowCount - 1;
		}
		/// <summary>
		/// Gets the dataset.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			var dataset = new Dataset();
			foreach (var name in applicationResourceService.EnumeratorFolders(context, GetAttribute<string>(context, "path")))
			{
				dataset.AddRow(new PropertyBag
				               {
				               	{"name", name}
				               });
			}
			return dataset;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Renders a cell of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		/// <param name="row">The being rendered.</param>
		protected override void DoRenderCell(IMansionWebContext context, ITemplateService templateService, Dataset dataset, IPropertyBag row)
		{
			// create the cell properties
			var cellProperties = new PropertyBag
			                     {
			                     	{"value", epxression.Execute<object>(context)}
			                     };

			// render the cell
			using (context.Stack.Push("CellProperties", cellProperties))
				templateService.Render(context, "GridControlExpressionColumnContent").Dispose();
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		public void RenderHeaderFilter(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (templateService == null)
				throw new ArgumentNullException("templateService");
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// invoke template method
			DoRenderHeaderFilter(context, templateService, dataset);
		}
Ejemplo n.º 8
0
 /// <summary>
 /// Retrieves the all messages.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="username"> </param>
 /// <returns></returns>
 public Dataset RetrieveMessages(IMansionContext context, string username)
 {
     var dataset = new Dataset();
     dataset.AddRow(new PropertyBag
                    {
                    	{"message", string.Format("Friends are like street lights, Along the road, they don't make the distance any shorter {0}.", username)}
                    });
     dataset.AddRow(new PropertyBag
                    {
                    	{"message", string.Format("On this auspicious Festival of lights May the glow of joys Prosperity and happiness Alluminate {0}.", username)}
                    });
     return dataset;
 }
Ejemplo n.º 9
0
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		public void RenderHeader(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (templateService == null)
				throw new ArgumentNullException("templateService");
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// invoke the template
			using (context.Stack.Push("FilterProperties", Properties))
				DoRenderHeader(context, templateService, dataset);
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Gets the dataset.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			// get the attributes
			var input = GetAttribute(context, "input", string.Empty) ?? string.Empty;

			// create a dataset
			var dataset = new Dataset();
			foreach (var part in input.Split(new[] {GetAttribute(context, "separator", ",")}, StringSplitOptions.RemoveEmptyEntries))
			{
				dataset.AddRow(new PropertyBag
				               {
				               	{"value", part}
				               });
			}
			return dataset;
		}
		/// <summary>
		/// </summary>
		/// <param name="context"></param>
		/// <param name="dataset"></param>
		/// <returns></returns>
		public string Evaluate(IMansionContext context, Dataset dataset)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (dataset == null)
				throw new ArgumentNullException("dataset");

			// write the dataspace out to JSon array
			var buffer = new StringBuilder();
			using (var textWriter = new StringWriter(buffer))
			using (var jsonWriter = new JsonTextWriter(textWriter))
				dataset.WriteAsJSonArray(jsonWriter);

			// return the content of the buffer.
			return buffer.ToString();
		}
		/// <summary>
		/// Gets the dataset.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			// get the resource properties
			var resource = GetRequiredAttribute<ProtectedResource>(context, "source");

			// create the dataset
			var dataset = new Dataset();

			// loop over all the operations
			foreach (var operation in resource.Operations)
			{
				// add the resource to the dataset
				dataset.AddRow(PropertyBagAdapterFactory.Adapt(context, operation));
			}

			// return the set
			return dataset;
		}
		/// <summary>
		/// Gets the facet <see cref="Dataset"/> from a given <see cref="Nodeset"/>.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			// get the nodeset
			var nodeset = GetRequiredAttribute<Nodeset>(context, "source");

			// create the facet dataset
			var dataset = new Dataset();

			// add the facets to the dataset
			foreach (var result in nodeset.Facets.OrderBy(facet => facet.FriendlyName))
			{
				// add the row to the dataset
				dataset.AddRow(PropertyBagAdapterFactory.Adapt(context, result));
			}

			// return the dataset
			return dataset;
		}
		/// <summary>
		/// Constructs this provider with the specified <paramref name="children" />.
		/// </summary>
		/// <param name="children">The <see cref="XElement" />s from which to get the values.</param>
		public ChildXmlDatasetProvider(IEnumerable<XElement> children)
		{
			// validate arguments
			if (children == null)
				throw new ArgumentNullException("children");

			// create the dataset
			dataset = new Dataset();

			// loop over all the children and get the content of its children
			foreach (var child in children)
			{
				var properties = new PropertyBag();
				foreach (var contentChild in child.Elements())
					properties.Set(contentChild.Name.LocalName, contentChild.Value);
				dataset.AddRow(properties);
			}
		}
Ejemplo n.º 15
0
        /// <summary>
        /// Renders a column with the specified <paramref name="columnName"/> to the output pipe.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="columnName">The name of the column which to render.</param>
        /// <param name="ownerProperties">The <see cref="IPropertyBag"/> to which the column belongs.</param>
        /// <param name="blockDataset">The <see cref="Dataset"/> containing the all blocks of the <paramref name="ownerProperties"/>.</param>
        /// <returns>Returns the HTML for this column.</returns>
        public string Evaluate(IMansionContext context, string columnName, IPropertyBag ownerProperties, Dataset blockDataset)
        {
            // validate arguments
            if (context == null)
                throw new ArgumentNullException("context");
            if (string.IsNullOrEmpty(columnName))
                throw new ArgumentNullException("columnName");
            if (ownerProperties == null)
                throw new ArgumentNullException("ownerProperties");
            if (blockDataset == null)
                throw new ArgumentNullException("blockDataset");

            // render the column
            var buffer = new StringBuilder();
            using (var pipe = new StringOutputPipe(buffer))
            using (context.OutputPipeStack.Push(pipe))
                portalService.RenderColumn(context, columnName, ownerProperties, blockDataset, TemplateServiceConstants.OutputTargetField);

            // return the bufferred content
            return buffer.ToString();
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="context"></param>
		/// <param name="attributes"></param>
		/// <returns></returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			var jobNode = GetRequiredAttribute<Node>(context, "source");
			var dataset = new Dataset();
			var typeService = context.Nucleus.ResolveSingle<ITypeService>();
			var type = typeService.Load(context, jobNode.Type);
			var descriptors = type.GetDescriptors<RegisterTaskDescriptor>().Select(descriptor => descriptor);

			foreach (var descriptor in descriptors)
			{
				
				var taskProperties = new PropertyBag
				{
					{ "name", descriptor.TaskType.Name},
					{ "type", descriptor.TaskType.ToString()},
					{ "label", descriptor.TaskLabel}
				};
				dataset.AddRow(taskProperties);
			}
			
			return dataset;
		}
		/// <summary>
		/// Gets the dataset.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <param name="attributes">The attributes of this tag.</param>
		/// <returns>Returns the result.</returns>
		protected override Dataset Get(IMansionContext context, IPropertyBag attributes)
		{
			// create the dataset
			var dataset = new Dataset();

			// loop over all the types
			foreach (var type in typeService.LoadAll(context))
			{
				// if the type does not have a security descriptor ignore it
				SecurityDescriptor securityDescriptor;
				if (!type.TryGetDescriptor(out securityDescriptor))
					continue;

				// get the resource model
				var resource = securityDescriptor.GetResource(context);

				// add the resource to the dataset
				dataset.AddRow(PropertyBagAdapterFactory.Adapt(context, resource));
			}

			// return the set
			return dataset;
		}
Ejemplo n.º 18
0
		/// <summary>
		/// Gets the loop set.
		/// </summary>
		/// <param name="context">The request context.</param>
		/// <returns>Returns the <see cref="Dataset"/> on which to loop.</returns>
		protected override Dataset GetLoopset(IMansionContext context)
		{
			// get the range
			var start = GetRequiredAttribute<int>(context, "start");
			var end = GetRequiredAttribute<int>(context, "end");

			// validate arguments
			if (start < 0)
				throw new AttributeOutOfRangeException("start", this);
			if (end < 0 || end < start)
				throw new AttributeOutOfRangeException("end", this);

			Start = start;
			End = end;

			// create the dataset
			var dataset = new Dataset();

			// fill the dataset
			for (var index = start; index <= end; index++)
				dataset.AddRow(new PropertyBag());

			return dataset;
		}
Ejemplo n.º 19
0
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		protected abstract void DoRenderHeader(IMansionWebContext context, ITemplateService templateService, Dataset dataset);
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		protected override void DoRenderHeader(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			templateService.Render(context, "GridControl" + GetType().Name).Dispose();
		}
Ejemplo n.º 21
0
 /// <summary>
 /// Retrieves the all messages.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="username"> </param>
 /// <returns></returns>
 public Dataset RetrieveMessages(IMansionContext context, string username)
 {
     var dataset = new Dataset();
     dataset.AddRow(new PropertyBag
                    {
                    	{"message", string.Format("Stop wastin' me time an' put somethin' in th' box {0}!", username)}
                    });
     dataset.AddRow(new PropertyBag
                    {
                    	{"message", string.Format("What else ye got {0}? An' be quick about it, I be shippin' out soon!", username)}
                    });
     return dataset;
 }
		/// <summary>
		/// Renders the paging control for the given dataset.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/>.</param>
		/// <param name="id">The ID of the dataset which to page.</param>
		/// <returns>Returns the HTML of the paging control.</returns>
		public string Evaluate(IMansionContext context, Dataset dataset, string id)
		{
			return Evaluate(context, dataset, id, string.Empty);
		}
		/// <summary>
		/// Renders the paging control for the given dataset.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/>.</param>
		/// <param name="id">The ID of the dataset which to page.</param>
		/// <param name="cssClasses">Additional css classes</param>
		/// <returns>Returns the HTML of the paging control.</returns>
		public string Evaluate(IMansionContext context, Dataset dataset, string id, string cssClasses)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (dataset == null)
				throw new ArgumentNullException("dataset");
			if (string.IsNullOrEmpty(id))
				throw new ArgumentNullException("id");

			// check if this dataset does not support paging
			if (!dataset.IsPaged || dataset.RowCount == 0 || dataset.PageCount < 2)
				return string.Empty;

			// render the control
			var buffer = new StringBuilder();

			// get the control template
			var controlTemplateResourcePath = applicationResourceService.ParsePath(context, Control.ControlTemplatePathProperties);
			var controlTemplateResource = applicationResourceService.Get(context, controlTemplateResourcePath);

			// open the buffer pipe, control templates and render
			using (var pipe = new StringOutputPipe(buffer))
			using (context.OutputPipeStack.Push(pipe))
			using (templateService.Open(context, controlTemplateResource))
			{
				// construct the paging properties
				var pagingProperties = new PropertyBag
				                       {
				                       	{"id", id},
				                       	{"cssClasses", cssClasses},
				                       	/* row values */
				                       	{"rowStart", ((dataset.CurrentPage - 1)*dataset.PageSize) + 1},
				                       	{"rowEnd", Math.Min((dataset.CurrentPage*dataset.PageSize), dataset.TotalSize)},
				                       	{"rowTotal", dataset.TotalSize},
				                       	/* page values */
				                       	{"currentPage", dataset.CurrentPage},
				                       	{"pageCount", dataset.PageCount},
				                       	{"pageSize", dataset.PageSize}
				                       };

				// render the control
				using (context.Stack.Push("ControlProperties", pagingProperties))
				using (context.Stack.Push("PagingProperties", pagingProperties))
				using (templateService.Render(context, "PagingControl", TemplateServiceConstants.OutputTargetField))
				{
					// render all the page options
					var displayPageNumberStart = Math.Max(dataset.CurrentPage - NumberOfAdjacentPagesToDisplay, 1);
					var displayPageNumberEnd = Math.Min(dataset.CurrentPage + NumberOfAdjacentPagesToDisplay, dataset.PageCount);
					for (var pageNumber = displayPageNumberStart; pageNumber <= displayPageNumberEnd; pageNumber++)
					{
						using (context.Stack.Push("PageOption", new PropertyBag
						                                        {
						                                        	{"number", pageNumber}
						                                        }))
							templateService.Render(context, "PagingControlPageOption").Dispose();
					}
				}
			}

			// return the buffer
			return buffer.ToString();
		}
Ejemplo n.º 24
0
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		protected virtual void DoRenderHeader(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			using (context.Stack.Push("ColumnProperties", Properties))
			{
				// if the column has got a sort, allow it to render the header
				if (Sort != null)
					Sort.RenderHeader(context, templateService, dataset);
				else
					templateService.Render(context, "GridControl" + GetType().Name + "Header").Dispose();
			}
		}
		/// <summary>
		/// Retrieves a <see cref="Dataset"/> using <paramref name="query"/>.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="query">The query which to execute.</param>
		/// <returns>Returns a <see cref="Dataset"/> containing the results.</returns>
		/// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
		public Dataset RetrieveDataset(IMansionContext context, string query)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (string.IsNullOrEmpty(query))
				throw new ArgumentNullException("query");

			// create the connection and the transaction
			using (var connection = CreateConnection())
			using (var command = connection.CreateCommand())
			{
				// prepare the command
				command.Connection = connection;
				command.CommandText = query;
				command.CommandType = CommandType.Text;

				// execute the command
				using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
				{
					var dataset = new Dataset();

					// looop over all the results
					while (reader.Read())
					{
						// create the row
						var row = new PropertyBag();

						// map all the properties
						for (var index = 0; index < reader.FieldCount; index++)
							row.Set(reader.GetName(index), reader.GetValue(index));

						// add the row to the dataset
						dataset.AddRow(row);
					}

					return dataset;
				}
			}
		}
Ejemplo n.º 26
0
        /// <summary>
        /// Retrieves the crumb dasaset.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static Dataset RetrieveCrumbSet(IMansionContext context)
        {
            // retrieve the content and page node
            var contentIndexRootNode = context.Stack.Peek<Node>("ContentIndexRootNode");
            var siteNode = context.Stack.Peek<Node>("SiteNode");
            var contentNode = context.Stack.Peek<Node>("ContentNode");
            var pageNode = context.Stack.Peek<Node>("PageNode");

            // nodeset in which to store the
            var crumbSet = new Dataset();

            // retrieve page node parent nodes
            var pageParentNodeset = context.Repository.RetrieveNodeset(context, new PropertyBag
                                                                         {
                                                                         	{"childSource", pageNode},
                                                                         	{"depth", "any"},
                                                                         	{"sort", "depth asc"},
                                                                         });

            // start from the sitenode and take while the page node has not been reached
            foreach (var parentNode in pageParentNodeset.Nodes.SkipWhile(candidate => candidate.Pointer != siteNode.Pointer))
                crumbSet.AddRow(parentNode);

            // if the content node is not equal to the page node, the content node is not under the current site
            if (contentNode.Pointer != pageNode.Pointer)
            {
                // retrieve content node parent nodes
                var contentParentNodeset = context.Repository.RetrieveNodeset(context, new PropertyBag
                                                                                {
                                                                                    {"childSource", contentNode},
                                                                                    {"depth", "any"},
                                                                                    {"sort", "depth asc"},
                                                                                });

                // start from the content index root node
                foreach (var parentNode in contentParentNodeset.Nodes.SkipWhile(candidate => !candidate.Pointer.IsChildOf(contentIndexRootNode.Pointer)))
                    crumbSet.AddRow(parentNode);
            }

            // finally add the content node itself
            crumbSet.AddRow(contentNode);
            return crumbSet;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Renders the crumb trail.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="trail"></param>
        /// <returns></returns>
        private string RenderTrail(IMansionContext context, IEnumerable<Crumb> trail)
        {
            // validate arguments
            if (context == null)
                throw new ArgumentNullException("context");
            if (trail == null)
                throw new ArgumentNullException("trail");

            // create a dataset from the trail
            var dataset = new Dataset();
            foreach (var crumb in trail)
                dataset.AddRow(PropertyBagAdapterFactory.Adapt(context, crumb));

            // create a buffer in which to store the output
            var templateBuffer = new StringBuilder();
            using (var templateBufferPipe = new StringOutputPipe(templateBuffer))
            using (context.OutputPipeStack.Push(templateBufferPipe))
            using (templateService.Render(context, "CrumbTrail", TemplateServiceConstants.OutputTargetField))
            {
                // create the loop
                var loop = new Loop(dataset);
                using (context.Stack.Push("Loop", loop))
                {
                    // render the leafs recursively
                    foreach (var crumb in loop.Rows)
                    {
                        using (context.Stack.Push("CrumbProperties", crumb))
                            templateService.Render(context, "CrumbTrailItem").Dispose();
                    }
                }
            }

            // return the contents of the buffer
            return templateBuffer.ToString();
        }
Ejemplo n.º 28
0
		/// <summary>
		/// Renders the header of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		protected virtual void DoRenderHeaderFilter(IMansionWebContext context, ITemplateService templateService, Dataset dataset)
		{
			// if the column has got a filter, allow it to render the header
			if (Filter != null)
				Filter.RenderHeader(context, templateService, dataset);
			else
				templateService.Render(context, "GridControlNoFilter").Dispose();
		}
Ejemplo n.º 29
0
		/// <summary>
		/// Renders a cell of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		/// <param name="row">The being rendered.</param>
		public void RenderCell(IMansionWebContext context, ITemplateService templateService, Dataset dataset, IPropertyBag row)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (templateService == null)
				throw new ArgumentNullException("templateService");
			if (dataset == null)
				throw new ArgumentNullException("dataset");
			if (row == null)
				throw new ArgumentNullException("row");

			using (context.Stack.Push("ColumnProperties", Properties))
			using (templateService.Render(context, "GridControlCell"))
				DoRenderCell(context, templateService, dataset, row);
		}
Ejemplo n.º 30
0
		/// <summary>
		/// Renders a cell of this column.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="templateService">The <see cref="ITemplateService"/>.</param>
		/// <param name="dataset">The <see cref="Dataset"/> rendered in this column.</param>
		/// <param name="row">The being rendered.</param>
		protected abstract void DoRenderCell(IMansionWebContext context, ITemplateService templateService, Dataset dataset, IPropertyBag row);