public static CustomerInfo View(string sessionId, string customerId) { if (PrimaveraEngine.InitializeCompany() == false) { throw new DatabaseConnectionException(); } var customerInfo = PrimaveraEngine.Consulta(new SqlBuilder() .FromTable("CLIENTES") .Columns(sqlColumnsFull) .Where("Cliente", Comparison.Equals, customerId)); if (customerInfo == null || customerInfo.Vazia()) { throw new NotFoundException("cliente", false); } var responsavelId = TypeParser.String(customerInfo.Valor("Vendedor")); var distritoId = TypeParser.String(customerInfo.Valor("Distrito")); /*if (responsavelId.Equals(sessionId) == false) * { * return null; * }*/ return(new CustomerInfo() { Identificador = TypeParser.String(customerInfo.Valor("Cliente")), Nome = TypeParser.String(customerInfo.Valor("Nome")), Estado = TypeParser.String(customerInfo.Valor("Situacao")), Debito = TypeParser.Double(customerInfo.Valor("TotalDeb")), NumContribuinte = TypeParser.String(customerInfo.Valor("NumContrib")), Pendentes = TypeParser.Double(customerInfo.Valor("EncomendasPendentes")), DataCriacao = TypeParser.Date(customerInfo.Valor("DataCriacao")), DataModificacao = TypeParser.Date(customerInfo.Valor("DataUltimaActualizacao")), EnderecoWeb = TypeParser.String(customerInfo.Valor("EnderecoWeb")), Particular = TypeParser.Boolean(customerInfo.Valor("PessoaSingular")), Telefone = TypeParser.String(customerInfo.Valor("Fac_Tel")), Telefone2 = TypeParser.String(customerInfo.Valor("Fac_Fax")), Telemovel = TypeParser.String(customerInfo.Valor("Telefone2")), Responsavel = UserIntegration.Reference(responsavelId), Localizacao = new Address { Pais = TypeParser.String(customerInfo.Valor("Pais")), Morada = TypeParser.String(customerInfo.Valor("Fac_Mor")), Distrito = LocationIntegration.DistritoReference(distritoId), CodigoPostal = TypeParser.String(customerInfo.Valor("Fac_Cp")), Localidade = TypeParser.String(customerInfo.Valor("Fac_Local")) } }); }
private static LeadListing GenerateListing(StdBELista queryObject) { return(new LeadListing() { Identificador = TypeParser.String(queryObject.Valor("Entidade")), Nome = TypeParser.String(queryObject.Valor("Nome")), Email = TypeParser.String(queryObject.Valor("Email")), Activo = TypeParser.Boolean(queryObject.Valor("Activo")), TipoTerceiro = TypeParser.String(queryObject.Valor("TipoTerceiro")), DataCriacao = TypeParser.Date(queryObject.Valor("DataCriacao")), DataModificacao = TypeParser.Date(queryObject.Valor("DataUltAct")), Telefone = TypeParser.String(queryObject.Valor("Telemovel")) }); }