示例#1
0
        public EstruturaAtendimento Persistir(Model.EstruturaAtendimento ObjEstruturaAtendimento)
        {
            EstruturaAtendimento TmpEstruturaAtendimento = null;

            if (ObjEstruturaAtendimento.ID.HasValue)
            {
                TmpEstruturaAtendimento = RepositoryService.EstruturaAtendimento.ObterPor(ObjEstruturaAtendimento.ID.Value);

                if (TmpEstruturaAtendimento != null)
                {
                    ObjEstruturaAtendimento.ID = TmpEstruturaAtendimento.ID;

                    RepositoryService.EstruturaAtendimento.Update(ObjEstruturaAtendimento);

                    if (!TmpEstruturaAtendimento.State.Equals(ObjEstruturaAtendimento.State) && ObjEstruturaAtendimento.State != null)
                    {
                        this.MudarStatus(TmpEstruturaAtendimento.ID.Value, ObjEstruturaAtendimento.State.Value);
                    }

                    return(TmpEstruturaAtendimento);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                ObjEstruturaAtendimento.ID = RepositoryService.EstruturaAtendimento.Create(ObjEstruturaAtendimento);
                return(ObjEstruturaAtendimento);
            }
        }
示例#2
0
        public EstruturaAtendimento DefinirPropriedades(Intelbras.Message.Helper.MSG0062 xml)
        {
            var crm = new EstruturaAtendimento(this.Organizacao, this.IsOffline);

            return(crm);
        }
示例#3
0
 public string Enviar(EstruturaAtendimento objModel)
 {
     throw new NotImplementedException();
 }
示例#4
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);
        }