/*-----------------------------------------------------------------------------
	Name: A01_MPD_011b_GenPg_Srch_MemNum_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_011b_GenPg_Srch_MemNum_PolicyToAdd()
{
	
	//ns_page_think_time(think_time);

	/* slect policy to add - check box */

	
	ns_start_transaction("A01_AZ_029_MPD_MemSrch_PoltoAddCheckBox");

	//addDynaTraceHeader("NA=A01_AZ_029_MPD_MemSrch_PoltoAddCheckBox;PC=flow_24");
	ns_web_url("MemNum_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=t28.inf", 
		ITEMDATA,
		"Name=autoOtherPolicySearchForm:searchById","Value=customer",
		"Name=autoOtherPolicySearchForm:orderFirstName","Value=",
		"Name=autoOtherPolicySearchForm:orderLastName","Value=",
		"Name=autoOtherPolicySearchForm:orderDobInputDate","Value=",
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate","Value={C_InsuredInputCurrentDate_03}",
		"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_02}:customerSelected","Value=true",
		"Name=autoOtherPolicySearchForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_03}",
		"Name=javax.faces.behavior.event","Value=click",
		"Name=org.richfaces.ajax.component","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_02}:customerSelected",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_02}:customerSelected",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_02}:customerSelected",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=autoOtherPolicySearchForm","Value=autoOtherPolicySearchForm",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_029_MPD_MemSrch_PoltoAddCheckBox",NS_AUTO_STATUS);
	//ns_page_think_time(think_time);
	
	/* add selected */

	
	
	
	ns_start_transaction("A01_AZ_030_MPD_MemSrch_AddSelected");
	
	//addDynaTraceHeader("NA=A01_AZ_030_MPD_MemSrch_AddSelected;PC=flow_25");
	ns_web_url("Mem_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=t29.inf", 
		ITEMDATA, 
		"Name=autoOtherPolicySearchForm:searchById", "Value=customer",  
		"Name=autoOtherPolicySearchForm:orderFirstName", "Value=",  
		"Name=autoOtherPolicySearchForm:orderLastName", "Value=",  
		"Name=autoOtherPolicySearchForm:orderDobInputDate", "Value=",  
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate", "Value={C_InsuredInputCurrentDate_03}",  
		"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_02}:customerSelected", "Value=true",  
		"Name=autoOtherPolicySearchForm:btnAddSelected", "Value=Add Selected",  
		"Name=autoOtherPolicySearchForm_SUBMIT", "Value=1",  
		"Name=javax.faces.ViewState", "Value={C_VSPrefillPage_03}",  
		ITEMDATA_END
		);
	
		//lr_end_transaction("A01_AZ_030_MPD_MemSrch_AddSelected",LR_AUTO);
		
		if(atoi(ns_eval_string("{SuccessText}"))>0){
		
			ns_end_transaction("A01_AZ_030_MPD_MemSrch_AddSelected", NS_SUCCESS_STATUS);
			
			printf( " User: [%s] has Successfully Searched and retrieved ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_MemPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_MemFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_MemLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By MembershipNumber: [%s]",ns_eval_string("{P_MemMemNum}"));
	}else{
			ns_end_transaction("A01_AZ_030_MPD_MemSrch_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_MemPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_MemFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_MemLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By MembershipNumber: [%s]",ns_eval_string("{P_MemMemNum}"));

							ns_exit_session();
	}
}
