invokeapplication"C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe" 'path of the the application flight Reservation
Dim ag_enb
ag_enb = Dialog("text:=Login").WinEdit("attached text:= Agent Name:").CheckProperty("enabled",1) 'for checking the state of the agent name edit box
If ag_enb=true Then
Dim agname,agval
agname=inputbox("Enter the Agent Name:")
agval =aagvalid(agname)
If agval =1 Then
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set agname
else
msgbox "invalid"
End If
Dialog("text:=Login").WinEdit("attached text:=Password:").Set "mercury"
Dialog("text:=Login").WinButton("text:=OK").Click
else
msgbox " Not Enabled"
End If
Dim res_date,dvalid
res_date =inputbox("Please Enter the date in mm/dd/yy Fromat")
dvalid = datevalid(res_date)
If dvalid =1 Then
Window("text:=Flight Reservation").ActiveX("acx_name:=MaskEdBox").Type res_date
else
msgbox "invalid"
End if
Call locvalid()
Window("text:=Flight Reservation").WinButton("text:= FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select 0
Window("text:=Flight Reservation").Dialog("text:=Flights Table").WinButton("text:=OK").Click
msgbox "You have to enter name before pressing the Insert Order button. "
Dim cusname,cusval
cusname=inputbox("Please Enter the Customer name")
cusval =cusvalid(cusname)
Call enab
If i= Window("Flight Reservation").WinRadioButton("Economy").Set Then
msgbox ("The Economy class Price is:-"& window("Flight Reservation").winedit("Price:").GetVisibleText())
End If
If i= Window("Flight Reservation").WinRadioButton("Business").Set Then
msgbox ("The Business class Price is:-"& window("Flight Reservation").winedit("Price:").GetVisibleText())
End If
If i= Window("Flight Reservation").WinRadioButton("First").Set Then
msgbox ("The First class Price is:-"& window("Flight Reservation").winedit("Price:").GetVisibleText())
End If
Call prcomp
Dim tickno,tickval
tickno=inputbox("Please Enter the Ticket number:")
tickval = tickvalid(tickno)
Window("Flight Reservation").WinRadioButton("Economy").Set
Window("Flight Reservation").WinButton("Insert Order").Click
wait 5
Call update
wait 8
Dim inorder
Window("text:=Flight Reservation").WinMenu("menuobjtype:=2").Select "File;Open Order..."
Window("text:=Flight Reservation").Dialog("text:=Open Order").WinCheckBox("text:=&Order No.").Set "ON"
inordr = inputbox("Please Enter the order number:")
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit_2").set inordr
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
'Call delorder
'========================function==============================================
'===================validation function for agent name=========================
Function aagvalid(agname)
Dim aglen
aglen = len(agname)
If aglen>=4 and aglen<=10 Then
aagvalid =1
else
aagvalid=0
End If
End Function
'=========validation function for Flight reservation date=================
Function datevalid(res_date)
Dim date1,mydate,lastdate
date1 =Cdate(res_date)
mydate = Date
lastdate = Dateadd("yyyy",28,date)
If date1>=mydate and date1<=lastdate Then
datevalid =1
else
datevalid =0
End If
End Function
'=========validation function for the location=================
Function locvalid()
Dim loc,loc1,loc2
loc1=inputbox("Please Enter the Fly From Location from-0-Denver,1-Frankfurt,2-London,3-Los Angeles,4-Paris,5-Portland,6-San Francisco,7-Seattle,8-Sydney,9-Zurich")
For loc1= 0 to loc1-1
Window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").Getitem(loc1)
Next
loc2=inputbox("Please Enter the Fly From Location from-0-Denver,1-Frankfurt,2-London,3-Los Angeles,4-Paris,5-Portland,6-San Francisco,7-Seattle,8-Sydney,9-Zurich")
For loc2=0 to loc2-1
Window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").Getitem(loc2)
Next
loc = strcomp (loc1,loc2)
If loc=0 Then
msgbox "You have enter the same location"
else
Window("text:=Flight Reservation").WinComboBox("attached text:= Fly From:").Select loc1
Window("text:=Flight Reservation").WinComboBox("attached text:= Fly To:").Select loc2
End If
End Function
'=========function for enabling the insert order button=================
Function enab()
Dim i
i = Window("text:=Flight Reservation").WinEdit("attached text:=Name:").CheckProperty("enabled",1)
If i=true Then
msgbox "Not Enabled"
else
msgbox "Now you can enter in Insert Order button because you have entered the name"
End If
End Function
'=========validation function for customer name==============================
Function cusvalid(cusname)
Dim cuslen,j,k
cuslen = len(cusname)
If cuslen<=20 Then
window("Flight Reservation").winedit("Name:").Set cusname
else
Do While cuslen>20
msgbox "Sorry you can't enter more then 20 character in customer name."
j=inputbox ("Please Enter the customer name below or equal to 20 characters:")
k=len(j)
If k<=20 Then window("Flight Reservation").winedit("Name:").Set j
Exit do
loop
End If
End Function
'=========function for price calculation of Tickets=================
Function prcal(tickno)
Dim tkprc,tkprc1,total1
tkprc=window("Flight Reservation").winedit("Price:").GetVisibleText()
msgbox (" The Ticket Price:-" & tkprc)
msgbox (" The number of Tickets:-" & tickno)
tkprc1=mid (tkprc , 2)
total1=tkprc1* tickno
msgbox (" The total price of Tickets:-$" & total1)
End Function
'=========validation function for Ticket numbers=================
Function tickvalid(tickno)
Dim i
If tickno<=10 Then
window("Flight Reservation").WinEdit("Tickets:").Set tickno
call prcal(tickno)
Else
Do While tickno>10
msgbox "You have enter more then 10 tickets"
i=inputbox ("Please Enter the ticket below or equal to 10:")
If i<=10 Then
window("Flight Reservation").WinEdit("Tickets:").Set i
call prcal(i)
end if
Exit do
loop
End If
End Function
'=========validation function for price comparision of ticket price=================
Function prcomp()
i=Window("Flight Reservation").WinRadioButton("Economy").set
j=Window("Flight Reservation").WinRadioButton("Economy").set
k=Window("Flight Reservation").WinRadioButton("Economy").set
if k=3 * i and j = 2 * i then
msgbox ("First class is 3 time expensive and business class is 2 time expensive then economy class")
else
msgbox("The price of classes are not right")
end if
End Function
'=========function for updation the order=================
Function update()
msgbox ("Now you can update the information in your application")
Window("Flight Reservation").WinButton("Update Order").Click
End Function
'=========function for deletion the order=================
Function delorder()
msgbox("Do You want to delete the order from application")
Window("Flight Reservation").WinButton("Delete Order").Click
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("Yes").Click
End Function
www.nitesh10.blogspot.com
I have never read such quality post/article as yours, ever on the web. Your post/article is very detailed and insightful yet easy to understand. Please write more frequently for this/our community.
ReplyDeleteshaheen air ticket confirmation
Good work.
ReplyDeleteThis topic has always been one of my favorite subjects to read about. I have found your post to be very rousing and full of good information. If you want to reserve a flight ticket you can visit the best travel company ever, MeezabAir.