Example #1
0
        public ActionResult GetPostesByOs(string codOs)
        {
            IEnumerable <Poste> postes_bd = UnitOfWork.PosteRepository.Get(
                p => p.OrdemDeServico.NumeroOS == codOs &&
                p.DataExclusao == null /* &&
                                        * p.TipoPoste != TipoPoste.ARVORE_P &&
                                        * p.TipoPoste != TipoPoste.ARVORE_M &&
                                        * p.TipoPoste != TipoPoste.ARVORE_G*/,
                includeProperties: "OrdemDeServico,Cidade");

            OrdemDeServico Ordem = UnitOfWork.OrdemDeServicoRepository.Get(o => o.NumeroOS == codOs, includeProperties: "Cidade,PoligonosOS").FirstOrDefault();

            var Informacao = new
            {
                IdCidade   = Ordem.Cidade.IdCidade,
                NomeCidade = Ordem.Cidade.Nome
            };


            return(Json(new
            {
                Informacao,
                Postes = postes_bd.Count() > 0 ? PostePaginadoView.GenerateByOs(postes_bd) : null,
                Limites = new LimitesCidadeView().LimitesByOS(Ordem)
            }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult GetPostesByCidadeStatus(long idCidade)
        {
            IEnumerable <Poste> Postes = UnitOfWork.PosteRepository.Get(p => p.IdCidade == idCidade && p.DataExclusao == null, includeProperties: "Cidade,IP");

            if (Postes != null && Postes.Count() > 0)
            {
                return(SendBigJson(PostePaginadoView.GenerateStatus(Postes), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Msg = Resources.Messages.Not_Register_Data_Base }, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        public ActionResult SalvarArrastarPoste(PosteJs objeto_poste)
        {
            Poste posteBd = UnitOfWork.PosteRepository.Get(pp => pp.IdPoste == objeto_poste.IdPoste && pp.DataExclusao == null, includeProperties: "OrdemDeServico,Cidade").FirstOrDefault();
            var   vaos    = UnitOfWork.VaosDemandaPosteRepository.Get(v => v.IdPoste == objeto_poste.IdPoste).ToList();

            if (posteBd != null)
            {
                ConverterLatLonToUtm converter = new ConverterLatLonToUtm(posteBd.Cidade.Datum, posteBd.Cidade.NorteOuSul, posteBd.Cidade.Zona);
                UTM utm = converter.Convert(objeto_poste.Latitude, objeto_poste.Longitude);

                posteBd.X = utm.X;
                posteBd.Y = utm.Y;
                //posteBd.Esforco = objeto_poste.Esforco != null ? objeto_poste.Esforco.ToUpper() : "";
                //posteBd.TipoPoste = objeto_poste.TipoPoste;
                //posteBd.Altura = objeto_poste.Altura;
                //posteBd.Descricao = objeto_poste.Descricao != null ? objeto_poste.Descricao.ToUpper() : "";
                //posteBd.DataCadastro = DateTime.Now;

                /// Atualizando o Poste
                UnitOfWork.PosteRepository.Update(posteBd);

                //Salvando as AlteraƧoes
                UnitOfWork.Save();

                Poste poste = UnitOfWork.PosteRepository.Get(p => p.IdPoste == objeto_poste.IdPoste).FirstOrDefault();

                if (vaos != null)
                {
                    foreach (var item in vaos)
                    {
                        item.X1 = utm.X;
                        item.Y1 = utm.Y;
                    }
                }

                UnitOfWork.Save();

                return(Json(new
                {
                    Poste = PostePaginadoView.GeneratePosteUnico(poste),
                    VaosDemandas = VaosDemandasPaginadoView.GenerateByOs(vaos)
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new ResponseView()
                {
                    Status = Status.NotFound, Result = Resources.Messages.Poste_Not_Found
                }, JsonRequestBehavior.AllowGet));
            }
        }
Example #4
0
        public ActionResult GetPostesByOsNaSa(string codOs)
        {
            IEnumerable <Poste> postes = UnitOfWork.PosteRepository.Get(
                p => p.OrdemDeServico.NumeroOS == codOs &&
                p.DataExclusao == null /* &&
                                        * p.TipoPoste != TipoPoste.ARVORE_P &&
                                        * p.TipoPoste != TipoPoste.ARVORE_M &&
                                        * p.TipoPoste != TipoPoste.ARVORE_G*/, includeProperties: "OrdemDeServico,Cidade,Fotos");

            if (postes != null && postes.Count() > 0)
            {
                return(Json(PostePaginadoView.GenerateByOsNaSa(postes), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Msg = Resources.Messages.Not_Register_Data_Base }, JsonRequestBehavior.AllowGet));
            }
        }
Example #5
0
        public ActionResult GetPostesByCidade(long idCidade)
        {
            IEnumerable <Poste> Postes = UnitOfWork.PosteRepository.Get(
                p => p.IdCidade == idCidade &&
                p.DataExclusao == null /* &&
                                        * p.TipoPoste != TipoPoste.ARVORE_P &&
                                        * p.TipoPoste != TipoPoste.ARVORE_M &&
                                        * p.TipoPoste != TipoPoste.ARVORE_G*/,
                includeProperties: "Cidade");

            if (Postes != null && Postes.Count() > 0)
            {
                return(SendBigJson(new
                {
                    Postes = PostePaginadoView.Generate(Postes),
                    Limites = new LimitesCidadeView().LimitesByCidade(UnitOfWork.LimiteCidadeRepository.Get(l => l.IdCidade == idCidade, includeProperties: "Cidade").ToList())
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Msg = Resources.Messages.Not_Register_Data_Base }, JsonRequestBehavior.AllowGet));
            }
        }