using System; using System.Data; using System.Configuration; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using com.cloudsoft.utils; using System.Text; using System.Collections.Generic; /// /// Delegate defining the interface for BizRule /// public delegate String BizRule(string zRequest); /// /// Delegate defining the interface for BizRule /// public delegate XMLHelper XMLBizRule(XMLHelper oRequest); /// /// Delegate defining the interface for BizRule /// public delegate StringBuilder CSVBizRule(XMLHelper oRequest); namespace com.cloudsoft.utils { /// /// UI Helper class. Extends System.Web.UI.Page /// Should be used as the extention class in a aspx cs class. /// public class UIHelper : System.Web.UI.Page { /// /// Gets or sets the gprev page Global variable. /// /// The gprev page. public String gPrevPage { get { return getSyncKey("gPrevPage"); } set { setSyncKey("gPrevPage", value); } } /// /// Gets or sets the Global method variable. /// /// The method. public String zgMethod { get { return getSyncKey("gMethod"); } set { setSyncKey("gMethod", value); } } /// /// Gets or sets the Global current tab variable. /// /// The current tab. public String gCurrentTab { get { return getSyncKey("gCurrentTab"); } set { setSyncKey("gCurrentTab", value); } } /// /// Gets or sets the type of the Global page variable usied for paging. /// /// The Page number for paging public String zgPageType { get { return getSyncKey("zgPageType"); } set { setSyncKey("zgPageType", value); } } /// /// Gets or sets the Global user id (MUD ID). /// /// The MUD ID. public virtual String zgUser { get { return getSyncKey("gUserID"); } set { setSyncKey("gUserID", value); } } /// /// The Root Directory for the web /// public String zgRootDirectory = ""; /// /// The page title /// public String zgPageTitle = ""; /// /// The Full root web directory (eg. http://bresawn0123/cims) /// public String zgFullRootWeb = ""; /// /// The Root of the web (eg. /cims) /// public String zgRootWeb = ""; /// /// Array of Months /// public String[] arygMonths = new String[] {"January","February","March","April","May","June","July","August","September","October","November","December"}; /// /// An Array of slow business rules to be executed /// public String[] aSlowRules = new String[] {}; /// /// Array of returned XML from slow business rules /// public String[] aSlowXML = new String[] {}; /// /// The Global system (eg. cims). Should be overridden /// public String zgSystem = "cims"; /// /// Branding XML /// public XMLHelper oBranding = null; /// /// Current page /// public String gCurrentPage = ""; /// /// The Name displayed in the title for branding /// public String zgGlobalName = ""; /// /// The Object which raised an error /// public String zgErr_Object = ""; /// /// The Method which raised an error /// public String zgErr_Method = ""; /// /// Determins whether the user is a superuser /// public Boolean gbSuperUser = false; /// /// Determines whether menu security should be used /// public String zgSecurity = "ON"; /// /// Determines whether tasks should be shown /// public Boolean zbShowTasks = false; /// /// Default rows per page /// public int zgRowsPerPage = 20; /// /// Location of the Framework web /// public String zgFrameworkWeb = "/WI3/"; /// /// Full location of the framework web (eg. http://bresawnv0123/wi3) /// public String zgFullFrameworkWeb = ""; private DateTime gdStart; public Boolean bTopCalled = false; private Hashtable oSyncKeys = new Hashtable(); private Boolean bInLoad = false; /// /// Raises the System.Web.UI.Control.Init event to initialize the page. /// /// An System.EventArgs that contains the event data. override protected void OnInit(EventArgs e) { // Load SyncKeys from the Application Definition loadSyncKeys(); zgRootDirectory = Request.MapPath("~"); zgRootWeb = Request.ApplicationPath + "/"; zgUser = RequestP("zgUser"); //WADS: Secure connections... string protocolPrepend = "http://"; if (HttpContext.Current.Request.IsSecureConnection) protocolPrepend = "https://"; zgFullRootWeb = protocolPrepend + Request.ServerVariables["HTTP_HOST"].ToString() + zgRootWeb; zgFullFrameworkWeb = protocolPrepend + Request.ServerVariables["SERVER_NAME"].ToString() + zgFrameworkWeb; if (Session["MudID"] != null) { if (zgUser == "") zgUser = (String) Session["MudID"]; } else { if (zgUser == "") { zgUser = Request.ServerVariables["LOGON_USER"]; zgUser = zgUser.Substring(zgUser.IndexOf('\\')+1).ToUpper(); } } Session["MudID"] = zgUser; gdStart = DateTime.Now; //zgFrameworkDirectory = Request.MapPath(zgFrameworkWeb) + "\\"; gPrevPage = RequestP("gPrevPage"); gCurrentPage = Request.ServerVariables["PATH_INFO"].ToUpper(); if (gCurrentPage == gPrevPage) gCurrentTab = RequestP("gCurrentTab"); zgMethod = RequestP("gMethod"); // ---------------------------- // Page Type Setting // ---------------------------- // MENU: Menu Navigation Page // Full branding, Top Menu & Side Menu // TABSET: Tab Control Set Navigation Page // Full branding, Top Menu, Side Menu or Side TabControl // CONTENT: Content only (tab) // No Branding, no top menu, no side menu or side tab control // if (zgPageType == "") { zgPageType = RequestF("zgPageType"); switch (zgPageType) { case "MENU": case "CONTENT": case "TABSET": break; default: zgPageType = "MENU"; break; } } base.OnInit(e); } /// /// Determines whether an error is a UI error /// /// The Exception /// /// true if is UI error; otherwise, false. /// public Boolean isUIError(Exception err) { Boolean boolIsError = false; //switch (err.number) //{ // case -2147221005: // boolIsError = true; // break; // default: // boolIsError = false; // break; //} return boolIsError; } // ============================================================================ // Business Rule Execution (Logic Functions) // ============================================================================ /// /// Bubbles an event up to the loadorder if required /// public void LoadOrderBubble() { String zLoadOrder = RequestQS("loadorder"); if (!(zLoadOrder == "None" || zLoadOrder == null) && (zgPageType == "CONTENT")) { Response.Write(""); } } // ============================================================================ // TabControl Functions // ============================================================================ /// /// Writes the html for the chosen tabcontrol /// /// Name of the Menu (in this case, a page of tabcontrols) to write (will filter on security if set on) /// Name of the TabControl to write public void writeTabControl(String zMenu, String zTabControl) { XMLHelper oXML = getMenuDOM(zMenu); if (oXML != null) { oXML.getNode("/toplevel/navigation/menu[@id='" + zTabControl + "']").transform(zgFullFrameworkWeb + "xsl/UN_TabControl_SC.xsl", Response.Output); } } // ============================================================================ // Sync Key Functions // ============================================================================ /// /// write SyncKeys to Hidden Fields Should be overriden to include another systems sync keys /// public virtual void loadSyncKeys() { // Add your SyncKeys Here SyncKey("gPrevPage"); SyncKey("gMethod"); SyncKey("gCurrentTab"); SyncKey("zgPageType"); SyncKey("gUserID"); SyncKey("gdeleteID"); } /// /// Sets a Sync key. /// /// Name of the Sync Key public void SyncKey(String zName) { String zValue = Server.HtmlEncode(Request.Params[zName]); if (zValue == null) zValue = ""; if (!oSyncKeys.ContainsKey(zName)) oSyncKeys.Add(zName, zValue); else oSyncKeys[zName] = zValue; } /// /// Gets a sync key. /// /// Name of Sync Key /// The value of the Sync Key public String getSyncKey(String zName) { return (String) oSyncKeys[zName]; } /// /// Sets the sync key. /// /// Name of the Sync Key /// The value to set the Sync Key to. public void setSyncKey(String zName, String zValue) { oSyncKeys[zName] = zValue; } /// /// Write / update syncKeys on the client /// public void writeSyncKeys() { foreach (String zSyncKey in oSyncKeys.Keys) { Response.Write("\t setSyncKey(\"" + zSyncKey + "\", \"" + oSyncKeys[zSyncKey] + "\");\n"); } } /// /// Write syncKeys as hidden fields on the client. /// /// The Page Type public void writeSyncKeysToInput(String zPageType) { setSyncKey("zgPageType", zPageType); foreach (String zSyncKey in oSyncKeys.Keys) { Response.Write("\n"); } } // ============================================================================ // Paging // ============================================================================ // -------------------------------------------------------------- // Function: createPaging // Purpose: Create a DB paged response (list) // Outputs: // // -------------------------------------------------------------- /// /// Creates paging HTML. /// /// The current page. /// The total number of rows. /// The rows per page. public string createPaging(int lCurrentPage, int lRows, int lRowsPerPage) { StringBuilder sb = new StringBuilder(); int i; int lPageSet; int lFirst; int lLast; int lPages = 0; if (lRows > 0) lPages = ((lRows-1) / lRowsPerPage)+1; if ((lCurrentPage == 0) || (lPages == 0)) return ""; lPageSet = ((lCurrentPage-1) / 10) + 1; lFirst = ((lPageSet-1) * 10) + 1; lLast = lPageSet * 10; if (lLast > lPages) lLast = lPages; sb.Append("\r\n"); sb.Append("\r\n"); sb.Append("\r\n"); sb.Append("\r\n"); sb.Append("\r\n"); sb.Append("
Currently viewing page "); sb.Append(lCurrentPage + " out of "); sb.Append((lPages == 200) ? "at least 200" : lPages + " pages.Total found : " + lRows); if (lPages==200) sb.Append("+"); sb.Append("
\r\n"); sb.Append("\r\n"); if (lPageSet > 1) { sb.Append("\r\n"); } for (i=lFirst; i < lLast+1; i++) { if (i > 0 && i <= lPages) { if (i == lCurrentPage) { sb.Append("\r\n"); } else { sb.Append("\r\n"); } } } if (lLast < lPages) { sb.Append("\r\n"); } sb.Append("
33prev 10 [" + i + "]" + i + "next 1044
\r\n"); sb.Append("
\r\n"); return sb.ToString(); } // ============================================================================ // Select Dropdown Utilities // ============================================================================ public String generateSelectionMonth(String name) { return generateSelectionMonth(name, null); } /// /// Build a month select dropdown /// /// Name of the Select Tag /// Month to be preselected /// HTML for select Month public String generateSelectionMonth(String name, String selected) { DateTime now = DateTime.Now; String arg = selected; String output = ""; int pos = 0; int current = 0; // Need to determine the current month - number ie Oct is 9 in the array if (arg != "" && arg != null) { String aArg1 = arg.Split(new Char[] { ' ' })[0]; String[] aArg = aArg1.Split(new Char[] { '-' }); if (arg.Length == 2) current = Convert.ToInt32(arg) - 1; else { for (pos = 0; pos < arygMonths.Length; pos++) { if (aArg[1].Substring(0, 3).ToUpper() == arygMonths[pos].Substring(0, 3).ToUpper()) break; } current = pos; } } else current = now.Month - 1; // Write the Select tag output = ""; return output; } public String generateSelectionYear(String name, int yearsForward, int yearsBack) { return generateSelectionYear(name, yearsForward, yearsBack, null); } /// /// Build a year select dropdown /// /// Name of the Select Tag /// Number of years in the future to include /// Number of years in the past to include /// Year to be preselected /// HTML for select Month public String generateSelectionYear(String name, int yearsForward, int yearsBack, String selected) { DateTime now = DateTime.Now; String arg = selected; int current = now.Year; int start = current - yearsBack; int end = current + yearsForward; String output = ""; //Check to see if a year is already selected, also check if the selected year is //greater than the end if if so make the end the selected year if (arg != null) { String aArg1 = arg.Split(new Char[] { ' ' })[0]; String[] aArg = aArg1.Split(new Char[] { '-' }); if (aArg.Length > 0 && aArg[0] != "") { if (arg.Length == 4) { current = Convert.ToInt32(arg); } else { current = Convert.ToInt32(aArg[2]); } } } if (current > end) end = current; // Write the Select tag output = ""; return output; } /// /// Generates the select value= tag for a select box setting selected=true if the value = previous /// /// The value of the select option. /// The value to compare. /// Option attributes public String getOption(String zValue, String zPrevious) { String sReturn = "value=\"" + zValue + "\""; if (zValue == zPrevious) sReturn += " selected=\"true\""; return sReturn; } /// /// Standard look and field header. /// Should be called between a head html section of a web page /// /// The Page Title. /// Dummy parameter for backward compatibility /// Dummy parameter for backward compatibility public void Brand_Head(String zpPageTitle, String zDep1, String zDep2) { Brand_Head(zpPageTitle); } /// /// Standard look and field header. /// Should be called between a head html section of a web page /// /// The Page Title. /// Dummy parameter for backward compatibility public virtual void Brand_Head(String zpPageTitle, String zDep1) { Brand_Head(zpPageTitle); } /// /// Standard look and field header. /// Should be called between a head html section of a web page /// /// The Page Title. public void Brand_Head(String zpPageTitle) { Response.Write(Brand_Head(zpPageTitle, true)); } /// /// Standard look and field header. /// Should be inserted between a head html section of a web page /// /// The Page Title. public string Brand_Head(String zpPageTitle, Boolean ReturnMode) { try { zgPageTitle = zpPageTitle; StringBuilder sb = new StringBuilder(); //WADS REQUIREMENT: 5.1.1 sb.Append(""); sb.Append(""); sb.Append("" + zgSystem + "_" + zpPageTitle + ""); sb.Append(""); sb.Append(""); return sb.ToString(); } catch { return ""; } } /// /// Standard Look and field body /// Should be called between a body html section of a web page /// /// The side menu to display /// Dummy parameter for backward compatibility public void Brand_BodyTop(String zMenu, String zDep) { Brand_BodyTop(zMenu); } /// /// Standard Look and field body /// Should be called between a body html section of a web page /// /// The side menu to display /// Dummy parameter for backward compatibility /// Dummy parameter for backward compatibility public void Brand_BodyTop(String zMenu, String zSearch, Boolean bRenderTabCtrl) { Brand_BodyTop(zMenu); } /// /// Gets the menu DOM. /// /// The menu name to obrain the DOM for /// An XMLHelper DOM with the menu in it public XMLHelper getMenuDOM(String zMenu) { XMLHelper oMenu = null; if (Session["MenuXML"] == null) { String zFile = Request.MapPath("~/" + "menu/" + zgSystem + "Menu.xml"); oMenu = new XMLHelper(); oMenu.load(zFile); if (zgSecurity == "ON") { XMLHelper oRequest = newRequest("BuildUIMenu"); //Security_nTX oSec = new Security_nTX(); //String zResponse = oSec.GetUserResources(oRequest.getRootXML()); //XMLHelper oResponse = new XMLHelper(); //oResponse.load(zResponse); //Session.Add("UserResources", oResponse); //oResponse.appendNode(oMenu.getNode("/toplevel")); ////oMenu = oResponse.transform(zgFullFrameworkWeb + "xsl/FilterSideMenu.xsl"); ////WADS: Secure connections (can't establish secure connection from app)... //oMenu = oResponse.transform("http://localhost/wi3/xsl/FilterSideMenu.xsl"); } Session.Add("MenuXML", oMenu); } else { oMenu = (XMLHelper)Session["MenuXML"]; } return oMenu; } /// /// Standard Look and field body /// Should be called between a body html section of a web page /// /// The side menu to display public virtual void Brand_BodyTop(String zMenu) { try { bTopCalled = true; XMLHelper oMenu = getMenuDOM(zMenu); String zXSL = Request.MapPath("~/" + "menu/" + zgSystem + "Branding.xsl"); Dictionary aParams = new Dictionary(); aParams.Add("param1", zgSystem); aParams.Add("param2", zMenu); aParams.Add("param3", zgRootWeb); aParams.Add("param4", zgFullFrameworkWeb); aParams.Add("param5", zgPageTitle); oBranding = oMenu.transform(zXSL, aParams); XMLHelper oHead = oBranding.getNode("head"); Response.Write(oHead.getInnerXML()); Response.Write(""); Response.Write(""); // Get the left menu XML if (!zMenu.Equals("")) { XMLHelper oSide = oBranding.getNode("side"); Response.Write(oSide.getInnerXML()); } Response.Write("\r\n"); Response.Write("\r\n"); Response.Write("
"); Response.Write(""); XMLHelper oTitle = oBranding.getNode("title"); Response.Write(oTitle.getInnerXML()); Response.Write("\r\n"); Response.Write("\r\n"); Response.Write(" \r\n"); Response.Write("
\r\n"); Response.Write("
\r\n"); } catch {} } /// /// Standard Look and field Footer /// Should be called between at just before the closing body html section of a web page /// public virtual void Brand_BodyBottom() { try { // ------------------------ // Write Sync Keys to // hidden input fields // ------------------------ gPrevPage = gCurrentPage; writeSyncKeysToInput(zgPageType); // ------------------------ // Bubble to load order // if required // ------------------------ LoadOrderBubble(); if (bTopCalled) { Response.Write("
\r\n"); Response.Write("
\r\n"); Response.Write("
\r\n"); XMLHelper oBottom = oBranding.getNode("bottom"); Response.Write(oBottom.getInnerXML()); } Response.Write(""); } catch {} } /// /// Transforms the XML with the given XSL file. /// /// The XML file or XML String. /// The XSL file. /// The Transformed XML String public String transformXML(String xmlFile, String xslFile) { return transformXML(xmlFile, xslFile, new Dictionary()); } /// /// Transforms the XML with the given XSL file. /// /// The XML file or XML String. /// The XSL file. /// An array of Parameters to pass to the XSL stylesheet. /// The Transformed XML String public String transformXML(String xmlFile, String xslFile, Dictionary aParams) { StringWriter oString = new StringWriter(); XMLHelper oDOM = new XMLHelper(); if (xmlFile.StartsWith("<")) oDOM.load(xmlFile); else oDOM.load(Request.MapPath("~/" + xmlFile)); if (xslFile.Substring(0,5).Contains(":")) oDOM.transform(xslFile, aParams, oString); else oDOM.transform(Request.MapPath("~/" + xslFile), aParams, oString); return oString.ToString(); } /// /// Transforms the DOM with the given XSL file. /// /// An XMLHelper document /// The XSL file. public void transformXML(XMLHelper oDOM, String xslFile) { oDOM.transform(Request.MapPath("~/" + xslFile), Response.Output); } /// /// Transforms the DOM with the given XSL file. /// /// An XMLHelper document /// The XSL file. /// An array of Parameters to pass to the XSL stylesheet. public void transformXML(XMLHelper oDOM, String xslFile, Dictionary aParams) { oDOM.transform(Request.MapPath("~/" + xslFile), aParams, Response.Output); } /// /// Creates a standard request DOM with the resource, system and user (MUD ID). /// /// The resource (method) of the request. /// A standard request DOM with the resource, system and user public XMLHelper newRequest(String zResource) { XMLHelper oXML = new XMLHelper(); oXML.createStandardRequest(zResource, zgUser, zgSystem.ToUpper()); if (zgSecurity == "OFF") oXML.appendAttribute("sec", "off"); return oXML; } /// /// Loads a DOM with the XML file or XML String. /// /// The XML string or file. /// An XML helper DOM public XMLHelper loadDOM(String zXML) { XMLHelper oDOM = new XMLHelper(); oDOM.load(zXML); return oDOM; } /// /// Gets a standard request DOM using the Request.Form and Request.QueryString parameters. /// /// The resource (method) for the request. /// An XMLHelper DOM containing the Request.Form and Request.QueryString parameters. public XMLHelper getRequestDOM(String zResource) { XMLHelper oDOM = newRequest(zResource); oDOM.appendNode(Request.Form); oDOM.appendNode(Request.QueryString); return oDOM; } /// /// Gets a request DOM using the Request.Form and Request.QueryString parameters. /// /// An XMLHelper DOM containing the Request.Form and Request.QueryString parameters. public XMLHelper getRequestDOM() { XMLHelper oDOM = new XMLHelper("request"); oDOM.appendNode(Request.Form); oDOM.appendNode(Request.QueryString); return oDOM; } /// /// Gets the request DOM with Request.QueryString parameters. /// /// An XMLHelper DOM containing Request.QueryString parameters. public XMLHelper getRequestQueryDOM() { XMLHelper oDOM = new XMLHelper("request"); oDOM.appendNode(Request.QueryString); return oDOM; } /// /// Gets the request DOM with Request.Form parameters. /// /// An XMLHelper DOM containing Request.Form parameters public XMLHelper getRequestFormDOM() { XMLHelper oDOM = new XMLHelper("request"); oDOM.appendNode(Request.Form); return oDOM; } /// /// Executes a business method returning a DOM. /// /// The Bizrule method. /// The Request DOM. /// An XMLHelper response DOM public XMLHelper executeBizMethodDOM(BizRule oMethod, XMLHelper oRequest) { return executeBizMethodDOM(oMethod, oRequest.getRootXML(), true); } /// /// Executes a business method returning a DOM. /// /// The Bizrule method. /// The request XML. /// An XMLHelper response DOM public XMLHelper executeBizMethodDOM(BizRule oMethod, String zRequestXML) { return executeBizMethodDOM(oMethod, zRequestXML, true); } /// /// Executes a business method returning a DOM. /// /// The Bizrule method. /// The request XML. /// if set to true [automatically display errors]. /// An XMLHelper response DOM public XMLHelper executeBizMethodDOM(BizRule oMethod, String zRequestXML, Boolean bDisplayErrors) { XMLHelper oDOM = new XMLHelper(); oDOM.load(executeBizMethod(oMethod, zRequestXML, bDisplayErrors)); return oDOM; } /// /// Executes a business method returning an XML String. /// /// The Bizrule method. /// The Request DOM. /// The response dom as a string public String executeBizMethod(BizRule oMethod, XMLHelper oRequest) { return executeBizMethod(oMethod, oRequest.getRootXML(), true); } /// /// Executes a business method returning an XML String. /// /// The Bizrule method. /// The request XML. /// The response dom as a string public String executeBizMethod(BizRule oMethod, String zRequestXML) { return executeBizMethod(oMethod, zRequestXML, true); } /// /// Executes a business method returning an XML String. /// /// The Bizrule method. /// The request XML. /// if set to true [automatically display errors]. /// public String executeBizMethod(BizRule oMethod, String zRequestXML, Boolean bDisplayErrors) { try { return oMethod(zRequestXML); } catch (Exception ex) { if (bDisplayErrors != false) { //WADS: Detailed exception info no longer given to the user... throw new Exception("You cannot give detailed exception info to the user"); } else { throw ex; } } } /// /// Executes a business method returning an XML String. /// /// The XMLBizrule method. /// The request XML. /// if set to true [automatically display errors]. /// public XMLHelper executeBizMethod(XMLBizRule oMethod, XMLHelper oRequest, Boolean bDisplayErrors) { if (bDisplayErrors == true) { try { return oMethod(oRequest); } catch (Exception ex) { if (bDisplayErrors != false) { if (ex.Message.Substring(0,9) == "ORA-20000") { throw ex; } else { //WADS: Detailed exception info no longer given to the user... throw new Exception("You cannot give detailed exception info to the user"); } } else { throw ex; } } } else { return oMethod(oRequest); } } public StringBuilder executeBizMethod(CSVBizRule oMethod, XMLHelper oRequest) { return oMethod(oRequest); } /// /// Displays an error message /// /// The Exception to handle. public void handleError(Exception ex) { handleError(ex, null); } /// /// Displays an error message /// /// The Exception to handle. /// The Exception to handle. public void handleError(Exception ex, String zRequestXML) { //WADS: Detailed exception info no longer given to the user... throw new Exception("You cannot give detailed exception info to the user"); } /// /// Validates the number. /// /// The Number to check. /// Converted number as a string public String validNumber(String zInput) { try { return Convert.ToDouble(zInput).ToString(); } catch { return ""; } } /// /// Returns a default of the checked value is null otherwise it returns a the value to check /// /// Value to check. /// The default. /// Either the Checked value or the default depending on whether the checked value is null public String ifNull(Object oCheck, String zDefault) { if (oCheck == null) return zDefault; else return oCheck.ToString(); } /// /// Returns a default of the checked value is null otherwise it returns a the value to check /// /// Value to check. /// The default. /// Either the Checked value or the default depending on whether the checked value is null public int ifNull(Object oCheck, int iDefault) { if (oCheck == null) return iDefault; else return Convert.ToInt32(oCheck); } /// /// Determines whether the user has a given resource. /// /// Name of the resource to check. /// /// true if the user has the given resource; otherwise, false. /// public Boolean hasSecurityResource(String zResourceName) { XMLHelper oDOM = (XMLHelper)Session["UserResources"]; if (oDOM == null) return false; if (oDOM.nodeCount("//resource[@name='" + zResourceName.ToUpper() + "']") == 0) return false; else return true; } //======================================================================================== // W A D S //======================================================================================== public String RequestQS(String input) { String strCheck = ifNull(Request.QueryString[input], ""); return Server.HtmlEncode(strCheck); } public int RequestQS(String input, int intDefault) { return ifNull(Request.QueryString[input], 0); } public String RequestF(String input) { String strCheck = ifNull(Request.Form[input], ""); return Server.HtmlEncode(strCheck); } public int RequestF(String input, int intDefault) { return ifNull(Request.Form[input], 0); } public String RequestFGet(String input) { String strCheck = ifNull(Request.Form.Get(input), ""); return Server.HtmlEncode(strCheck); } public String RequestP(String input) { String strCheck = ifNull(Request.Params[input], ""); return Server.HtmlEncode(strCheck); } public String RequestWADS(String input, String strDefault) { String strCheck = ifNull(Request[input], strDefault); return Server.HtmlEncode(strCheck); } public String RequestWADS(String input) { String strCheck = ifNull(Request[input], ""); return Server.HtmlEncode(strCheck); } public int RequestWADS(String input, int intDefault) { return ifNull(Request[input], 0); } public String RequestCookies(String section, String input) { String strCookie = ""; try { strCookie = Request.Cookies[section][input]; } catch (Exception ex) { strCookie = ""; } return Server.HtmlEncode(strCookie); } public String RequestXML(String input) // for xml strings do nothing for now; Server.HtmlEncode corrupts xml stings { String strCheck = ifNull(Request[input], ""); return strCheck; } public XMLHelper serialisePost() { XMLHelper oRequest = new XMLHelper("request"); oRequest.appendNode("system", zgSystem); if (zgSecurity == "OFF") oRequest.appendAttribute("sec", "off"); foreach (String s in Request.Form) { if (s != null) { if (s[0] == '_') { if (s.Length > 1) { oRequest.appendAttribute(s.Substring(1), Request.Form[s]); } } else { //Sync Key if (s.StartsWith("g_")) { String zField = s.Substring(2); if (ifNull(Request.Form[zField], "") == "") oRequest.setNode(zField, Request.Form[s]); } else { oRequest.setNode(s, Request.Form[s]); } } } } return oRequest; } } }