예제 #1
0
파일: MSG0063.cs 프로젝트: ertprs/crm_fonte
        public EstruturaAtendimento DefinirPropriedades(Intelbras.Message.Helper.MSG0062 xml)
        {
            var crm = new EstruturaAtendimento(this.Organizacao, this.IsOffline);

            return(crm);
        }
예제 #2
0
        public EstruturaAtendimento DefinirPropriedades(Intelbras.Message.Helper.MSG0062 xml)
        {
            var crm = new EstruturaAtendimento(this.Organizacao, this.IsOffline);

            #region Propriedades Crm->Xml

            if (!String.IsNullOrEmpty(xml.CodigoEstruturaMinima))
            {
                crm.ID = new Guid(xml.CodigoEstruturaMinima);
            }

            if (!String.IsNullOrEmpty(xml.Nome))
            {
                crm.Nome = xml.Nome;
            }
            else
            {
                resultadoPersistencia.Sucesso  = false;
                resultadoPersistencia.Mensagem = "Nome não enviado.";
                return(crm);
            }

            crm.TipoEstruturaAtendimento = xml.Tipo;

            crm.PossueEstrutura = xml.PossuiEstruturaMinima;

            if (!String.IsNullOrEmpty(xml.Conta))
            {
                crm.Canal = new Lookup(new Guid(xml.Conta), "");
            }
            else
            {
                resultadoPersistencia.Sucesso  = false;
                resultadoPersistencia.Mensagem = "Canal não enviado.";
                return(crm);
            }

            if (!String.IsNullOrEmpty(xml.UnidadeNegocio))
            {
                Model.UnidadeNegocio unidadeNegocio = new UnidadeNegocio(this.Organizacao, this.IsOffline);
                unidadeNegocio = new Intelbras.CRM2013.Domain.Servicos.UnidadeNegocioService(this.Organizacao, this.IsOffline).BuscaUnidadeNegocioPorChaveIntegracao(xml.UnidadeNegocio);
                if (unidadeNegocio != null)
                {
                    crm.UnidadeNegocios = new Lookup(unidadeNegocio.ID.Value, "");
                }
                else
                {
                    resultadoPersistencia.Sucesso  = false;
                    resultadoPersistencia.Mensagem = "Unidade de Negocio não encontrada!";
                    return(crm);
                }
            }
            else
            {
                resultadoPersistencia.Sucesso  = false;
                resultadoPersistencia.Mensagem = "Unidade de Negocio não enviado.";
                return(crm);
            }

            crm.State             = xml.Situacao;
            crm.IntegradoEm       = DateTime.Now;
            crm.IntegradoPor      = usuarioIntegracao.NomeCompleto;
            crm.UsuarioIntegracao = xml.LoginUsuario;



            #endregion

            return(crm);
        }