Advertisement
Guest User

Untitled

a guest
Feb 21st, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. def viewdetails():
  2. os.system('cls')
  3. print "|__________________________________________|"
  4. print "|----------------View Details--------------|"
  5. print "|------------------------------------------|"
  6. print "|1 - Search with Customer ID |"
  7. print "|2 - Search with Telephone number |"
  8. print "|------------------------------------------|"
  9. choice = raw_input("|Choice: ")
  10. if choice == "1":
  11. while True:
  12. IDSearch = raw_input("|What is their ID? : ")
  13. conn = sqlite3.connect('SADS.db')
  14. cur = conn.cursor()
  15. cur.execute("SELECT * FROM customers WHERE CustID = (?)",(IDSearch,))
  16. row = cur.fetchone()
  17. if row[0] != IDSearch:
  18. print "|------------------------------------------|"
  19. print "| Invalid ID, Try again! |"
  20. print "|------------------------------------------|"
  21. else:
  22. break
  23. CustID = row[0]
  24. print "|------------------------------------------|"
  25. print "|Customer ID : " , row[0]
  26. print "|Forename : " , row[1]
  27. print "|Surname : " , row[2]
  28. print "|Address Line 1 : " , row[3]
  29. print "|Address Line 2 : " , row[4]
  30. print "|City : " , row[5]
  31. print "|Postcode : " , row[6]
  32. print "|Telephone number : " , row[7]
  33. print "|E-Mail : " , row[8]
  34. while True:
  35. print '|Do you want to see what seats', row[1], 'has booked?|'
  36. choice = raw_input("|Y/N: ")
  37. if choice == 'Y':
  38. cur.execute("SELECT * FROM seats WHERE CustID = (?)", (CustID,))
  39. rowseat = cur.fetchone()
  40. if rowseat:
  41. print "|Seats booked:" , rowseat[0]
  42. print "|------------------------------------------|"
  43. break
  44. else:
  45. print "|" , row[1] , "Hasnt booked any seats."
  46. break
  47. print(" ")
  48. print "|------------------------------------------|"
  49. print("|Please select an option: |")
  50. print("|1 - Return to menu |")
  51. print("|2 - Book seats |")
  52. print("|3 - Edit details |")
  53. choice = raw_input("|Please put choice here : ")
  54. print "|------------------------------------------|"
  55. elif choice == "2":
  56. while True:
  57. IDSearch = raw_input("|What is their ID? : ")
  58. conn = sqlite3.connect('SADS.db')
  59. cur = conn.cursor()
  60. cur.execute("SELECT * FROM customers WHERE CustID = (?)",(IDSearch,))
  61. row = cur.fetchone()
  62. if row[0] != IDSearch:
  63. print "|------------------------------------------|"
  64. print "| Invalid ID, Try again! |"
  65. print "|------------------------------------------|"
  66. else:
  67. break
  68. CustID = row[0]
  69. print "|------------------------------------------|"
  70. print "|Customer ID : " , row[0]
  71. print "|Forename : " , row[1]
  72. print "|Surname : " , row[2]
  73. print "|Address Line 1 : " , row[3]
  74. print "|Address Line 2 : " , row[4]
  75. print "|City : " , row[5]
  76. print "|Postcode : " , row[6]
  77. print "|Telephone number : " , row[7]
  78. print "|E-Mail : " , row[8]
  79. while True:
  80. print '|Do you want to see what seats', row[1], 'has booked?|'
  81. choice = raw_input("|Y/N: ")
  82. if choice == 'Y':
  83. cur.execute("SELECT * FROM seats WHERE CustID = (?)", (CustID,))
  84. rowseat = cur.fetchone()
  85. if rowseat:
  86. print "|Seats booked:" , rowseat[0]
  87. print "|------------------------------------------|"
  88. break
  89. else:
  90. print "|" , row[1] , "Hasnt booked any seats."
  91. break
  92. print(" ")
  93. print "|------------------------------------------|"
  94. print("|Please select an option: |")
  95. print("|1 - Return to menu |")
  96. print("|2 - Book seats |")
  97. print("|3 - Edit details |")
  98. choice = raw_input("|Please put choice here : ")
  99. print "|------------------------------------------|"
  100. print(" ")
  101. print "|------------------------------------------|"
  102. print("|Please select an option: |")
  103. print("|1 - Return to menu |")
  104. print("|2 - Book seats |")
  105. print("|3 - Edit details |")
  106. choice = raw_input("|Please put choice here : ")
  107. print "|------------------------------------------|"
  108. if choice == "1":
  109. mainprogram()
  110. elif choice == "2":
  111. availablity()
  112. elif choice == "3":
  113. editdetails()
  114. os.system('cls')
  115.  
  116. viewdetails()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement