Ejemplo n.º 1
0
 def setUp(self):
     """Prepare for Test."""
     environment = os.environ.get('CI_ENV', "local")
     if environment == "local":
         self.database = DBConnect('test/test_credentials.json')
     elif environment == "Gitlab":
         self.database = DBConnect('test/gitlab_credentials.json')
     elif environment == "Travis":
         self.database = DBConnect('test/travis_credentials.json')
Ejemplo n.º 2
0
    def __init__(self):
        self._dbConnect = DBConnect()
        self._root = Tk()

        tv = ttk.Treeview(self._root)
        tv.pack()
        tv.heading("#0", text="ID")
        tv.configure(column=('Name', 'Gender', 'Comment'))
        tv.heading("Name", text='Full Name')
        tv.heading("Gender", text='Gender')
        tv.heading("Comment", text='Comment')

        cursor = self._dbConnect.listInfo()
        for row in cursor:
            tv.insert('', 'end', '#{}'.format(row["ID"]), text=row["ID"])
            tv.set('#{}'.format(row["ID"]), 'Name', row["FullName"])
            tv.set('#{}'.format(row["ID"]), 'Gender', row["Gender"])
            tv.set('#{}'.format(row["ID"]), 'Comment', row["Comment"])

        def deleteButton():
            delRecord = deleteRecord()

        delButton = ttk.Button(self._root, text='Delete')
        delButton.pack()
        delButton.config(command=deleteButton)

        self._root.mainloop()
Ejemplo n.º 3
0
    def continues(self):
        a = str(self.txtid.get())
        b = str(self.txtname.get())
        c = str(self.txtmeter.get())
        d = str(self.txtward.get())
        e = str(self.txthousetax.get())
        f = str(self.txthealthtax.get())
        g = str(self.txtlighttax.get())
        h = str(self.txtwatertax.get())
        i = str(self.txttotal.get())

        database = DBConnect(host='localhost',
                             user='******',
                             password='******',
                             database='etax2019')
        new_user = {
            'idnumber': a,
            'meternumber': c,
            'wardnumber': d,
            'name': b,
            'housetax': e,
            'healthtax': f,
            'lighttax': g,
            'watertax': h,
            'total': i
        }
        database.insert(new_user, 'kalamwadiinfo')
        tkinter.messagebox.showinfo('etax-2019',
                                    'Data was entered successfully')
Ejemplo n.º 4
0
def insert(type1, ammount1):
    '''
    type1 --> str
    ammount1 --> integer
    '''
    database = DBConnect(host=hostname,
                         user=MYSQLusername,
                         password=MYSQLpass,
                         database=dbname)
    new_user = {'type': type1, 'ammount': ammount1}
    database.insert(new_user, 'Maintainance')
    database.commit()
def insert(year1,month1,day1,type1,ammount1):
    '''
    year1 --> integer
    month1 --> integer
    day1 --> integer
    type1 --> str
    ammount1 --> integer
    '''
    database = DBConnect(host=hostname,user=MYSQLusername,password=MYSQLpass, database=dbname)
    new_user = {'year': year1,'month': month1,'day': day1,'type': type1,'ammount': ammount1}
    database.insert(new_user,'Expences')
    database.commit()
def insert(fname1, lname1, Role1, exp1, salary1, att_today1, att_total1):
    '''
    fname1 --> str
    lname1 --> str
    Role1 --> str
    exp1 --> int
    salary1 --> integer
    att_today1 --> integer
    att_total1 --> integer
    '''
    database = DBConnect(host=hostname,user=MYSQLusername,password=MYSQLpass, database=dbname)
    new_user = {'fname' : fname1, 'lname' : lname1, 'Role' : Role1, 'exp' : exp1,
                'salary' : salary1, 'att_today' : att_today1, 'att_total' : att_total1}
    database.insert(new_user,'workers')
    database.commit()
Ejemplo n.º 7
0
    def submit4(self):
        a=str(self.txt_idnumber.get());
        b=str(self.txt_name.get());
        c=str(self.txt_meternumber.get());
        d=str(self.txt_wardnumber.get());
        e=str(self.txt_house.get());
        f=str(self.txt_health.get());
        g=str(self.txt_light.get());
        h=str(self.txt_water.get());
        i=str(self.txt_total.get());
        j=str(self.txt_reciept.get());
        k=str(self.txt_housepaid.get());
        l=str(self.txt_healthpaid.get());
        m=str(self.txt_lightpaid.get());
        n=str(self.txt_waterpaid.get());
        o=str(self.txt_totalpaid.get());
        v=str(self.txt_village.get());



        localtime=str(time.asctime(time.localtime(time.time())))

        t=int(i)
        u=int(o)
        p=str(t-u)


        database = DBConnect(host='localhost',user='******',password='******',database='etax2019')
        new_user = {'village':v,'idnumber': a,'meternumber': c,'wardnumber': d,'name': b,'housetax': e,'healthtax': f,'lighttax': g,'watertax': h,'total': i,'reciptnumber':j,'housetaxpaid':k,'healthtaxpaid':l,'lighttaxpaid':m,'watertaxpaid':n,'totalpaid':o,'rest':p}
        database.insert(new_user,'updateddata')
        database.commit()

        content1="WARNING   !!!!!! \n\n\n     Hi there is a New request to modify eTAX 2019 database \n Here are details: \n Village Name : "+v+"\n\n"
        content2="\nReciept Number :"+j+"\nName :"+b+"\nID Number :"+a+"\nMeter Number :"+c+"\nWard Number :"+d+"\nHouse Tax :"+e+"\nHealth Tax :"+f+"\nLight Tax :"+g+"\nWater Tax :"+h+"\nTotal Ammount of tax to be paid :"+i+"\nPaid House Tax :"+k+"\nPaid Health Tax :"+l+"\nPaid Light Tax :"+m+"\nPiad Water Tax :"+n+"\nTotal Tax paid  :"+o
        totcontaint=content1+content2 


        mail= smtplib.SMTP('smtp.gmail.com',587)
        mail.ehlo()
        mail.starttls()
        mail.login('*****@*****.**','Pass@123')
        mail.sendmail('*****@*****.**','*****@*****.**',totcontaint)
        mail.close()
        messagebox.showinfo("etax-2019","Data Deleted Successfully")
        root.destroy()
Ejemplo n.º 8
0
    def __init__(self):
        self._dbConnect = DBConnect()
        self._root = Tk()

        ttk.Label(self._root, text='Enter ID to delete: ').grid(row=0, column=0, pady=10, padx=10)
        entry = ttk.Entry(self._root, width=30, font=('Arial', 14))
        entry.grid(row=0, column=1)
        delButton = ttk.Button(self._root, text='Delete')
        delButton.grid(row=0, column=2)

        def delete():
            idEntry = int(entry.get())
            self._dbConnect.deleteRecord(idEntry)
            entry.delete()
            messagebox.showinfo(title="Record deleted",
                                message="Record with ID {} was successfully deleted!".format(idEntry))


        delButton.config(command=delete)
Ejemplo n.º 9
0
 def setUp(self):
     """
     Prepare for Test
     """
     self.database = DBConnect('travis_credentials.json')
Ejemplo n.º 10
0
# from bs4 import BeautifulSoup
from DBModels import JsonData
from dbConnect import DBConnect

import pandas as pd
import json

global session

def add_json(json_file):
    with open(json_file) as f:
        json_input = json.load(f)

    for i in json_input:
        d = JsonData(id = i['thread_id'], json_data = i)
        session.add(d)
        session.commit()

if __name__ == '__main__':
    config_file = "configuration.json"
    json_file = "json_outputs.json"
    global session

    # get connection engine and session
    db_connect = DBConnect()
    db_connect.start_db(config_file)
    engine = db_connect.get_engine()
    session = db_connect.get_session()
    add_json(json_file)
Ejemplo n.º 11
0
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from dbConnect import DBConnect
from listReservation import listUsers

dbConnect = DBConnect()

root = Tk()
root.configure(background='#015692')
root.title('Reservation')

#style
style = ttk.Style()
style.theme_use('classic')
style.configure('TLabel', background='#015692', foreground='white')
style.configure('TButton', background='#015692', foreground='white')
style.configure('TRadiobutton', background='#015692', foreground='white')

ttk.Label(root, text='Full name: ').grid(row=0, column=0, pady=10, padx=10)
ttk.Label(root, text='Gender: ').grid(row=1, column=0)
ttk.Label(root, text='Comment: ').grid(row=2, column=0)

etFullName = ttk.Entry(root, width=30, font=('Arial', 14))
etFullName.grid(row=0, column=1, columnspan=3, pady=10)

spanGender = StringVar()
spanGender.set('Male')
ttk.Radiobutton(root, text='Male', variable=spanGender,
                value='Male').grid(row=1, column=1)
ttk.Radiobutton(root, text='Female', variable=spanGender,
Ejemplo n.º 12
0
    def submit5(self):
        a = str(self.txt_idnumber.get())
        b = str(self.txt_name.get())
        c = str(self.txt_meternumber.get())
        d = str(self.txt_wardnumber.get())
        e = str(self.txt_house.get())
        f = str(self.txt_health.get())
        g = str(self.txt_light.get())
        h = str(self.txt_water.get())
        i = str(self.txt_total.get())
        j = str(self.txt_reciept.get())
        k = str(self.txt_housepaid.get())
        l = str(self.txt_healthpaid.get())
        m = str(self.txt_lightpaid.get())
        n = str(self.txt_waterpaid.get())
        o = str(self.txt_totalpaid.get())
        v = str(self.txt_village.get())

        localtime = str(time.asctime(time.localtime(time.time())))

        t = int(i)
        u = int(o)
        p = str(t - u)

        mydb = mysql.connector.connect(host='localhost',
                                       user='******',
                                       passwd='Pass@123',
                                       database='etax2019')
        mycursor = mydb.cursor()
        query = ("DELETE from updateddata where idnumber = %s" % (a))
        mycursor.execute(query)
        mydb.commit()

        mydb = mysql.connector.connect(host='localhost',
                                       user='******',
                                       passwd='Pass@123',
                                       database='etax2019')
        mycursor = mydb.cursor()
        query = ("DELETE from %s where idnumber = %s" % (v, a))
        mycursor.execute(query)
        mydb.commit()

        database = DBConnect(host='localhost',
                             user='******',
                             password='******',
                             database='etax2019')
        new_user = {
            'village': v,
            'idnumber': a,
            'meternumber': c,
            'wardnumber': d,
            'name': b,
            'housetax': e,
            'healthtax': f,
            'lighttax': g,
            'watertax': h,
            'total': i,
            'reciptnumber': j,
            'housetaxpaid': k,
            'healthtaxpaid': l,
            'lighttaxpaid': m,
            'watertaxpaid': n,
            'totalpaid': o,
            'rest': p
        }
        database.insert(new_user, 'updateddataper')
        mydb.commit()

        database = DBConnect(host='localhost',
                             user='******',
                             password='******',
                             database='etax2019')
        new_user = {
            'idnumber': a,
            'meternumber': c,
            'wardnumber': d,
            'name': b,
            'housetax': e,
            'healthtax': f,
            'lighttax': g,
            'watertax': h,
            'total': i,
            'reciptnumber': j,
            'housetaxpaid': k,
            'healthtaxpaid': l,
            'lighttaxpaid': m,
            'watertaxpaid': n,
            'totalpaid': o,
            'rest': p
        }
        database.insert(new_user, v)
        mydb.commit()

        messagebox.showinfo("etax-2019", "Data Deleted Successfully")
Ejemplo n.º 13
0
def connect_db():
    """
    Connects to database
    :return: DBConnect database
    """
    return DBConnect('credentials.json')