public ProdutoEstabelecimento Persistir(Model.ProdutoEstabelecimento objProdEstab)
        {
            ProdutoEstabelecimento TmpProdEsta = null;

            if (objProdEstab.ID.HasValue)
            {
                TmpProdEsta = RepositoryService.ProdutoEstabelecimento.ObterPor(objProdEstab.ID.Value);

                if (TmpProdEsta != null)
                {
                    objProdEstab.ID = TmpProdEsta.ID;
                    RepositoryService.ProdutoEstabelecimento.Update(objProdEstab);
                    //Altera Status - Se necessário
                    if (!TmpProdEsta.Status.Equals(objProdEstab.Status) && objProdEstab.Status != null)
                    {
                        this.MudarStatus(TmpProdEsta.ID.Value, objProdEstab.Status.Value);
                    }
                    return(TmpProdEsta);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                objProdEstab.ID = RepositoryService.ProdutoEstabelecimento.Create(objProdEstab);
                return(objProdEstab);
            }
        }
예제 #2
0
파일: MSG0140.cs 프로젝트: ertprs/crm_fonte
        public Pollux.MSG0140 DefinirPropriedades(ProdutoEstabelecimento objModel)
        {
            #region Propriedades Crm->Xml
            Product produto = null;
            if (objModel.Produto != null)
            {
                produto = new Servicos.ProdutoService(this.Organizacao, this.IsOffline).ObterPor(objModel.Produto.Id);
            }
            else
            {
                throw new Exception("Produto não encontrado!");
            }
            Pollux.MSG0140 msg0140 = new Pollux.MSG0140(itb.RetornaSistema(itb.Sistema.CRM), Helper.Truncate(produto.Codigo, 40));
            msg0140.CodigoProduto = produto.Codigo;
            if (objModel.Estabelecimento != null)
            {
                Estabelecimento estabelecimento = new Servicos.EstabelecimentoService(this.Organizacao, this.IsOffline).BuscaEstabelecimento(objModel.Estabelecimento.Id);
                if (estabelecimento.Codigo.HasValue)
                {
                    msg0140.CodigoEstabelecimento = estabelecimento.Codigo.Value;
                }
            }
            //Não é preciso passar Status - Msg delete por default
            #endregion

            return(msg0140);
        }
예제 #3
0
        public ProdutoEstabelecimento DefinirPropriedades(Intelbras.Message.Helper.MSG0102 xml)
        {
            var crm = new ProdutoEstabelecimento(this.Organizacao, this.IsOffline);

            #region Propriedades Crm->Xml


            #endregion

            return(crm);
        }
        public bool VerificarExistenciaProduto(ProdutoEstabelecimento prodEstab)
        {
            List <ProdutoEstabelecimento> lstProdEstab = new List <ProdutoEstabelecimento>();

            lstProdEstab = RepositoryService.ProdutoEstabelecimento.ListarPorProduto(prodEstab.Produto.Id);

            if (lstProdEstab.Count() > 0)
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
파일: MSG0139.cs 프로젝트: ertprs/crm_fonte
        public Pollux.MSG0139 DefinirPropriedades(ProdutoEstabelecimento objModel)
        {
            #region Propriedades Crm->Xml
            Product produto = null;
            if (objModel.Produto != null)
            {
                produto = new Servicos.ProdutoService(this.Organizacao, this.IsOffline).ObterPor(objModel.Produto.Id);
            }
            else
            {
                throw new Exception("Produto não encontrado!");
            }

            Pollux.MSG0139 msg0139 = new Pollux.MSG0139(itb.RetornaSistema(itb.Sistema.CRM), Helper.Truncate(produto.Codigo, 40));

            msg0139.CodigoProduto = produto.Codigo;
            if (objModel.Estabelecimento != null)
            {
                Estabelecimento estabelecimento = new Servicos.EstabelecimentoService(this.Organizacao, this.IsOffline).BuscaEstabelecimento(objModel.Estabelecimento.Id);
                if (estabelecimento.Codigo.HasValue)
                {
                    msg0139.CodigoEstabelecimento = estabelecimento.Codigo.Value;
                }
            }
            if (objModel.Status.HasValue)
            {
                if (objModel.Status.Value == 1)
                {
                    msg0139.Situacao = 0;
                }
                else
                {
                    msg0139.Situacao = 1;
                }
            }


            #endregion

            return(msg0139);
        }
예제 #6
0
파일: MSG0139.cs 프로젝트: ertprs/crm_fonte
        public string Enviar(ProdutoEstabelecimento objModel)
        {
            string retMsg = String.Empty;

            Intelbras.Message.Helper.MSG0139 mensagem = this.DefinirPropriedades(objModel);

            Domain.Servicos.Integracao integracao = new Servicos.Integracao(this.Organizacao, this.IsOffline);
            if (integracao.EnviarMensagemBarramento(mensagem.GenerateMessage(true), "1", "1", out retMsg))
            {
                Intelbras.Message.Helper.MSG0139R1 retorno = CarregarMensagem <Pollux.MSG0139R1>(retMsg);
                if (!retorno.Resultado.Sucesso)
                {
                    throw new Exception(retorno.Resultado.Mensagem);
                }
            }
            else
            {
                Intelbras.Message.Helper.ERR0001 erro001 = CarregarMensagem <Pollux.ERR0001>(retMsg);
                throw new Exception(erro001.GenerateMessage(false));
            }
            return(retMsg);
        }
예제 #7
0
 public string Enviar(ProdutoEstabelecimento objModel)
 {
     throw new NotImplementedException();
 }
예제 #8
0
파일: MSG0139.cs 프로젝트: ertprs/crm_fonte
        public ProdutoEstabelecimento DefinirPropriedades(Intelbras.Message.Helper.MSG0139 xml)
        {
            var crm = new ProdutoEstabelecimento(this.Organizacao, this.IsOffline);

            return(crm);
        }
 public string IntegracaoBarramentoDelete(ProdutoEstabelecimento objProdEstabelecimento)
 {
     Domain.Integracao.MSG0140 msgProdEstabDel = new Domain.Integracao.MSG0140(RepositoryService.NomeDaOrganizacao, RepositoryService.IsOffline);
     return(msgProdEstabDel.Enviar(objProdEstabelecimento));
 }