示例#1
0
    def show_clientes(self):
        _c = Cliente()
        _cBO = ClienteBO()
        print 'Pesquisar por: Codigo(c); Nome(n); Status(1,2,3); Geral(a)'
        resp = str(raw_input(': '))
        if resp is 'c':
            while 1:
                try:
                    _c.codigo = int(raw_input('Codigo: '))
                    break
                except:
                    print 'Use somente numeros inteiros'

            cc = _cBO.cod_select(_c.codigo)
            print cc.codigo, cc.nome
        elif resp is 'a':
            _cBO.select()

        elif resp is 'n':
            nome = str(raw_input('nome: '))
            _cBO.name_select(nome)

        elif resp is 's':
            while 1:
                try:
                    _c.status = int(raw_input('status: '))
                    break
                except:
                    print 'Use somente numeros inteiros'
            _cBO.status_select(_c.status)
        else:
            print 'problemas'
示例#2
0
 def cod_select(self, codigo):
     c = Cliente()
     self.conexao.cursor.execute("select * from pessoa where pes_codigo='" +
                                 str(codigo) + "'")
     for row in self.conexao.cursor:
         c.codigo = row[0]
         c.nome = row[1]
         c.email = row[2]
         c.site = row[3]
         c.telefone = row[4]
         c.celular = row[5]
         c.cpf = row[6]
         c.rg = row[7]
         c.aniversario = row[8]
         c.data_cadastro = row[9]
     return c