コード例 #1
0
ファイル: RepContato.cs プロジェクト: ertprs/crm_fonte
        public List <T> ListarContatosPor(Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new ConditionExpression("parentcustomerid", ConditionOperator.Equal, cliente.Id));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #2
0
        public decimal ObterMaiorValorPor(Domain.Model.Conta cliente, Product produto)
        {
            decimal maiorValor = decimal.MinValue;

            QueryExpression query = new QueryExpression("new_valor_servico_posto");

            query.ColumnSet.AddColumn("new_valor");
            query.PageInfo = new PagingInfo()
            {
                Count = 1, PageNumber = 1
            };
            query.Criteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            query.Criteria.Conditions.Add(new ConditionExpression("new_produtoid", ConditionOperator.Equal, produto.Id));
            query.Criteria.Conditions.Add(new ConditionExpression("statecode", ConditionOperator.Equal, (int)StateCode.Ativo));
            query.Orders.Add(new OrderExpression("new_valor", OrderType.Descending));

            EntityCollection colecao = base.Provider.RetrieveMultiple(query);

            if (colecao.Entities.Count > 0)
            {
                var valorServico = colecao.Entities[0];
                if (valorServico.Attributes.Contains("new_valor"))
                {
                    maiorValor = ((Money)valorServico["new_valor"]).Value;
                }
            }

            return(maiorValor);
        }
コード例 #3
0
ファイル: RepFatura.cs プロジェクト: ertprs/crm_fonte
        public T ObterRemessaPor(Contrato contrato, Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.TopCount = 1;
            query.AddLink("new_cliente_participante_endereco", "invoiceid", "new_nf_remessaid");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            var colecao = this.RetrieveMultiple(query);

            if (colecao.List.Count > 0)
            {
                return(colecao.List[0]);
            }

            var query2 = GetQueryExpression <T>(true);

            query2.TopCount = 1;
            query2.AddLink("new_cliente_participante_contrato", "invoiceid", "new_nfremessaid");
            query2.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));
            query2.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            var colecao2 = this.RetrieveMultiple(query2);

            if (colecao.List.Count == 0)
            {
                return(default(T));
            }
            return(colecao2.List[0]);
        }
コード例 #4
0
 public List<T> ListarSemExtratoPor(Domain.Model.Conta autorizada)
 {
     var query = GetQueryExpression<T>(true);
     query.Criteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, autorizada.Id));
     query.Criteria.Conditions.Add(new ConditionExpression("new_extratoid", ConditionOperator.Null));
     return (List<T>)this.RetrieveMultiple(query).List;
 }
コード例 #5
0
        public List <T> ListarPor(Domain.Model.Conta cliente, Contrato contrato, string endereco)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_contratoid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, contrato.Id));
            if (!String.IsNullOrEmpty(endereco))
            {
                query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_rua", ConditionOperator.Like, "%" + endereco + "%"));
            }
            if (cliente.Id != Guid.Empty)
            {
                query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, cliente.Id));
            }
            else
            {
                query.AddLink("account", "new_clienteid", "accountid");
                if (!String.IsNullOrEmpty(cliente.CpfCnpj))
                {
                    query.LinkEntities[0].LinkCriteria.AddCondition("itbc_cpfoucnpj", ConditionOperator.Like, "%" + cliente.CpfCnpj + "%");
                }
                if (!String.IsNullOrEmpty(cliente.NomeFantasia))
                {
                    query.LinkEntities[0].LinkCriteria.AddCondition("itbc_nomefantasia", ConditionOperator.Like, "%" + cliente.NomeFantasia + "%");
                }
                if (!String.IsNullOrEmpty(cliente.Nome))
                {
                    query.LinkEntities[0].LinkCriteria.AddCondition("name", ConditionOperator.Like, "%" + cliente.Nome + "%");
                }
            }

            var list = this.RetrieveMultiple(query);

            return((List <T>)list.List);
        }
コード例 #6
0
ファイル: RepTabelaPreco.cs プロジェクト: ertprs/crm_fonte
        public List <TabelaDePreco> ListarTabelaDePrecoPor(int codigoCliente)
        {
            List <TabelaDePreco> tabelaDePreco = new List <TabelaDePreco>();

            BuscaTabelas_ttTbPrecoRow[] row = null;
            decimal limiteDeCreditoIntelbras = 0, limiteDeCreditoDisponivelIntelbras = 0, limiteDeCreditoSupplierCard = 0, limiteDeCreditoDisponivelSupplierCard = 0;

            Domain.Servicos.HelperWS.IntelbrasService.BuscaTabelas(codigoCliente, out row, out limiteDeCreditoSupplierCard, out limiteDeCreditoDisponivelSupplierCard, out limiteDeCreditoIntelbras, out limiteDeCreditoDisponivelIntelbras);
            if (row != null)
            {
                Domain.Model.Conta cliente = (new Domain.Servicos.RepositoryService()).Conta.PesquisarPor(codigoCliente);
                cliente.LimiteDeCreditoIntelbras              = limiteDeCreditoIntelbras;
                cliente.LimiteDeCreditoDisponivelIntelbras    = limiteDeCreditoSupplierCard;
                cliente.LimiteDeCreditoSupplierCard           = limiteDeCreditoIntelbras;
                cliente.LimiteDeCreditoDisponivelSupplierCard = limiteDeCreditoSupplierCard;
                if (row.Length > 0)
                {
                    foreach (var item in row)
                    {
                        TabelaDePreco tabela = new TabelaDePreco(this.OrganizationName, this.IsOffline);
                        tabela.UnidadeDeNegocio      = (new Domain.Servicos.RepositoryService()).UnidadeNegocio.ObterPorChaveIntegracao(item.cdunidnegoc);
                        tabela.Categoria             = (new Domain.Servicos.RepositoryService()).Conta.ObterCategoriaDoClientePor(Guid.Empty, item.cdcategoria.ToString());
                        tabela.Representante         = (new Domain.Servicos.RepositoryService()).Conta.ObterRepresentantePor(Guid.Empty, item.codrep.Value.ToString());
                        tabela.CondicaoDePagamento   = (new Domain.Servicos.RepositoryService()).CondicaoPagamento.ObterPor(item.codcondpag.Value);
                        tabela.CodigoDaTabelaDePreco = item.nrtabpre;
                        tabela.Nome             = item.dsdescricao;
                        tabela.TabelaEspecifica = item.lgtbespecifica.Value;
                        //tabelaDePreco.Add(new TabelaDePreco(item.nrtabpre, item.dsdescricao, item.lgtbespecifica.Value, cliente, new UnidadeDeNegocio(item.cdunidnegoc, "", Guid.Empty), ObterCategoriaDoClientePor(Guid.Empty, item.cdcategoria.ToString()), ObterRepresentantePor(Guid.Empty, item.codrep.Value.ToString()), new CondicaoPagamento(item.codcondpag.Value, "", Guid.Empty), base.OrganizacaoCorrente));
                    }
                }
            }

            return(tabelaDePreco);
        }
コード例 #7
0
ファイル: RepContato.cs プロジェクト: ertprs/crm_fonte
        //CRM4
        public T ObterRepresentatePor(Domain.Model.Conta cliente)
        {
            var queryHelper = GetQueryExpression <T>(true);

            queryHelper.TopCount = 1;
            queryHelper.AddLink("account", "contactid", "itbc_representante");
            queryHelper.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("accountid", ConditionOperator.Equal, cliente.Id));
            var colecao = this.RetrieveMultiple(queryHelper);

            if (colecao.List.Count == 0)
            {
                return(default(T));
            }
            return(colecao.List[0]);
            //Representante rep = null;
            //var query = new QueryExpression("contact");
            //query.TopCount = 1;
            //query.AddLink("account", "contactid", "new_representanteid");
            //query.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("accountid", ConditionOperator.Equal, cliente.Id));
            //var bec = base.Provider.RetrieveMultiple(query);
            //if (bec.Entities.Count > 0)
            //{
            //    rep = new Representante(this.OrganizationName, this.IsOffline);
            //    Entity contato = bec.Entities[0];
            //    rep.CodigoRepresentante = Convert.ToInt32(contato["itbc_codigodorepresentante"]);
            //    rep.Nome = Convert.ToString(contato["name"]);
            //    rep.Id = contato.Id;
            //}
            //return rep;
        }
コード例 #8
0
        public List <T> PesquisarAutorizacaoPostagemCorreiosPor(Domain.Model.Conta cliente)
        {
            //NÃO IMPLANTADO
            var query = GetQueryExpression <T>(true);

            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #9
0
        public List <T> ListarPor(Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, cliente.Id));
            query.Orders.Add(new Microsoft.Xrm.Sdk.Query.OrderExpression("new_data_justficativa", Microsoft.Xrm.Sdk.Query.OrderType.Ascending));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #10
0
ファイル: RepUnidadeNegocio.cs プロジェクト: ertprs/crm_fonte
        public List <T> ListarUnidadesDeNegocioB2BPor(Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.AddLink("itbc_relacionamentodob2b", "businessunitid", "itbc_codigounidadecomercial");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("itbc_codigocliente", ConditionOperator.Equal, cliente.Id));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #11
0
        public List <T> ListarLogisticaReversaDo(Domain.Model.Conta postoDeServico)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new ConditionExpression("new_posto_autorizadoid", ConditionOperator.Equal, postoDeServico.Id));
            query.Orders.Add(new OrderExpression("createdon", OrderType.Descending));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #12
0
        public List <T> ListarPor(Domain.Model.Conta cliente, Contrato contrato)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_contratoid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, contrato.Id));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, cliente.Id));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #13
0
        public List <T> ObterPor(Domain.Model.Conta cliente, Guid funcao)
        {
            var query = GetQueryExpression <T>(true);

            #region Filtro1
            //Pesquiso por Participante1 e Função 2
            FilterExpression filter1 = new FilterExpression();

            ConditionExpression condition1 = new ConditionExpression();
            condition1.AttributeName = "customerid";
            condition1.Operator      = ConditionOperator.Equal;
            condition1.Values.Add(cliente.Id);

            filter1.FilterOperator = LogicalOperator.And;

            ConditionExpression condition2 = new ConditionExpression();
            condition2.AttributeName = "partnerroleid";
            condition2.Operator      = ConditionOperator.Equal;
            condition2.Values.Add(funcao);

            filter1.Conditions.Add(condition1);
            filter1.Conditions.Add(condition2);

            #endregion

            #region Filtro2
            //Pesquiso por Participante2 e Função 1
            FilterExpression filter2 = new FilterExpression();

            ConditionExpression condition3 = new ConditionExpression();
            condition3.AttributeName = "partnerid";
            condition3.Operator      = ConditionOperator.Equal;
            condition3.Values.Add(cliente.Id);

            filter2.Conditions.Add(condition1);


            filter2.FilterOperator = LogicalOperator.And;

            ConditionExpression condition4 = new ConditionExpression();
            condition4.AttributeName = "customerroleid";
            condition4.Operator      = ConditionOperator.Equal;
            condition4.Values.Add(funcao);

            filter2.Conditions.Add(condition3);
            filter2.Conditions.Add(condition4);

            #endregion

            //Filtro1 OR Filtro2
            query.Criteria = new FilterExpression();
            query.Criteria.FilterOperator = LogicalOperator.Or;
            query.Criteria.Filters.Add(filter1);
            query.Criteria.Filters.Add(filter2);

            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #14
0
        public List <T> ListarPor(Domain.Model.Conta postoDeServico)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_posto_servicoid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, postoDeServico.Id));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("statuscode", Microsoft.Xrm.Sdk.Query.ConditionOperator.GreaterThan, 1));
            query.Orders.Add(new Microsoft.Xrm.Sdk.Query.OrderExpression("createdon", Microsoft.Xrm.Sdk.Query.OrderType.Descending));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #15
0
        public List <T> PesquisarHistoricoDePostagemPor(Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.AddLink("incident", "new_ocorrenciais", "incidentid");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("customerid", ConditionOperator.Equal, cliente.Id));
            query.Orders.Add(new OrderExpression("new_data_hora", OrderType.Descending));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #16
0
        public List <T> ListarPorNumeroSerie(string numeroSerie, Domain.Model.Conta assistenciaTecnica, string[] status, string[] origem)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_autorizadaid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, assistenciaTecnica.Id));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("productserialnumber", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, numeroSerie));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("caseorigincode", Microsoft.Xrm.Sdk.Query.ConditionOperator.In, origem));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("statuscode", Microsoft.Xrm.Sdk.Query.ConditionOperator.In, status));
            query.Orders.Add(new OrderExpression("new_data_origem", OrderType.Descending));
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #17
0
        public List <T> ListarPor(Extrato extrato, Domain.Model.Conta assistenciaTecnica = null)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.Conditions.Add(new ConditionExpression("new_extrato_pagamentoid", ConditionOperator.Equal, extrato.Id));
            if (assistenciaTecnica != null)
            {
                query.Criteria.Conditions.Add(new ConditionExpression("new_autorizadaid", ConditionOperator.Equal, assistenciaTecnica.Id));
            }
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #18
0
        public List <T> ListarOcorrenciaAbertaComIntervencaoTecnica(Domain.Model.Conta assistenciaTecnica)
        {
            var query = GetQueryExpression <T>(true);

            query.Orders.Add(new OrderExpression("new_data_origem", OrderType.Descending));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_autorizadaid", Microsoft.Xrm.Sdk.Query.ConditionOperator.Equal, assistenciaTecnica.Id));
            query.Criteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("statuscode", Microsoft.Xrm.Sdk.Query.ConditionOperator.In, 200035, 200036, 200037, 200038, 200039, 200045));
            query.AddLink("new_intervencao_tecnica", "incidentid", "new_ocorrenciaid");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("statuscode", ConditionOperator.Equal, 1));
            query.Distinct = true;
            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #19
0
ファイル: ManagerPreEvent.cs プロジェクト: ertprs/crm_fonte
        private void PreencheNome(ref Entity target, ref Domain.Model.Conta revenda, ref Domain.Model.Conta distribuidor)
        {
            if (target.Attributes.Contains("itbc_name"))
            {
                target.Attributes.Remove("itbc_name");
            }


            string nome = (revenda.NomeFantasia + " - " + distribuidor.NomeFantasia);

            nome = (nome.Length >= 100 ? nome.Substring(0, 99) : nome);
            target.Attributes.Add("itbc_name", nome);
        }
コード例 #20
0
        public List <T> ListarPor(Contrato contrato, Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            if (cliente != null)
            {
                query.Criteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            }
            query.Criteria.Conditions.Add(new ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));
            query.Criteria.Conditions.Add(new ConditionExpression("statecode", ConditionOperator.Equal, 0)); //busca os clientes ativos

            return((List <T>) this.RetrieveMultiple(query).List);
        }
コード例 #21
0
ファイル: RepTransportadora.cs プロジェクト: ertprs/crm_fonte
        public T ObterPor(Domain.Model.Conta cliente)
        {
            var query = GetQueryExpression <T>(true);

            query.TopCount = 1;
            query.AddLink("account", "new_transportadoraid", "new_transp_assistencia_tecnica");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("accountid", ConditionOperator.Equal, cliente.Id));
            var colecao = this.RetrieveMultiple(query);

            if (colecao.List.Count == 0)
            {
                return(default(T));
            }
            return(colecao.List[0]);
        }
コード例 #22
0
        public List <T> ListarPorClientesParticipantes(Domain.Model.Conta cliente, List <StatusDoContrato> status)
        {
            var queryHelper = GetQueryExpression <T>(true);

            queryHelper.Distinct = true;
            string[] arrayStatus = new string[status.Count];
            for (int i = 0; i < status.Count; i++)
            {
                arrayStatus[i] = Convert.ToString((int)status[i]);
            }
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("statuscode", ConditionOperator.In, arrayStatus));
            queryHelper.AddLink("new_cliente_participante_contrato", "contractid", "new_contratoid");
            queryHelper.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            return((List <T>) this.RetrieveMultiple(queryHelper).List);
        }
コード例 #23
0
        public T ObterPor(Domain.Model.Conta conta, Domain.Model.UnidadeNegocio unidade)
        {
            var query = GetQueryExpression <T>(true);

            query.Criteria.AddCondition("itbc_canalid", ConditionOperator.Equal, conta.ID.Value);
            query.Criteria.AddCondition("itbc_businessunit", ConditionOperator.Equal, unidade.ID.Value);
            query.Criteria.AddCondition("statecode", ConditionOperator.Equal, (int)Domain.Enum.CategoriaCanal.StateCode.Ativado);

            var colecao = this.RetrieveMultiple(query);

            if (colecao.List.Count == 0)
            {
                return(default(T));
            }

            return(colecao.List[0]);
        }
コード例 #24
0
        public ClienteParticipante PesquisarParticipantePor(Contrato contrato, Domain.Model.Conta cliente)
        {
            ClienteParticipante clienteParticipante = null;
            var queryHelper = new QueryExpression("new_cliente_participante_contrato");

            queryHelper.ColumnSet.AllColumns = true;
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            var be = base.Provider.RetrieveMultiple(queryHelper);

            if (be.Entities.Count > 0)
            {
                clienteParticipante = (new CRM2013.Domain.Servicos.RepositoryService()).ClienteParticipante.InstanciarClienteParticipante((new CRM2013.Domain.Servicos.RepositoryService()).ClienteParticipanteDoContrato.Retrieve(be.Entities[0].Id));
            }

            return(clienteParticipante);
        }
コード例 #25
0
        private string CriarOcorrencia(XmlDocument doc, Domain.Model.Conta assistenciaTecnica, string LoginDoPostoAutorizado, ref string logAdicional)
        {
            string     mensagem   = "";
            Ocorrencia ocorrencia = this.ConverterOcorrencia(doc, assistenciaTecnica, LoginDoPostoAutorizado, out mensagem);

            if (!String.IsNullOrEmpty(mensagem))
            {
                return(mensagem);
            }

            string pathXML        = doc.GetElementsByTagName("URLImagemNota")[0].InnerText;
            string pathNotaFiscal = string.Empty;

            if (!string.IsNullOrEmpty(pathXML))
            {
                pathNotaFiscal = Download(pathXML);
            }

            //Depois que o anexo foi salvo cria a ocorrencia
            if (string.IsNullOrEmpty(mensagem))
            {
                logAdicional += " - Inicio Salvar OS: " + DateTime.Now.ToString();
                Guid ocorrenciaId = Guid.Empty;
                ocorrenciaId  = ocorrencia.SalvarOS(ocorrencia);
                logAdicional += " - Fim Salvar OS: " + DateTime.Now.ToString();

                if (ocorrenciaId == Guid.Empty)
                {
                    return("Não foi possível adicionar Ocorrência! Por gentileza, verifique com a Intelbras.");
                }

                logAdicional += " - Inicio Retrieve OS: " + DateTime.Now.ToString();
                ocorrencia    = (new Domain.Servicos.RepositoryService()).Ocorrencia.Retrieve(ocorrenciaId);
                mensagem     += ocorrencia.Numero;
                logAdicional += " - Fim Retrieve OS: " + DateTime.Now.ToString();
                logAdicional += " - Inicio Anexo CRM: " + DateTime.Now.ToString();

                if (!string.IsNullOrEmpty(pathNotaFiscal))
                {
                    mensagem += CriarAnotacaoParaUmaOS(ocorrencia, pathNotaFiscal);
                }
                logAdicional += " - Fim Anexo CRM: " + DateTime.Now.ToString();
            }

            return(mensagem);
        }
コード例 #26
0
ファイル: RepEndereco.cs プロジェクト: ertprs/crm_fonte
        public T ObterPor(string codigo, Domain.Model.Conta cliente = null)
        {
            var queryHelper = GetQueryExpression <T>(true);

            queryHelper.TopCount = 1;
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("name", ConditionOperator.Equal, codigo));
            if (cliente != null && cliente.Id != Guid.Empty)
            {
                queryHelper.Criteria.Conditions.Add(new ConditionExpression("parentid", ConditionOperator.Equal, cliente.Id));
            }
            var colecao = this.RetrieveMultiple(queryHelper);

            if (colecao.List.Count == 0)
            {
                return(default(T));
            }
            return(colecao.List[0]);
        }
コード例 #27
0
        public Guid ObterEnderecoIDPrimeiroClienteParticipante(Contrato contrato, Domain.Model.Conta cliente)
        {
            Guid enderecoID  = Guid.Empty;
            var  queryHelper = new QueryExpression("new_cliente_participante_endereco");

            queryHelper.ColumnSet.AllColumns = true;
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
            queryHelper.Criteria.Conditions.Add(new ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));

            var be = base.Provider.RetrieveMultiple(queryHelper);

            if (be.Entities.Count > 0)
            {
                enderecoID = ((EntityReference)be.Entities[0]["new_enderecoid"]).Id;
            }

            return(enderecoID);
        }
コード例 #28
0
        public decimal ObterMaiorValorPor(Domain.Model.Conta cliente)
        {
            decimal maiorValor = decimal.MinValue;

            string perfilAsssistencia = "";

            switch (cliente.PerfilAssistenciaTecnica)
            {
            case 993520000:
                perfilAsssistencia = "Assistência Técnica";
                break;

            case 993520001:
                perfilAsssistencia = "LAI";
                break;

            case 993520002:
                perfilAsssistencia = "Assistência Premium";
                break;
            }

            QueryExpression query = new QueryExpression("new_tipo_posto");

            query.Criteria.AddCondition(new ConditionExpression("new_name", ConditionOperator.Equal, perfilAsssistencia));
            query.ColumnSet.AddColumns("new_tipo_postoid", "new_percentual_servico");
            query.AddLink("new_new_tipo_posto_account", "new_tipo_postoid", "new_tipo_postoid");
            query.LinkEntities[0].LinkCriteria.Conditions.Add(new ConditionExpression("accountid", ConditionOperator.Equal, cliente.Id));
            query.Orders.Add(new OrderExpression("new_percentual_servico", OrderType.Descending));

            EntityCollection colecao = base.Provider.RetrieveMultiple(query);

            if (colecao.Entities.Count > 0)
            {
                var tipoPosto = colecao.Entities[0];
                if (tipoPosto.Attributes.Contains("new_percentual_servico"))
                {
                    maiorValor = Convert.ToDecimal(tipoPosto["new_percentual_servico"]);
                }
            }

            return(maiorValor);
        }
コード例 #29
0
ファイル: RepFatura.cs プロジェクト: ertprs/crm_fonte
        public Fatura PesquisarNotaFiscalFaturaDaOcorrenciaPor(Contrato contrato, Domain.Model.Conta cliente)
        {
            Fatura notaFiscal = null;

            if (contrato != null && cliente != null)
            {
                var query = GetQueryExpression <T>(true);
                query.TopCount             = 1;
                query.ColumnSet.AllColumns = true;
                query.AddLink("new_cliente_participante_contrato", "invoiceid", "new_notafiscalid");
                query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_contratoid", ConditionOperator.Equal, contrato.Id));
                query.LinkEntities[0].LinkCriteria.Conditions.Add(new Microsoft.Xrm.Sdk.Query.ConditionExpression("new_clienteid", ConditionOperator.Equal, cliente.Id));
                DataCollection <Entity> result = base.Provider.RetrieveMultiple(query).Entities;

                foreach (var itemNota in result)
                {
                    notaFiscal          = (new Intelbras.CRM2013.Domain.Servicos.RepositoryService()).Fatura.Retrieve(itemNota.Id);
                    notaFiscal.Produtos = (new Intelbras.CRM2013.Domain.Servicos.RepositoryService()).ProdutoFatura.ListarProdutosDaFaturaPor(notaFiscal.Id);
                }
            }
            return(notaFiscal);
        }
コード例 #30
0
ファイル: RepTabelaPreco.cs プロジェクト: ertprs/crm_fonte
        public List <TabelaDePreco> ListarPor(Domain.Model.Conta cliente)
        {
            List <TabelaDePreco> tabelaDePreco = new List <TabelaDePreco>();

            BuscaTabelas_ttTbPrecoRow[] row               = null;
            decimal limiteDeCreditoIntelbras              = 0,
                    limiteDeCreditoDisponivelIntelbras    = 0,
                    limiteDeCreditoSupplierCard           = 0,
                    limiteDeCreditoDisponivelSupplierCard = 0;

            Domain.Servicos.HelperWS.IntelbrasService.BuscaTabelas(int.Parse(cliente.CodigoMatriz), out row, out limiteDeCreditoSupplierCard, out limiteDeCreditoDisponivelSupplierCard, out limiteDeCreditoIntelbras, out limiteDeCreditoDisponivelIntelbras);

            if (row != null)
            {
                cliente.LimiteDeCreditoIntelbras              = limiteDeCreditoIntelbras;
                cliente.LimiteDeCreditoDisponivelIntelbras    = limiteDeCreditoDisponivelIntelbras;
                cliente.LimiteDeCreditoSupplierCard           = limiteDeCreditoSupplierCard;
                cliente.LimiteDeCreditoDisponivelSupplierCard = limiteDeCreditoDisponivelSupplierCard;

                foreach (var item in row)
                {
                    TabelaDePreco _tabelaPreco = new TabelaDePreco(OrganizationName, IsOffline);
                    _tabelaPreco.CodigoDaTabelaDePreco = item.nrtabpre;
                    _tabelaPreco.Nome                       = item.dsdescricao;
                    _tabelaPreco.TabelaEspecifica           = item.lgtbespecifica.Value;
                    _tabelaPreco.Cliente                    = cliente;
                    _tabelaPreco.UnidadeDeNegocio           = new UnidadeNegocio(OrganizationName, IsOffline);
                    _tabelaPreco.UnidadeDeNegocio.CodigoEms = item.cdunidnegoc;
                    _tabelaPreco.Categoria                  = (new CRM2013.Domain.Servicos.RepositoryService()).Conta.ObterCategoriaDoClientePor(Guid.Empty, item.cdcategoria.ToString());
                    _tabelaPreco.Representante              = (new CRM2013.Domain.Servicos.RepositoryService()).Conta.ObterRepresentantePor(Guid.Empty, item.codrep.Value.ToString());
                    _tabelaPreco.CondicaoDePagamento        = new CondicaoPagamento(OrganizationName, IsOffline);
                    _tabelaPreco.CondicaoDePagamento.Codigo = item.codcondpag.Value;
                    tabelaDePreco.Add(_tabelaPreco);
                }
            }

            return(tabelaDePreco);
        }