Esempio n. 1
0
    def get(self):
        try:
            service = session.query(ServiceTable, Client, Product).join(
                Client, Product).filter(ServiceTable.id == 1).first()

            if service is None:
                return None
            else:
                c = ClientClass(service.Client.name, service.Client.cpf,
                                service.Client.segment)
                c.id = service.Client.id

                p = ProductClass(service.Product.name,
                                 service.Product.description,
                                 service.Product.image)
                p.id = service.Product.id

                s = ServiceClass(service.Service.request_date,
                                 service.Service.cancel_date)
                s.id = service.Service.id
                s.client = c
                s.product = p
                return s

        except Exception as e:
            print "Deu erro: " % e
    def get(self):
        try:
            service = session.query(
                                    ServiceModel,Client,Product)\
                                    .join(Client,Product)\
                                    .filter(ServiceModel.id==self.service.id).first()
            if service is None:
                return None

            c = ClientClass(service.Client.name,
                            service.Client.cpf,
                            service.Client.segment)
            c.id = service.Client.id

            p = ProductClass(service.Product.name,
                             service.Product.description,
                             service.Product.image)
            p.id = service.Product.id

            s = ServiceClass(service.Service.request_date,service.Service.cancel_date)
            s.id = service.Service.id
            s.client = c
            s.product = p
            return s
        except Exception as e:
            print "Algum erro aconteceu: %s"%e
 def InstallService(self):
     try:
         service = ServiceClass()
         service.id = self.id
         servicedao = ServiceDAO(service)
         service = servicedao.get()
         print "ID: %s Data de Contratacao: %s"%(service.id,service.request_date)
         print "Instalando o servico para o cliente; %s"%service.client.name
         print "Servico a ser instalado: %s"%service.product.name
         docker = DockerOps()
         res = docker.createContainer(service.id,service.product.image)
     except Exception as e:
         print "Erro: %s"%e
Esempio n. 4
0
 def installService(self):
     try:
         service = ServiceClass()
         service.id = self.id
         servicedao = ServiceDAO(service)
         service = servicedao.get()
         print "ID: %s Data de Contratacao: %s"%(service.id,service.request_date)
         print "Instalando o servico para o client: %s"%service.client.name
         print "Servico a ser instalado: %s"%service.product.name
         docker = DockerOps()
         res = docker.createContainer(service.id,service.product.image)
         print "Servico instalado com sucesso"
     except Exception as e:
         print "Ocorreu um erro: %s"%e
Esempio n. 5
0
    def get(self):
        try:
            service = (
                session.query(ServiceModel, Client, Product)
                .join(Client, Product)
                .filter(ServiceModel.id == self.service.id)
                .first()
            )
            if service is None:
                return None

            c = ClientClass(service.Client.name, service.Client.cpf, service.Client.segment)
            c.id = service.Client.id

            p = ProductClass(service.Product.name, service.Product.description, service.Product.image)
            p.id = service.Product.id

            s = ServiceClass(service.Service.request_date, service.Service.cancel_date)
            s.id = service.Service.id
            s.client = c
            s.product = p
            return s
        except Exception as e:
            print "Algum erro aconteceu: %s" % e