def addcus(): cus1 = paramoops.customer() cus1.age = varAge.get().strip() cus1.name = varName.get().strip() cus1.mobile = varmbn.get().strip() cus1.data = varemid.get().strip() try: if (cus1.checkage() and cus1.checkname() and cus1.checkmobile()) is True: if cus1.checkemail() is True: cus1.autoid() cus1.addcustomer() cus1.savetopickle() messagebox.showinfo("CMSPL", "CUSTOMER ADDED SUCCESSFULLY") varId.set(cus1.id) varAge.set(" ") varName.set(" ") varmbn.set(" ") varemid.set(" ") else: messagebox.showinfo( "Error!", "Enter correct format like\t" "*****@*****.**") #else: # messagebox.showinfo("CMSPL", "PLEASE FILL ALL THE PARTICULARS OR ADD CORRECT DETAILS") except ValueError: messagebox.showinfo("CMSPL", "PLEASE FILL ALL THE PARTICULARS ")
def deletecus(): try: cus1 = paramoops.customer() cus1.id = varId.get() cus1.deletecustomer() varmbn.set(cus1.mobile) varName.set(cus1.name1) except ValueError: messagebox.showinfo("CMSPL", "Enter your ID")
def modifycus(): cus1 = paramoops.customer() try: cus1.mobile = int(varmbn.get().strip()) if cus1.checkmobile1() is True: if len(str(cus1.mobile)) != 0: set = OptionMenu(root, param1, *Options1) set.config(font=("Arial", 15), bg="white") set.grid(row=12, column=0) if param1.get() == Options1[0]: title = "choice" text = "Want to modify Age?" reply = messagebox.askquestion(title, text) if reply == "yes": cus1.age = varAge.get() while len((str(cus1.age))) == 0: messagebox.showinfo("CMSPL", "ENTER YOUR Updated Age") break if len(str(cus1.age)) != 0: cus1.modifycustomer() varAge.set(cus1.age) varName.set(cus1.name) varId.set(cus1.id) varemid.set(cus1.data) varmbn.set(cus1.mobile) if cus1.age != 0 and len(cus1.name) != 0 and len( cus1.id) != 0 and len(cus1.data) != 0: messagebox.showinfo( "CMSPL", "CUSTOMER'S Data Updated Successfully") else: messagebox.showinfo( "CMSPL", "Customer particulars cannot be Updated") else: messagebox.showinfo("CMSPL", "Select Your choice") elif param1.get() == Options1[1]: title = "choice" text = "Want to modify Name?" reply = messagebox.askquestion(title, text) if reply == "yes": cus1.name = varName.get().strip() while len(cus1.name) == 0: messagebox.showinfo("CMSPL", "Enter your updated Name") break if len(cus1.name) != 0: cus1.modifycustomer1() varName.set(cus1.name) varmbn.set(cus1.mobile) varAge.set(cus1.age) varId.set(cus1.id) varemid.set(cus1.data) if cus1.age != 0 and len(cus1.name) != 0 and len( cus1.id) != 0 and len(cus1.data) != 0: messagebox.showinfo( "CMSPL", "CUSTOMER'S Data Updated Successfully") else: messagebox.showinfo( "CMSPL", "Customer particulars cannot be Updated") elif param1.get() == Options1[2]: title = "choice" text = "Want to modify Mbno" reply = messagebox.askquestion(title, text) if reply == "yes": cus1.mobile1 = varmbn.get().strip() if cus1.checkmobile2() is True: cus1.modifycustomer2() varName.set(cus1.name) varmbn.set(cus1.mobile1) varAge.set(cus1.age) varId.set(cus1.id) varemid.set(cus1.data) if cus1.age != 0 and len(cus1.name) != 0 and len( cus1.id) != 0 and len(cus1.data) != 0: messagebox.showinfo( "CMSPL", "CUSTOMER'S Data Updated Successfully") else: messagebox.showinfo( "CMSPL", "Customer particulars cannot be Updated") else: param1.get() == Options1[3] title = "choice" text = "Want to modify Email?" reply = messagebox.askquestion(title, text) if reply == "yes": cus1.data = varemid.get().strip() while len(cus1.data) == 0: messagebox.showinfo("CMSPL", "Enter your updated Email") break if len(cus1.data) != 0: cus1.modifycustomer3() varName.set(cus1.name) varmbn.set(cus1.mobile) varAge.set(cus1.age) varId.set(cus1.id) varemid.set(cus1.data) if cus1.age != 0 and len(cus1.name) != 0 and len( cus1.id) != 0 and len(cus1.data) != 0: messagebox.showinfo( "CMSPL", "CUSTOMER'S Data Updated Successfully") else: messagebox.showinfo( "CMSPL", "Customer particulars cannot be Updated") except ValueError: messagebox.showinfo("CMSPL", "Enter Mbno")
def showcus(): cus1 = paramoops.customer() root1 = Tk() root1.config(bg="skyblue") label6 = Label( root1, text="CUSTOMER ID :", font=("", 14, "bold"), fg="black", ) label6.grid(row=0, column=0, sticky=W, pady=14) label7 = Label(root1, text="CUSTOMER Age", font=("times", 14, "bold"), fg="black") label7.grid(row=0, column=1, padx=17) label8 = Label(root1, text="CUSTOMER NAME", font=("times", 14, "bold"), fg="black") label8.grid(row=0, column=2, padx=17) label9 = Label(root1, text="CUSTOMER mno", font=("times", 14, "bold"), fg="black") label9.grid(row=0, column=3, padx=17) label10 = Label(root1, text="CUSTOMER Email id", font=("times", 14, "bold"), fg="black") label10.grid(row=0, column=4, padx=17) for i in range(len(paramoops.customer.listcus)): cus1 = paramoops.customer.listcus[i] label12 = Label(root1, text=cus1.id, font=("times", 14, "bold"), fg="black") label12.grid(row=i + 1, column=0, padx=17) label13 = Label(root1, text=cus1.age, font=("times", 14, "bold"), fg="pink") label13.grid(row=i + 1, column=1, padx=10) label14 = Label(root1, text=cus1.name, font=("times", 14, "bold"), fg="black") label14.grid(row=i + 1, column=2, padx=17) label15 = Label(root1, text=cus1.mobile, font=("times", 14, "bold"), fg="black") label15.grid(row=i + 1, column=3, padx=17) label15 = Label(root1, text=cus1.data, font=("times", 14, "bold"), fg="black") label15.grid(row=i + 1, column=4, padx=17) root1.geometry("650x600") root1.mainloop()
varemid.set(" ") else: messagebox.showinfo( "Error!", "Enter correct format like\t" "*****@*****.**") #else: # messagebox.showinfo("CMSPL", "PLEASE FILL ALL THE PARTICULARS OR ADD CORRECT DETAILS") except ValueError: messagebox.showinfo("CMSPL", "PLEASE FILL ALL THE PARTICULARS ") #SEARCH CUSTOMER cus1 = paramoops.customer() Options = ["search by Mbno", "search by ID", "search by email"] param = StringVar() param.set(Options[0]) def searchcus(): set = OptionMenu(root, param, *Options) set.config(font=("Arial", 15), bg="white") set.grid(row=12, column=1) if param.get() == Options[0]: title = "choice" text = "Do you want to search it by Mbno?" reply = messagebox.askquestion(title, text)