/*-----------------------------------------------------------------------------
	Name: A01_MPD_014b_GenPg_Srch_PolicyNum_PolicyToAdd.c
	Recorded By: Converted via tool
	Date of recording:
	Flow details:
	Build details:
	Modification History:
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ns_string.h"

void A01_MPD_014b_GenPg_Srch_PolicyNum_PolicyToAdd()
{
	//ns_page_think_time(think_time);
	//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*;q=0.8
	
//	web_add_header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*;q=0.8");*/
	
	ns_start_transaction("A01_AZ_046_MPD_PolicySrch_PoltoAddCheckBox");
	
	//addDynaTraceHeader("NA=A01_AZ_046_MPD_PolicySrch_PoltoAddCheckBox;PC=flow_54");
	ns_web_url("PolicyNum_PolicyToAdd",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t58.inf", 
		ITEMDATA,
		"Name=autoOtherPolicySearchForm:searchById","Value=policyNumber",
		"Name=autoOtherPolicySearchForm:autoPolicyTypeDropdown","Value=home",
		"Name=autoOtherPolicySearchForm:autoOrderPolicyNumber","Value={P_PolPolNum}",
		"Name=autoOtherPolicySearchForm:hideSearch","Value=false",
		"Name=autoOtherPolicySearchForm:enableAddSelected","Value=false",
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_05}:customerSelected","Value=true",
		"Name=autoOtherPolicySearchForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}",
		"Name=javax.faces.behavior.event","Value=click",
		"Name=org.richfaces.ajax.component","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_05}:customerSelected",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_05}:customerSelected",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_05}:customerSelected",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=autoOtherPolicySearchForm","Value=autoOtherPolicySearchForm",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_046_MPD_PolicySrch_PoltoAddCheckBox",NS_AUTO_STATUS);

	//ns_page_think_time(think_time);
	/* add se */

	
	ns_start_transaction("A01_AZ_047_MPD_PolicySrch_AddSelected");
	
	//addDynaTraceHeader("NA=A01_AZ_047_MPD_PolicySrch_AddSelected;PC=flow_55");
	ns_web_url("PoicyNum_ADDSelected",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		//"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t59.inf", 
		ITEMDATA, 
		"Name=autoOtherPolicySearchForm:searchById", "Value=policyNumber",  
		"Name=autoOtherPolicySearchForm:autoPolicyTypeDropdown", "Value=home",  
		"Name=autoOtherPolicySearchForm:autoOrderPolicyNumber", "Value={P_PolPolNum}",  
		"Name=autoOtherPolicySearchForm:hideSearch", "Value=false",  
		"Name=autoOtherPolicySearchForm:enableAddSelected", "Value=false",  
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_05}:customerSelected", "Value=true",  
		"Name=autoOtherPolicySearchForm:btnAddSelected", "Value=Add Selected",  
		"Name=autoOtherPolicySearchForm_SUBMIT", "Value=1",  
		"Name=javax.faces.ViewState", "Value={C_VSPrefillPage_06}",  
		ITEMDATA_END
		);
	
	//lr_end_transaction("A01_AZ_047_MPD_PolicySrch_AddSelected",LR_AUTO);
	
	if(atoi(ns_eval_string("{AddressSucceeded}"))>0){
		
			ns_end_transaction("A01_AZ_047_MPD_PolicySrch_AddSelected", NS_SUCCESS_STATUS);
			
			printf( " User: [%s] has Scuccessfully Searched and retrieved ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_PolPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_PolFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_PolLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By PolicyNumber: [%s]",ns_eval_string("{P_PolPolNum}"));
	}else{
		ns_end_transaction("A01_AZ_047_MPD_PolicySrch_AddSelected", NS_SUCCESS_STATUS);
			
			printf( " User: [%s] has failed to retrieving ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_PolPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_PolFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_PolLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By PolicyNumber: [%s]",ns_eval_string("{P_PolPolNum}"));

			ns_exit_session();
			
	}
	
}
