def searchCustomer():
    # fullname=customerName.get()
    # AddCustomer.firstname=fullname.split( )[0]
    # AddCustomer.lastname =fullname.split( )[1]
    goRows = 15

    result = AddCustomer.searchCustomers()
    rows = []
    cols = []
    colnames = ["CID", "firstname", "lastname", "age", "contactnumber", "address"]
    for k in range(6):
        e = Tkinter.Entry(subframe1, relief=RIDGE)
        e.grid(row=goRows, column=k, sticky=NSEW)
        e.insert(END, colnames[k])
        cols.append(e)
    rows.append(cols)
    goRows = goRows + 1

    rows = []
    for i in range(len(result)):
        cols = []
        for j in range(len(result[0])):
            e = Tkinter.Entry(subframe1, relief=RIDGE)
            e.grid(row=goRows, column=j, sticky=NSEW)
            e.insert(END, result[i][j])
            cols.append(e)
        rows.append(cols)
        goRows = goRows + 1
def saveCustomer():
    if firstnameText.get()!="" and lastnameText.get()!="" and ageV.get()!="" and contactnumberText.get()!="" and addressText.get()!="":
        if hasNumbers(firstnameText.get()) or hasNumbers(lastnameText.get()):
            ErrorMsg.set("Please enter your name with letters")
        else :
            if contactnumberText.get().isdigit():
                if len(contactnumberText.get())==10:
                    ErrorMsg.set("")
                    AddCustomer.firstname = firstnameText.get()
                    AddCustomer.lastname = lastnameText.get()
                    AddCustomer.age = ageV.get()
                    AddCustomer.contactnumber = contactnumberText.get()
                    AddCustomer.address = addressText.get()

                    AddCustomer.saveToDB()
                    dbUpdate.set("Successfully added")
                else :
                    ErrorMsg.set("Telephone Number should be included with 10 digits")
            else :
                ErrorMsg.set("Telephone Number should be included with integer values")
    else:
        ErrorMsg.set("Cannot have Empty Entries!")
def getDataToInVoice(event):
    result=AddCustomer.getDataInVoice()
    CIDEntry.set(result[0][0])
    fnameEntry.set(result[0][1])
    lnameEntry.set(result[0][2])