/*-----------------------------------------------------------------------------
	Name: A01_MPD_009b_GenPg_Srch_DOB_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_009b_GenPg_Srch_DOB_PolicyToAdd()
{
	
	ns_page_think_time(1.0);

	/* slect policy to add - check box */

	//web_reg_find("Text=ACTIVE","Search=Body",LAST);
	
	//web_add_header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
	ns_start_transaction("A01_AZ_018_MPD_DOBSrch_PoltoAddCheckBox");

	//addDynaTraceHeader("NA=A01_AZ_018_MPD_DOBSrch_PoltoAddCheckBox;PC=flow_24");
	ns_web_url("DOB_PolicyToAdd",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t28.inf", 
		ITEMDATA,
		"Name=autoOtherPolicySearchForm:searchById","Value=customer",
		"Name=autoOtherPolicySearchForm:orderFirstName","Value={P_DOBFname}",
		"Name=autoOtherPolicySearchForm:orderLastName","Value={P_DOBLname}",
		"Name=autoOtherPolicySearchForm:orderDobInputDate","Value={P_DOBDOB}",
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate","Value={C_InsuredInputCurrentDate_01}",
		"Name=autoOtherPolicySearchForm:orderZipCode","Value=",
		"Name=autoOtherPolicySearchForm:orderAddressLine1","Value=",
		"Name=autoOtherPolicySearchForm:orderCity","Value=",
		"Name=autoOtherPolicySearchForm:riskStateDropdown","Value=",
		"Name=autoOtherPolicySearchForm:orderMembershipNumber","Value=",
		"Name=autoOtherPolicySearchForm:orderPhoneNumber","Value=",
		"Name=autoOtherPolicySearchForm:orderEmailAddress","Value=",
		"Name=autoOtherPolicySearchForm:hideSearch","Value=false",
		"Name=autoOtherPolicySearchForm:enableAddSelected","Value=false",
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID}:customerSelected","Value=true",
		"Name=autoOtherPolicySearchForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_01}",
		"Name=javax.faces.behavior.event","Value=click",
		"Name=org.richfaces.ajax.component","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID}:customerSelected",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID}:customerSelected",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID}:customerSelected",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=autoOtherPolicySearchForm","Value=autoOtherPolicySearchForm",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_018_MPD_DOBSrch_PoltoAddCheckBox", NS_AUTO_STATUS);

	ns_page_think_time(1.0);
	/* add selected */

	
	ns_start_transaction("A01_AZ_019_MPD_DOBSrch_AddSelected");

	//addDynaTraceHeader("NA=A01_AZ_019_MPD_DOBSrch_AddSelected;PC=flow_25");
	ns_web_url("DOB_ADDSelected",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Content-Type:application/x-www-form-urlencoded",
		//"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t29.inf", 
		ITEMDATA, 
		"Name=autoOtherPolicySearchForm:searchById", "Value=customer",  
		"Name=autoOtherPolicySearchForm:orderFirstName", "Value={P_DOBFname}",  
		"Name=autoOtherPolicySearchForm:orderLastName", "Value={P_DOBLname}",  
		"Name=autoOtherPolicySearchForm:orderDobInputDate", "Value={P_DOBDOB}",  
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate", "Value={C_InsuredInputCurrentDate_01}", 
		"Name=autoOtherPolicySearchForm:orderZipCode", "Value=",  
		"Name=autoOtherPolicySearchForm:orderAddressLine1", "Value=",  
		"Name=autoOtherPolicySearchForm:orderCity", "Value=",  
		"Name=autoOtherPolicySearchForm:riskStateDropdown", "Value=",  
		"Name=autoOtherPolicySearchForm:orderMembershipNumber", "Value=",  
		"Name=autoOtherPolicySearchForm:orderPhoneNumber", "Value=",  
		"Name=autoOtherPolicySearchForm:orderEmailAddress", "Value=",  
		"Name=autoOtherPolicySearchForm:hideSearch", "Value=false",  
		"Name=autoOtherPolicySearchForm:enableAddSelected", "Value=false",  
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID}:customerSelected", "Value=true",  
		"Name=autoOtherPolicySearchForm:btnAddSelected", "Value=Add Selected",  
		"Name=autoOtherPolicySearchForm_SUBMIT", "Value=1",  
		"Name=javax.faces.ViewState", "Value={C_VSPrefillPage_01}",  
		ITEMDATA_END
		);
	
	//lr_end_transaction("A01_AZ_019_MPD_DOBSrch_AddSelected", LR_AUTO);
	
	if(atoi(ns_eval_string("{AddSuccess}"))>0){
		
			ns_end_transaction("A01_AZ_019_MPD_DOBSrch_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_DOBPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_DOBFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_DOBLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By DOB: [%s]",ns_eval_string("{P_DOBDOB}"));
							
	}else{
		ns_end_transaction("A01_AZ_019_MPD_DOBSrch_AddSelected", NS_SUCCESS_STATUS);
		
			printf( " User: [%s] has Failed for retrieving ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_DOBPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_DOBFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_DOBLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By DOB: [%s]",ns_eval_string("{P_DOBDOB}"));
			
			ns_exit_session();
			
	}

}
