Click here to Skip to main content
15,886,823 members
Articles / Web Development / IIS

Rapid Web Application Development

Rate me:
Please Sign up or sign in to vote.
4.00/5 (5 votes)
27 Sep 200510 min read 203.9K   4.2K   86  
An article about the Multiformity Open Source project.
using System;

namespace rasp
{
	/// <summary>
	/// Summary description for LinkGenerator.
	/// </summary>
	public class LinkGenerator {

		/// <summary>
		/// Creates a link to a BasePage that allows the user to create a new row in the DB.
		/// </summary>
		/// <param name="adapter">The adapter that you want to create a new row in.</param>
		/// <returns>The link to the add page.</returns>
		public static string NewLink(string adapter) {
			return Constants.URLS.EditURL + "?"+Constants.Parameters.Adapter+"="+ adapter;
		}
		
		public static string LoginLink(string message, string URL) {
			return LinkGenerator.LoginLink(message) + "&" + Constants.Parameters.RedirectURL + "=" + URL;
		}
		
		public static string LoginLink(string message) {
			return Constants.URLS.LoginPage+ "?"+Constants.Parameters.Message+"="+ message;
		}

		public static string AddPropertiesFile() {
			return Constants.URLS.EditProperties;
		}

		public static string EditPropertiesFile(string filename) {
			return Constants.URLS.EditProperties+ "?"+Constants.Parameters.FileName+"="+ filename;
		}
		
		public static string LogoutLink() {
			return Constants.URLS.LoginPage + "?"+Constants.Parameters.LogOff+"=true";
		}
		/// <summary>
		/// Creates a link to a BasePage that allows the user to edit a row in the DB.
		/// </summary>
		/// <param name="adapter">The adapter that contains the row you wish to edit.</param>
		/// <param name="ID">The ID of the row that you wish to edit.</param>
		/// <returns>The link to the edit page.</returns>
		public static string EditLink(string adapter, int ID) {
			return Constants.URLS.EditURL + "?"+Constants.Parameters.Adapter+"="+ adapter + "&"+Constants.Parameters.ID+"=" + ID.ToString();
		}
		/// <summary>
		/// Creates a link to a BasePage that allows the user to edit a row in the DB.
		/// </summary>
		/// <param name="adapter">The adapter that contains the row you wish to edit.</param>
		/// <param name="ID">A comma seperated list of ID's</param>
		/// <returns>The link to the edit page.</returns>
		public static string EditLink(string adapter, string IDs) {
			return Constants.URLS.EditURL + "?"+Constants.Parameters.Adapter+"="+ adapter + "&"+Constants.Parameters.ID+"=" + IDs;
		}
		/// <summary>
		/// Creates a link to a BasePage that allows the user to edit a row in the DB.
		/// </summary>
		/// <param name="adapter">The adapter that contains the row you wish to edit.</param>
		/// <param name="ID">The ID of the row that you wish to edit.</param>
		/// <returns>The link to the edit page.</returns>
		public static string EditLink(string ChildAdapter, string ParentAdapter, int ParentID) {
			return Constants.URLS.EditURL + "?"+Constants.Parameters.Adapter+"="+ ChildAdapter + "&"+Constants.Parameters.ParentAdapter+"=" + ParentAdapter + "&"+Constants.Parameters.ID+"=" + ParentID.ToString();
		}

		/// <summary>
		/// Creates a link to a BasePage that displays the grid containing data from the specified adapter.
		/// </summary>
		/// <param name="adapter">The adapter you wish to display</param>
		/// <returns>The link to the display page.</returns>
		public static string DisplayLink(string adapter) {
      return Constants.URLS.DisplayURL + "?"+Constants.Parameters.Adapter+"="+adapter;
		}
		/// <summary>
		/// Creates a link to a BasePage that displays the grid containing data from the specified adapter.
		/// </summary>
		/// <param name="adapter">The adapter you wish to display</param>
		/// <param name="showcheckboxes">Flag indicating if you wish to show the checkboxes on the grid.</param>
		/// <returns></returns>
		public static string DisplayLink(string adapter, bool showcheckboxes) {
			return Constants.URLS.DisplayURL + "?"+Constants.Parameters.Adapter+"="+adapter + "&" + Constants.Parameters.ShowCheckBoxes + "=" + showcheckboxes;
		}
		/// <summary>
		/// Creates a link to a BasePage that displays the grid containing data from the specified adapter.
		/// </summary>
		/// <param name="adapter">The adapter you wish to display</param>
		/// <param name="showcheckboxes">Flag indicating if you wish to show the checkboxes on the grid.</param>
		/// <returns></returns>
		public static string DisplayLink(string adapter, bool showcheckboxes, bool showfilter, bool clearfilter) {
			return Constants.URLS.DisplayURL + "?"+Constants.Parameters.Adapter+"="+adapter + "&" + Constants.Parameters.ShowCheckBoxes + "=" + showcheckboxes + "&"+Constants.Parameters.ClearFilter + "="+ clearfilter + "&" + Constants.Parameters.ShowFilter + "=" + showfilter;
		}
		/// <summary>
		/// Creates a link to a listing BasePage that lists detailed fows of data in the specified adapter.
		/// </summary>
		/// <param name="adapter">The parent adapter to select a single row from.</param>
		/// <param name="subAdapter">The child adapter to select all related rows from.</param>
		/// <param name="ID">The ID of the parent row.</param>
		/// <returns>A link to the listing page.</returns>
		public static string ListingLink(string adapter, string subAdapter, int ID) {
			return Constants.URLS.ListingURL + "?"+Constants.Parameters.Adapter+"="+ adapter +"&"+Constants.Parameters.SubAdapter+"=" + subAdapter + "&"+Constants.Parameters.ID+"=" + ID.ToString();
		}


		public static string CalendarLink(string adapter, string startdate, string enddate, string displaytype) {
			return Constants.URLS.CalendarPage + "?"+ Constants.Parameters.Adapter +"="+ adapter + "&" + Constants.Parameters.StartDate +"="+ startdate + "&" + Constants.Parameters.EndDate + "=" + enddate +"&"+ Constants.Parameters.CalendarDisplayType + "=" + displaytype;
		}

		public static string ProcessViewerLink(string ProcessName, string HubName, int HubID) {
			return Constants.URLS.ProcessViewer + "?"+Constants.Parameters.ProcessName+"="+ ProcessName +"&"+Constants.Parameters.HubName+"=" + HubName + "&"+Constants.Parameters.HubID+"=" + HubID.ToString();
		}

		/// <summary>
		/// Creates a link to the treeview with the _Help tables specified as both the organizer and instance parameters. Additionally, 
		/// specifies that the provided ID parameter be displayed in the contents frame.
		/// </summary>
		/// <param name="HelpTopicID">The HelpID to be displayed.</param>
		/// <returns>A link to the help topic to be displayed in the treeview page.</returns>
		public static string HelpLink(int helptopicid) {
			return TreeViewLink("_Help", "_Help", helptopicid.ToString());
		}
		/// <summary>
		/// Creates a link to the treeview with the _Help tables specified as both the organizer and instance parameters. Additionally, 
		/// specifies that the provided ID parameter be displayed in the contents frame.
		/// </summary>
		/// <param name="HelpTopicID">The HelpID to be displayed.</param>
		/// <returns>A link to the help topic to be displayed in the treeview page.</returns>
		public static string HelpLink(string helptopicid) {
			return TreeViewLink("_HELP", "_HELP", helptopicid);
		}
		/// <summary>
		/// Creates a link to the treeview with the _Help tables specified as both the organizer and instance parameters.
		/// </summary>
		/// <returns>The default link to the help treeview page.</returns>
		public static string HelpLink() {
			return TreeViewLink("_HELP", "_HELP");
		}
		public static string TreeViewLink(string organizer, string instance, string instanceid) {
			return Constants.URLS.TreeViewURL + "?" + Constants.Parameters.Organizer + "=" + organizer + "&" + Constants.Parameters.Instance + "=" + instance + "&" + Constants.Parameters.InstanceID + "=" + instanceid;
		}
		public static string TreeViewLink(string organizer, string instance, int instanceid) {
			return Constants.URLS.TreeViewURL + "?" + Constants.Parameters.Organizer + "=" + organizer + "&" + Constants.Parameters.Instance + "=" + instance + "&" + Constants.Parameters.InstanceID + "=" + instanceid.ToString();
		}
		public static string TreeViewLink(string organizer, string instance) {
			return Constants.URLS.TreeViewURL + "?" + Constants.Parameters.Organizer + "=" + organizer + "&" + Constants.Parameters.Instance + "=" + instance;
		}

		
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions