public static Proposals View(string sessionId, string opportunityId, short proposalNumber)
        {
            if (PrimaveraEngine.InitializeCompany() == false)
            {
                throw new DatabaseConnectionException();
            }

            var proposalsTable = PrimaveraEngine.Engine.CRM.PropostasOPV.Edita(opportunityId, proposalNumber);
            var proposalInfo   = ProposalLinesIntegration.List(opportunityId, proposalNumber);

            //var linhax = opportunityInfo.get_Linhas().Edita(opportunityInfo);

            /*if (opportunityInfo.get_Vendedor() != sessionId)
             * {
             *  return null;
             * }*/

            return(GenerateProposal(proposalsTable, proposalInfo));
        }
        private static Proposals GenerateListing(StdBELista proposalInfo, string id)
        {
            var proposalsLines = ProposalLinesIntegration.List(id, proposalInfo.Valor("NumProposta"));

            return(new Proposals()
            {
                idOportunidade = TypeParser.String(proposalInfo.Valor("IdOportunidade")),
                ProposalNumber = proposalInfo.Valor("NumProposta"),
                Description = TypeParser.String(proposalInfo.Valor("Descricao")),
                PaymentMethod = TypeParser.String(proposalInfo.Valor("ModoPagamento")),
                PaymentCondition = TypeParser.String(proposalInfo.Valor("CondPagamento")),
                Cost = TypeParser.Double(proposalInfo.Valor("Custo")),
                Value = TypeParser.Double(proposalInfo.Valor("Valor")),
                DiscountValue = TypeParser.Double(proposalInfo.Valor("ValorDesconto")),
                Rentability = TypeParser.Double(proposalInfo.Valor("Rentabilidade")),
                Margin = TypeParser.Double(proposalInfo.Valor("Margem")),
                Observations = TypeParser.String(proposalInfo.Valor("Observacoes")),
                EntityDiscount = TypeParser.Double(proposalInfo.Valor("DescontoEntidade")),
                Totalize = proposalInfo.Valor("NaoTotalizadora"),
                ProposalsLines = proposalsLines
            });
        }