Exemple #1
0
    def insert_alumno(self, data):

        try:
            conn = Connection('alumno')
            conn.insert(data)

            print(f'se registro correctamente al alumno')

        except Exception as ex:
            print(ex)
Exemple #2
0
    def insert_categoria(self, data):

        try:
            conn = Connection('categoria')
            conn.insert(data)

            print(f'se registro correctamente la categoria')

        except Exception as ex:
            print(ex)
Exemple #3
0
    def insert_seccion(self):
        seccion = self.seccion.upper()
        try:
            conn = Connection('seccion')
            conn.insert({'seccion': seccion})

            print(f'se registro correctamente la seccion: {seccion}')

        except Exception as ex:
            print(ex)
    def insert_nivel(self):

        try:
            conn = Connection('nivel')
            conn.insert({'nivel': self.nivel})

            print(f'se registro correctamente el nivel: {self.nivel}')

        except Exception as ex:
            print(ex)
Exemple #5
0
    def insert_docente(self, data):
        
        try:  
            conn = Connection('docente')
            conn.insert(data)

            print(f'se registro correctamente al docente')

        except Exception as ex:
            print(ex)
Exemple #6
0
    def insert_periodo(self, data):

        try:
            conn = Connection('periodo')
            conn.insert(data)

            print(f'se registro correctamente el periodo')

        except Exception as ex:
            print(ex)
    def all_niveles(self):
        try:
            conn = Connection('nivel')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Nivel: {record[1]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #8
0
    def all_secciones(self):
        try:
            conn = Connection('seccion')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Seccion: {record[1]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #9
0
    def one_categoria(self, id):
        try:
            conn = Connection('categoria')
            records = conn.selectOne(id)

            print(f'ID: {records[0]}')
            print(f'Descripcion: {records[1]}')
            print(f'Estado: {records[2]}')
            print('=====================')
            return records
        except Exception as ex:
            print(ex)
Exemple #10
0
    def all_categorias(self):
        try:
            conn = Connection('categoria')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Descipcion: {record[1]}')
                print(f'Estado: {record[2]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #11
0
def main(stdscr):
    ''' Main function of the program '''
    output = ''
    file_path = fileopenbox('Open account data csv')
    if file_path is None:
        terminate()
        return

    account_list = AccountList()
    with open(file_path, newline='') as csvfile:
        dialect = csv.Sniffer().sniff(csvfile.read(1024),
                                      delimiters=CSV_DELIMITERS)
        csvfile.seek(0)
        reader = csv.DictReader(csvfile, dialect=dialect)
        for row in reader:
            account_list.append(Account(row['username'], row['password']))

    connection = Connection()
    while True:
        current = account_list.current()
        if current is None:
            terminate()
            return
        start_time = time.time()
        stdscr.clear()
        status = []
        macro = None
        try:
            status = get_status(connection, current)
            try:
                macro = get_macro(status)
                output = do_macro(connection, macro, current)
            except CompletedAccount:
                account_list.complete()
                output = {'description': 'Completed'}
        except RequestException as err:
            output = {'error': 'RequestException: {0}'.format(err)}
        except BadResponseException:
            output = {'error': 'BadResponseException'}
        except LootRetrieveException:
            output = {'error': 'LootRetrieveException'}

        process_time = time.time() - start_time
        stdscr.addstr('{:<30}{:.5f}s\n'.format('Process time', process_time))
        display_status(stdscr, status)
        stdscr.addstr('\n{:<30}{}\n'.format('Username', current.username))
        stdscr.addstr('{:<30}{}\n'.format('Password', current.password))
        stdscr.addstr('{:<30}{}\n'.format('Macro', macro))
        stdscr.addstr('{:<30}{}\n'.format('Ouptut', output))
        stdscr.addstr('\nctrl+shift+q to exit')
        stdscr.refresh()
        time.sleep(ACTION_INTERVAL)
Exemple #12
0
    def all_cursos(self):
        try:
            conn = Connection('curso')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Curso: {record[1]}')
                print(f'Categoria: {record[2]}')
                print(f'Estado: {record[3]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #13
0
    def one_periodo(self, id):
        try:
            conn = Connection('periodo')
            records = conn.selectOne(id)

            print(f'ID: {records[0]}')
            print(f'Mes: {records[1]}')
            print(f'Año: {records[2]}')
            print(f'Estado: {records[3]}')
            print('=====================')
            return records
        except Exception as ex:
            print(ex)
Exemple #14
0
    def all_periodos(self):
        try:
            conn = Connection('periodo')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Mes: {record[1]}')
                print(f'Año: {record[2]}')
                print(f'Estado: {record[3]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #15
0
    def one_curso(self, id):
        try:
            conn = Connection('curso')
            records = conn.selectOne(id)

            print(f'ID: {records[0]}')
            print(f'Curso: {records[1]}')
            print(f'Categoria: {records[2]}')
            print(f'Estado: {records[3]}')
            print('=====================')
            return records
        except Exception as ex:
            print(ex)
Exemple #16
0
    def categorias_habilitados(self):
        conn = Connection('categoria')
        query = f'''
            SELECT * FROM {conn.table_name} WHERE estado = 'true'
        '''
        conn.cursor.execute(query)
        records = conn.cursor.fetchall()

        for record in records:
            print(f'ID: {record[0]}')
            print(f'Descripcion: {record[1]}')
            print(f'Estado: {record[2]}')
            print('=====================')
Exemple #17
0
    def periodos_habilitados(self):
        conn = Connection('periodo')
        query = f'''
            SELECT * FROM {conn.table_name} WHERE estado = 'true'
        '''
        conn.cursor.execute(query)
        records = conn.cursor.fetchall()

        for record in records:
            print(f'ID: {record[0]}')
            print(f'Mes: {record[1]}')
            print(f'Año: {record[2]}')
            print(f'Estado: {record[3]}')
            print('=====================')
Exemple #18
0
def main(stdscr):
    ''' Main function of the program '''
    efficiency = Efficiency()
    connection = Connection()
    while True:
        start_time = time.time()
        stdscr.clear()
        efficiency.change()
        status = get_status(connection)
        process_time = time.time() - start_time
        stdscr.addstr('{:<30}{:.2f}%\n'.format('Efficiency',
                                               efficiency.get_efficiency()))
        stdscr.addstr('{:<30}{:.5f}s\n'.format('Process time', process_time))
        display_status(stdscr, status)
        stdscr.refresh()
        time.sleep(1)
Exemple #19
0
    def all_alumnos(self):
        try:
            conn = Connection('alumno')
            records = conn.select([])

            for record in records:
                print(f'ID: {record[0]}')
                print(f'Nombres: {record[1]}')
                print(f'Apellido_Paterno: {record[2]}')
                print(f'Apellido_Materno: {record[3]}')
                print(f'Fecha_Nacimiento: {record[4]}')
                print(f'DNI: {record[5]}')
                print(f'Correo: {record[6]}')
                print(f'Telefono: {record[7]}')
                print(f'Estado: {record[8]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #20
0
    def one_alumno(self, id):
        try:
            conn = Connection('alumno')
            records = conn.selectOne(id)

            print(f'ID: {records[0]}')
            print(f'Nombres: {records[1]}')
            print(f'Apellido_Paterno: {records[2]}')
            print(f'Apellido_Materno: {records[3]}')
            print(f'Fecha_Nacimiento: {records[4]}')
            print(f'DNI: {records[5]}')
            print(f'Correo: {records[6]}')
            print(f'Telefono: {records[7]}')
            print(f'Estado: {records[8]}')
            print('=====================')
            return records
        except Exception as ex:
            print(ex)
Exemple #21
0
    def alumnos_habilitados(self):
        conn = Connection('alumno')
        query = f'''
            SELECT * FROM {conn.table_name} WHERE estado = 'true'
        '''
        conn.cursor.execute(query)
        records = conn.cursor.fetchall()

        for record in records:
            print(f'ID: {record[0]}')
            print(f'Nombres: {record[1]}')
            print(f'Apellido_Paterno: {record[2]}')
            print(f'Apellido_Materno: {record[3]}')
            print(f'Fecha_Nacimiento: {record[4]}')
            print(f'DNI: {record[5]}')
            print(f'Correo: {record[6]}')
            print(f'Telefono: {record[7]}')
            print(f'Estado: {record[8]}')
            print('=====================')
Exemple #22
0
    def test_save(self):

        con, cur = Connection()
        cur.execute(
            "INSERT INTO salaries "
            "(department_code, position, position_count, tarif, salary, fio)"
            " VALUES ('33300', 'экономист', '1', '42700', '42700', 'Юрченко Станислав Дмитриевич');"
        )
        cur.execute(
            "SELECT department_code, position, position_count, tarif, salary, fio FROM salaries "
            "WHERE fio = 'Юрченко Станислав Дмитриевич'")
        res = cur.fetchall()
        self.assertEqual(res[0][0], 33300)
        self.assertEqual(res[0][1], "экономист")
        self.assertEqual(res[0][2], 1)
        self.assertEqual(res[0][3], 42700)
        self.assertEqual(res[0][4], 42700)
        self.assertEqual(res[0][5], "Юрченко Станислав Дмитриевич")
        con.close()
        os.remove("shtat.db")
Exemple #23
0
    def update_periodo(self, id_object, data):

        conn = Connection('periodo')

        list_where = []
        for field_name, field_value in id_object.items():
            if isinstance(field_value, str):
                field_value = f"'{field_value}'"
            list_where.append(f"{field_name}={field_value}")

        list_update = []
        for field_name, field_value in data.items():
            if isinstance(field_value, str):
                field_value = f"'{field_value}'"
            list_update.append(f"{field_name}={field_value}")

        query = f'''
            UPDATE {conn.table_name} SET {', '.join(list_update)}
            WHERE {' AND '.join(list_where)}
        '''
        conn.execute_query(query)
        return True
Exemple #24
0
    def all_docentes(self):
        
        try:
            conn = Connection('docente')
            records = conn.select([])
            #items = records

            """ for item in items:
                print(item) """
            
            for record in records:
                print(f'ID: {record[0]}')
                print(f'Nombres: {record[1]}')
                print(f'Apellido_Paterno: {record[2]}')
                print(f'Apellido_Materno: {record[3]}')
                print(f'Fecha_Nacimiento: {record[4]}')
                print(f'DNI: {record[5]}')
                print(f'Correo: {record[6]}')
                print(f'Telefono: {record[7]}')
                print(f'Estado: {record[8]}')
                print('=====================')
        except Exception as e:
            print(e)
Exemple #25
0
 def inhabilitar_docente(self,parameter, id_object):
     conn = Connection('docente')
     conn.disable(parameter, id_object)
     return True
Exemple #26
0
 def update_docente(self, id_object, data):
     
     conn = Connection('docente')
     conn.update(id_object, data)
     return True
Exemple #27
0
 def inhabilitar_categoria(self, parameter, id_object):
     conn = Connection('categoria')
     conn.disable(parameter, id_object)
     return True
Exemple #28
0
 def one_docente(self,id):
     conn = Connection('docente')
     conn.selectOne(id)
Exemple #29
0
 def inhabilitar_curso(self, parameter, id_object):
     conn = Connection('curso')
     conn.disable(parameter, id_object)
     return True
Exemple #30
0
 def inhabilitar_periodo(self, parameter, id_object):
     conn = Connection('periodo')
     conn.disable(parameter, id_object)
     return True