public ClienteParticipanteEndereco InstanciarClienteParticipanteEndereco(ClienteParticipante cli) { ClienteParticipanteEndereco clienteParticipante = null; if (cli != null) { clienteParticipante = new ClienteParticipanteEndereco(this.OrganizationName, this.IsOffline); clienteParticipante.Id = cli.Id; clienteParticipante.ContratoId = new Lookup(cli.ContratoId.Value, "contract"); clienteParticipante.ClienteId = new Lookup(cli.ClienteId.Value, "account"); clienteParticipante.DataInicialVigencia = cli.InicioVigencia.Value; clienteParticipante.DataFinalVigencia = cli.FimVigencia.Value; clienteParticipante.CodigoEndereco = cli.Nome; clienteParticipante.ClienteParticipanteId = new Lookup(cli.ClienteParticipanteId.Value, "new_cliente_participante_contrato"); clienteParticipante.Endereco = cli.EnderecoId.Value.ToString(); clienteParticipante.Localidade.Id = cli.CodigoDaLocalidade.Value; clienteParticipante.Localidade.Nome = cli.Localidade; clienteParticipante.Cep = cli.Cep; clienteParticipante.Cidade = cli.Cidade; clienteParticipante.Rua = cli.Logradouro; clienteParticipante.Uf = cli.Uf; clienteParticipante.Bairro = cli.Bairro; } return(clienteParticipante); }
public ClienteParticipante InstanciarClienteParticipante(ClienteParticipanteEndereco cli) { ClienteParticipante clienteParticipante = null; if (cli != null) { clienteParticipante = new ClienteParticipante(this.OrganizationName, this.IsOffline); clienteParticipante.Id = cli.Id; clienteParticipante.ContratoId = cli.ContratoId.Id; clienteParticipante.ClienteId = cli.ClienteId.Id; clienteParticipante.InicioVigencia = cli.DataInicialVigencia; clienteParticipante.FimVigencia = cli.DataFinalVigencia; clienteParticipante.Nome = cli.CodigoEndereco; clienteParticipante.ClienteParticipanteId = cli.ClienteParticipanteId.Id; clienteParticipante.EnderecoId = new Guid(cli.Endereco); clienteParticipante.CodigoDaLocalidade = cli.LocalidadeId.Id; clienteParticipante.Localidade = cli.LocalidadeId.Name; clienteParticipante.Cep = cli.Cep; clienteParticipante.Cidade = cli.Cidade; clienteParticipante.Logradouro = cli.Rua; clienteParticipante.Uf = cli.Uf; clienteParticipante.Bairro = cli.Bairro; } return(clienteParticipante); }
public ClienteParticipante ObterPorEnderecoId(Guid clienteParticipanteEnderecoId) { ClienteParticipanteEndereco cli = (new Domain.Servicos.RepositoryService()).ClienteParticipanteDoEndereco.Retrieve(clienteParticipanteEnderecoId); ClienteParticipante clienteParticipante = InstanciarClienteParticipante(cli); return(clienteParticipante); }
public T ObterPor(ClienteParticipanteEndereco clienteParticipanteEndereco) { var queryHelper = GetQueryExpression <T>(true); queryHelper.TopCount = 1; queryHelper.AddLink("new_cliente_participante_endereco", "customeraddressid", "new_enderecoid"); queryHelper.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("new_cliente_participante_enderecoid", ConditionOperator.Equal, clienteParticipanteEndereco.Id)); var colecao = this.RetrieveMultiple(queryHelper); if (colecao.List.Count == 0) { return(default(T)); } return(colecao.List[0]); }
public void SalvarEnderecosParticipantes(Guid clienteParticipanteId, Contrato contrato, Domain.Model.Conta cliente, Domain.Model.Endereco endereco) { ClienteParticipanteEndereco be = new ClienteParticipanteEndereco(OrganizationName, IsOffline); be.ContratoId = new Lookup(contrato.Id, "contract"); be.ClienteId = new Lookup(cliente.Id, "account"); be.ClienteParticipanteId = new Lookup(clienteParticipanteId, "new_cliente_participante_contrato"); be.Endereco = endereco.Id.ToString(); be.CodigoEndereco = endereco.Nome; be.Nome = endereco.Nome; be.Rua = endereco.Logradouro; be.Uf = endereco.SiglaEstado; be.Cidade = endereco.NomeCidade; be.Cep = endereco.Cep; be.Bairro = endereco.Bairro; (new CRM2013.Domain.Servicos.RepositoryService()).ClienteParticipanteDoEndereco.Create(be); }
protected void Page_Load(object sender, EventArgs e) { try { if (this.OcorrenciaId == Guid.Empty) { throw new ArgumentNullException("OcorrenciaId", "Não foi informado o parametro!"); } Ocorrencia ocorrenciaIsol = new CRM2013.Domain.Servicos.RepositoryService().Ocorrencia.ObterImpressaoOcorrenciaIsol(this.OcorrenciaId); Usuario proprietario = new CRM2013.Domain.Servicos.RepositoryService().Usuario.BuscarProprietario("incident", "incidentid", ocorrenciaIsol.Id); if (ocorrenciaIsol == null) { throw new ArgumentException("Ocorrência não encontrada!"); } // String txt_numeroOs.Text = ocorrenciaIsol.Numero; txt_rec.Text = ocorrenciaIsol.OsCliente; txt_contato.Text = ocorrenciaIsol.ContatoVisita; txt_kilometragemPercorrida.Text = ocorrenciaIsol.KilometragemPercorrida; txt_defeitoAlegado.Text = ocorrenciaIsol.DefeitoAlegado; txt_atividadeExecultada.Text = ocorrenciaIsol.AtividadeExecutada; txt_numeroNfFatura.Text = ocorrenciaIsol.NumeroNotaFiscalDeCompra; //Coloca empresa executante sempre como Intelbras, chamado 138030 txt_nomeEmpresaExecutante.Text = "INTELBRAS S A IND DE TELEC ELET BRAS"; txt_nomeEmpresaExecutante.ReadOnly = true; //Coloca o texto dos TextBox em negrito txt_defeitoAlegado.Font.Bold = true; txt_equipamentosInstalados.Font.Bold = true; txt_atividadeExecultada.Font.Bold = true; txt_obs.Font.Bold = true; if (ocorrenciaIsol.Contrato != null) { var clienteParticipanteContrato = (new CRM2013.Domain.Servicos.RepositoryService()).ClienteParticipanteDoContrato.ListarPor(ocorrenciaIsol.Contrato); foreach (var cliente in clienteParticipanteContrato) { bool infClientePArticipante = false; if (ocorrenciaIsol.ClienteId.Id == cliente.Cliente.Id) { var enderecos = (new CRM2013.Domain.Servicos.RepositoryService()).ClienteParticipanteDoEndereco.ListarPor(cliente); foreach (var endereco in enderecos) { if (!string.IsNullOrEmpty(endereco.ProdutoEndereco)) { txt_equipamentosInstalados.Text += Regex.Replace(endereco.ProdutoEndereco, " {2,}", ""); } else if (!string.IsNullOrEmpty(cliente.Descricao) && !infClientePArticipante) { txt_equipamentosInstalados.Text += Regex.Replace(cliente.Descricao, " {2,}", ""); infClientePArticipante = true; } } } } } if (ocorrenciaIsol.Contrato != null) { txt_obs.Text = ocorrenciaIsol.Contrato.ObservacaoOs; } if (ocorrenciaIsol.DataDeReagendamentoVisita.HasValue) { txt_dataPrevistaParaVisita.Text = ocorrenciaIsol.DataDeReagendamentoVisita.Value.ToLocalTime().ToString(); } else { if (ocorrenciaIsol.DataPrevistaParaVisita != null) { txt_dataPrevistaParaVisita.Text = ocorrenciaIsol.DataPrevistaParaVisita.Value.ToLocalTime().ToString(); } } if (proprietario.NomeCompleto != null) { txt_criadoPor.Text = proprietario.NomeCompleto; } if (ocorrenciaIsol.TipoDeOcorrencia != null) { txt_tipoOcorrencia.Text = ((TipoDeOcorrencia)ocorrenciaIsol.TipoDeOcorrencia.Value).ToString(); } if (ocorrenciaIsol.Cliente != null) { txt_nomeCliente.Text = ocorrenciaIsol.Cliente.RazaoSocial; txt_localDeIntelacaoCliente.Text = ocorrenciaIsol.Cliente.NomeFantasia; txt_telefoneCliente.Text = ocorrenciaIsol.Cliente.Telefone; } if (!string.IsNullOrEmpty(ocorrenciaIsol.SolicitantePortal)) { txt_nomeSolicitante.Text = ocorrenciaIsol.SolicitantePortal; } else if (ocorrenciaIsol.Solicitante != null) { txt_nomeSolicitante.Text = ocorrenciaIsol.Solicitante.Nome; txt_telefoneSolicitante.Text = ocorrenciaIsol.Solicitante.TelefoneComercial; } if (ocorrenciaIsol.ProdutosDoCliente == null) { panel_produtosDoCliente.Visible = false; } else { txt_produtosDoCliente.Text = ocorrenciaIsol.ProdutosDoCliente; } if (ocorrenciaIsol.TecnicoDaVisita != null) { txt_nomeTecnicoExecutante.Text = ocorrenciaIsol.TecnicoDaVisita.Nome; txt_telefoneTecnicoExecultante.Text = ocorrenciaIsol.TecnicoDaVisita.TelefoneComercial; txt_rgTecnicoExecultante.Text = ocorrenciaIsol.TecnicoDaVisita.DocIdentidade; } if (ocorrenciaIsol.TecnicoResponsavel != null) { txt_nomeTecnicoResponsavel.Text = ocorrenciaIsol.TecnicoResponsavel.Nome; txt_telefoneTecnicoResponsavel.Text = ocorrenciaIsol.TecnicoResponsavel.TelefoneComercial; txt_rgTecnicoResponsavel.Text = ocorrenciaIsol.TecnicoResponsavel.DocIdentidade; } // Endereco if (ocorrenciaIsol.EnderecoId != null) { /* * No campo new_guid_enredeco na ocorrencia esta salvando pelo CRM, * o id do endereco e pelo portal esta salvando o new_cliente_participanteid * precisa corrigir o portal. */ var clienteParticipanteEndereco = new ClienteParticipanteEndereco() { Id = new Guid(ocorrenciaIsol.EnderecoId) }; CRM2013.Domain.Model.Endereco endereco = new CRM2013.Domain.Servicos.RepositoryService().Endereco.ObterPor(clienteParticipanteEndereco); PreencherEndereco(endereco); } #region Obter NFs CRM2013.Domain.Model.Fatura notaFiscalRemessa = null; CRM2013.Domain.Model.Fatura notaFiscalFatura = null; if (ocorrenciaIsol.Contrato != null && ocorrenciaIsol.Cliente != null) { notaFiscalRemessa = new CRM2013.Domain.Servicos.RepositoryService().Fatura.ObterRemessaPor(ocorrenciaIsol.Contrato, ocorrenciaIsol.Cliente); if (notaFiscalRemessa == null) { notaFiscalRemessa = ocorrenciaIsol.Contrato.NotaFiscalRemessa; } notaFiscalFatura = new CRM2013.Domain.Servicos.RepositoryService().Fatura.ObterFaturaPor(ocorrenciaIsol.Contrato, ocorrenciaIsol.Cliente); } #endregion if (notaFiscalRemessa != null) { txt_numeroNfRemessa.Text = notaFiscalRemessa.IDFatura; } if (notaFiscalFatura != null) { txt_numeroNfFatura.Text = notaFiscalFatura.IDFatura; var listaProdutos = new CRM2013.Domain.Servicos.RepositoryService().Fatura.ListarItensDaNotaFiscalPor(notaFiscalFatura.Id); var listaProdutosGrid = (from item in listaProdutos select new { Código = item.Produto.Codigo, Descrição = item.Produto.Nome, Quantidade = item.Quantidade }).Skip(0).Take(10); tb_produtos.DataSource = listaProdutosGrid; tb_produtos.DataBind(); } CriarQRCode(ocorrenciaIsol.Id); } catch (Exception ex) { //string mensagem = LogHelper.Process(ex, ClassificacaoLog.PaginaOcorrencia); Response.Write("<script>alert('" + ex.Message + "');window.close()</script>"); } }