Jump to content

asp noob needs some help


Recommended Posts

i have this page that I am analyzing to help make a escalation tool to use at work.This is the source of a form used in another tool already developed that has the ability to pull information from our billing system with some javascript (atleast thats how I think it works).Anyway, I need to be able to formulate a simple function that will pull the customers Account Number, First Name, Last Name, and Phone Number from the billing system and input the data into a form.In order to do that I guess I need to understand asp and some more java.In fact I am such a noob at ASP i'm not even sure why the page starts like a normal HTML file.If someone could break it down for me how i can preform the above that would be awesome.Some things that need to be known, the process that actually pulls the data is the onclick of the Get ACSR Customer button which calls SCRAPE().Its only dependency that I can see is <script language="JavaScript" src="includes\SitAoi.js"></script>If needed I can post the source of that aswell.the page mentioned above:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>	<HEAD>		<title>Customer</title>		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">		<meta content="C#" name="CODE_LANGUAGE">		<meta content="JavaScript" name="vs_defaultClientScript">		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">		<META http-equiv="REFRESH" content="1140">		<script language="JavaScript" id="1" src="includes\er.js"></script>		<script language="JavaScript" src="includes\SitAoi.js"></script>		<script language="javascript">			var bValidate = false;						//------------------------------------------>>			function ValidateForm()			//------------------------------------------>>			{				if (bValidate)				{					var aStrRequiredFields = Array("TxtBoxFirstName", 											"TxtBoxLastName", 											"DrpDwnRegion",											"TxtBoxZip",											"DrpDwnState",											"DrpDwnCity", 											"TxtBoxAddressLine1", 											"TxtBoxStreetNumber",											"TxtBoxStreetName",											"TxtBoxCsgSubAcct",											"TxtBoxAcctCorp",											"TxtBoxHouse",											"TxtBoxCust");					var aStrRequiredDescriptions = Array("First Name", 														"Last Name", 														"Region",														"Zip Code",														"State",														"City", 														"Address", 														"Street Number",														"Street Name",														"Subscriber Account Number",														"Account Corp",														"Account House Number",														"Account Customer Number");					var strMsg = "Please correct the following fields:\n\n";					var iMsgLentgth = strMsg.length;					for (var i = 0; i < aStrRequiredFields.length; i++)					{						var oField = document.getElementById(aStrRequiredFields[i]);						if (oField)						{							switch(oField.type)							{								case "select-one" :									if (oField.selectedIndex == 0 || oField.selectedIndex == -1 || oField.options[oField.selectedIndex].text == "[SELECT]")										strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n";									break;								case "select-multiple" :									if (oField.selectedIndex == -1)										strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n";									break;								case "textarea" :									break;								case "text" :									switch (oField.name)									{ 										case "TxtBoxCsgSubAcct" :											var oChkBoxNonSub = document.getElementById("ChkBoxNonSub");											if (!oChkBoxNonSub.checked && 0 == oField.value.length && document.getElementById("DrpDwnRegion").value != '4' && document.getElementById("DrpDwnRegion").value != '5' && document.getElementById("DrpDwnRegion").value != '6' && document.getElementById("DrpDwnRegion").value != '7' && document.getElementById("DrpDwnRegion").value != '8')												 strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n";										break;																					case "TxtBoxAcctCorp" :										var oChkBoxNonSub = document.getElementById("ChkBoxNonSub");										if (!oChkBoxNonSub.checked && 0 == oField.value.length)												 strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n";										else if (oField.value.length > 0)											{												if(oField.value.length > 5 || oField.value.length < 4) 													strMsg += " - " + aStrRequiredDescriptions[i] +  " Appears to be too long or too short for a valid account number 4 or 5 characters";												else if (!ValidField("ACCTNUM", oField.value))													strMsg += " - " + aStrRequiredDescriptions[i] +  " must contain only numbers";											}									 										break;																				case "TxtBoxHouse" :										var oChkBoxNonSub = document.getElementById("ChkBoxNonSub");										if (!oChkBoxNonSub.checked && 0 == oField.value.length)												 strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n";										else if (oField.value.length > 0)											{												if(oField.value.length > 6 || oField.value.length < 1) 													strMsg += " - " + aStrRequiredDescriptions[i] +  " Appears to be too long or too short for a valid account number 1 to 6 characters";												else if (!ValidField("ACCTNUM", oField.value))													strMsg += " - " + aStrRequiredDescriptions[i] +  " must contain only numbers";											}									 										break;																				case "TxtBoxCust" :										var oChkBoxNonSub = document.getElementById("ChkBoxNonSub");										if (!oChkBoxNonSub.checked && 0 == oField.value.length)												 strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n";										else if (oField.value.length > 0)											{												if(oField.value.length > 4 || oField.value.length < 1) 													strMsg += " - " + aStrRequiredDescriptions[i] +  " Appears to be too long or too short for a valid account number 4 or 5 characters";												else if (!ValidField("ACCTNUM", oField.value))													strMsg += " - " + aStrRequiredDescriptions[i] +  " must contain only numbers";											}									 										break;										case "TxtBoxZip" :											if (oField.value == "" || oField.value == null)												strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n";											else if (oField.value.length != 5 && oField.value.length != 10) 												strMsg += " - " + aStrRequiredDescriptions[i] +  " must be 5 or 10 characters \n";											else if (!ValidField("ZIP", oField.value))												strMsg += " - " + aStrRequiredDescriptions[i] +  " must contain only numbers and hyphens \n";											break;										default :											if (oField.value == "" || oField.value == null)												strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n";										break;									}									break;																default:									if (oField.value == "" || oField.value == null)										strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n";							}						}					}					bValidate = false;					if (strMsg.length == iMsgLentgth)						return true;					else					{						parent.document.getElementById("TblHeader").focus();						alert(strMsg);						return false;					}				}				else					return true;			}						//------------------------------------------>>			function EnableValidation()			//------------------------------------------>>			{				bValidate = true;			}			//------------------------------------------>>			function RequireConfirmation(iReason)			//------------------------------------------>>			{				if (document.getElementById("dgCustomerMatches"))				{					document.getElementById("TrDataGrid1").style.display = 'block';					document.getElementById("TrDataGrid2").style.display = 'block';					if (document.getElementById("LblCustomerHistory"))					{						document.getElementById("TrCustomerHistory1").style.display = 'block';						document.getElementById("TrCustomerHistory2").style.display = 'block';						document.getElementById("TrCustomerHistory3").style.display = 'block';					}				}				var strPrompt = "";								if (0 == iReason)					alert("Please select an existing customer or confirm that this is a new customer.");				else				{					if (1 == iReason)						strPrompt = "This Customer has an open ticket. Are you sure you want to create a new ticket? Please confirm that this is a new issue by typing I CONFIRM below.";					else if (2 == iReason)						strPrompt = "Are you sure this is not an existing customer? Please confirm that this is a different customer by typing I CONFIRM.";					else if (3 == iReason)						strPrompt = "Are you sure this is a new or existing customer? Please check the account number and confirm that this a new or existing customer by typing I CONFIRM.";										var strConfirm = prompt(strPrompt, "");					if (null != strConfirm && "I CONFIRM" == strConfirm.toUpperCase())						document.location.href = "WizardPage.aspx?WizardType=Ticket";					else if (null != strConfirm)					{						alert("Please Confirm by typing I CONFIRM.");						RequireConfirmation(iReason);					}				}			}						//------------------------------------------>>			function GetTicket()			//------------------------------------------>>			{				var lstBoxCustomerHistory = document.getElementById("LstBoxCustomerHistory");				var iSelected = lstBoxCustomerHistory.selectedIndex;							document.location.href="Customer.aspx?CustomerHistoryRequest=" + lstBoxCustomerHistory.options[iSelected].value;			}						//------------------------------------------>>			function HistoryError()			//------------------------------------------>>			{				alert("Sorry, History for this ticket has been archived and is not available");			}			//------------------------------------------>>			function CustomerReturn(result)			//------------------------------------------>>			{				if (result.indexOf('^ERROR') == 0)					alert(result);				else					document.location.href = "Customer.aspx?" + result;			}							//------------------------------------------>>			function ComtracsScrape()			//------------------------------------------>>			{				//--->> Validate each entry field				if (document.Form1.txtCorp.value == null || document.Form1.txtCorp.value == "" || document.Form1.txtCorp.value == " " || !ValidField("NUMERIC-", document.Form1.txtCorp.value) || document.Form1.txtCorp.value.length < 4 )					alert (document.Form1.txtCorp.value + " Not a valid CORP Please Re-Enter Corp and try again");				else if (document.Form1.txthouse.value == null || document.Form1.txthouse.value == "" || document.Form1.txthouse.value == " " || !ValidField("NUMERIC-", document.Form1.txthouse.value) || document.Form1.txthouse.value.length > 6 || document.Form1.txthouse.value.length < 1)					alert (document.Form1.txthouse.value + " Not a valid House Number Please Re-Enter House Number and try again");				else if (document.Form1.txtcustNum.value == null || document.Form1.txtcustNum.value == "" || document.Form1.txtcustNum.value == " " || !ValidField("NUMERIC-", document.Form1.txtcustNum.value) || document.Form1.txtcustNum.value.length < 1 )					alert (document.Form1.txtcustNum.value + " Not a valid Customer Number Please Re-Enter Customer Number and try again");				else 				{					document.location.href = "Customer.aspx?ScrapeAmdocs=1&Corp=" + document.Form1.txtCorp.value 												+ "&House=" + document.Form1.txthouse.value												+ "&CustNum=" + document.Form1.txtcustNum.value;				}			}														//------------------------------------------>>			function Scrape()			//------------------------------------------>>			{				var oCustomer = new SitCust(1);				var bScrapeSuccess = oCustomer.ExecuteQuery();								if (!bScrapeSuccess)				{					oCustomer = new SitCust(2);					bScrapeSuccess = oCustomer.ExecuteQuery(); 					if (!bScrapeSuccess)					{						if ("" != document.getElementById("TxtBoxCsgSubAcct").value)							document.location.href = "Customer.aspx?ScrapeAccountNumber=" + document.getElementById("TxtBoxCsgSubAcct").value;						else if ("" != document.getElementById("TxtBoxHomePhone").value)							document.location.href = "Customer.aspx?ScrapePhoneNumber=" + document.getElementById("TxtBoxHomePhone").value;						else							alert("S.I.T. Communicator is not installed.  Please contact the helpdesk for installation.");					}				}				if (bScrapeSuccess)				{					//-->> CHECK ACSR SCRAPE FIRST					if (oCustomer.ExecuteQuery())					{						var strParam = "ScrapeACSR=1&FirstName=";						strParam += escape(oCustomer.getFirstName());						strParam += "&LastName=";						strParam += escape(oCustomer.getLastName());						strParam += "&Address1=";						strParam += escape(oCustomer.getAddress1());						strParam += "&Address2=";						strParam += escape(oCustomer.getAddress2());						strParam += "&City=";						strParam += escape(oCustomer.getCity());						strParam += "&State=";						strParam += escape(oCustomer.getState());						strParam += "&Zip=";						strParam += escape(oCustomer.getZip());						strParam += "&HomePhone=";						strParam += escape(oCustomer.getHomePhone());						strParam += "&WorkPhone=";						strParam += escape(oCustomer.getWorkPhone());						strParam += "&AccountNumber=";						strParam += escape(oCustomer.getAccountNumber());						strParam += "&HouseKey=";						strParam += escape(oCustomer.getHouseKey());						strParam += "&Principal=";						strParam += escape(oCustomer.getPrincipal());						strParam += "&MgmtArea=";						strParam += escape(oCustomer.getMgmtArea());						if ("" == oCustomer.getLastName())							alert("Please ensure that you are on the Account Information screen in ACSR and try again.  If problem persists contact the helpdesk.");						else							document.location.href = "Customer.aspx?" + strParam;					}				} &nb
Link to post
Share on other sites

It looks like the communication is done inside the SitCust object, e.g.:var oCustomer = new SitCust(1);var bScrapeSuccess = oCustomer.ExecuteQuery();You can see some error checking in the code, and if it completes then the function just redirects to another page and includes all of the information in the URL. If you don't want to redirect then you would just update the existing elements on the page instead.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...