public ActionResult Listagem(int? page) { page = page ?? 1; var Aplicacao = new AplicacaoService().GetByPage(page.Value); var list = new MvcList<Ecommerce_Aplicacao>(Aplicacao.Item1, page.Value, Aplicacao.Item2, Settings.QuantityRegistersPerPage); return PartialView(list); }
public ActionResult Editar(int id) { var cat = new AplicacaoService().GetById(id); ViewBag.Parents = GetapplicationSelectListItem(new AplicacaoService().GetRecords(x => x.IdAplicacao != id).ToList(), id); ViewBag.Idiomas = new IdiomaService().GetAll(); return View(cat); }
private void ValidarEstudo(string protocolo) { string[] ids = new string[2];; if (protocolo.IndexOf('|') != -1) { ids = protocolo.Split('|'); } else { ids[0] = protocolo; } ConsultaEstudoService ces = new ConsultaEstudoService(); var estudo = ces.GetEstudo(ids[0]); buttonSalvar.Visibility = ViewStates.Visible; if (estudo.Count > 0) { AplicacaoService aps = new AplicacaoService(); var validaPlan = aps.GetPlanejamentoAplic(estudo[0].IdEstudo); if (estudo[0].idInstalacao != 0) { if (validaPlan.Count > 0) { idPlanejamento = validaPlan[0].idEstudo_Planejamento_Aplicacao; } else { idPlanejamento = 0; } idEstudo_ = estudo[0].IdEstudo; idInstalacao = estudo[0].idInstalacao; edNumEstudo.Text = estudo[0].Codigo; DadosMeterologicos(); Coordenadas(); } else { LimparCampos(); Toast.MakeText(this, "O estudo não contem uma intalação relacionada", ToastLength.Long).Show(); } } else { Toast.MakeText(this, "Nenhum estudo encontrado", ToastLength.Long).Show(); } }
private void GetEquipamento() { Equipamento = new ArrayList(); idEquipamento = new ArrayList(); AplicacaoService tas = new AplicacaoService(); var result = tas.GetEquipamento(); Equipamento.Add("Selecione"); idEquipamento.Add(0); foreach (var res in result) { Equipamento.Add(res.Descricao); idEquipamento.Add(res.IdEquipamento); } }
/// <summary> /// Returns a view for a "New Product" /// </summary> /// <returns></returns> public ActionResult Novo() { //Instância das Controllers var marcaController = new MarcaController(); var linhaController = new LinhaController(); //Instância das Services var categoriaService = new CategoriaService(); var aplicacaoService = new AplicacaoService(); var idiomaService = new IdiomaService(); var tipoService = new TipoProdutoService(); //GetAll var getAllAplicacoes = aplicacaoService.GetAll(); var getAllCategorias = categoriaService.GetCategoriesAddMasterCateg(); var getAllIdiomas = idiomaService.GetAll(); var getAllTipos = tipoService.GetAll(); //Adicionando SelectListItens na ViewBag ViewBag.Marks = marcaController.GetMarkSelectListItem(new MarcaService().GetAll(), null); ViewBag.Lines = linhaController.GetLineSelectListItem(new LinhaService() .GetAll(), null).OrderBy(x => x.Text).ToList(); //ViewBag.Skins = tipoPeleController.GetSkinTypeSelectListItem(new TipoPeleService().GetAll(), null); ViewBag.Categories = GetProdCategoryListItem(getAllCategorias, null); ViewBag.Applications = GetProdAppListItem(getAllAplicacoes, null); ViewBag.Types = GetProdTypesListItem(getAllTipos, null); ViewBag.Idiomas = getAllIdiomas; //Adicionando valores selecionados na ViewBag - NULL pois é novo Registro ViewBag.selApplications = null; ViewBag.selCategories = null; ViewBag.selTypes = null; return View(); }
/// <summary> /// Returns a view to edit a product /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Editar(int id) { //Retorna o produto var produto = new ProdutoService().GetById(id); //Instância das Controllers var marcaController = new MarcaController(); var linhaController = new LinhaController(); var tipoPeleController = new TipoPeleController(); //Instância das Services var categoriaService = new CategoriaService(); var aplicacaoService = new AplicacaoService(); var idiomaService = new IdiomaService(); var produtoCategoriaService = new ProdutoCategoriaService(); var produtoAplicacaoService = new ProdutoAplicacaoService(); var produtoTipoService = new ProdutoTipoProdutoService(); var tipoService = new TipoProdutoService(); //GetAll var getAllAplicacoes = aplicacaoService.GetAll(); var getAllCategorias = categoriaService.GetCategoriesAddMasterCateg(); var getAllIdiomas = idiomaService.GetAll(); var getAllTipos = tipoService.GetAll(); //GetByProductId var getAllProdutoCategorias = produtoCategoriaService.GetRecords(x => x.IdProduto == produto.IdProduto); var getAllProdutoAplicacoes = produtoAplicacaoService.GetRecords(x => x.IdProduto == produto.IdProduto); var getAllProdutoTipos = produtoTipoService.GetRecords(x => x.IdProduto == produto.IdProduto); //Adicionando SelectListItens na ViewBag ViewBag.Marks = marcaController.GetMarkSelectListItem(new MarcaService().GetAll(), null); ViewBag.Lines = linhaController.GetLineSelectListItem(new LinhaService().GetAll(), null); ViewBag.Skins = tipoPeleController.GetSkinTypeSelectListItem(new TipoPeleService().GetAll(), null); ViewBag.Categories = GetProdCategoryListItem(getAllCategorias, null); ViewBag.Applications = GetProdAppListItem(getAllAplicacoes, produto.IdProduto); ViewBag.Types = GetProdTypesListItem(getAllTipos, null); ViewBag.Idiomas = getAllIdiomas; //Adicionando valores selecionados na ViewBag ViewBag.selApplications = CreateApplicationsSelectedList(getAllAplicacoes, getAllProdutoAplicacoes); ViewBag.selCategories = CreateCategoriesSelectedList(getAllCategorias, getAllProdutoCategorias); ViewBag.selTypes = CreateTypesSelectedList(getAllTipos, getAllProdutoTipos); return View(produto); }
protected internal void BTSalvar_Click(object sender, EventArgs e) { AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog alerta = builder.Create(); AplicacaoService apliService = new AplicacaoService(); AvaliacaoService avalService = new AvaliacaoService(); if (idEstudo_ > 0 && int.Parse(idEquipamentoSelect) > 0) { var date = ""; if (textDate.Text == "") { date = DateTime.Now.ToString(); } else { date = textDate.Text; } var datechuva = ""; if (textChuva.Text == "") { datechuva = null; } else { datechuva = textChuva.Text; } string Velocidade_Vento = "0"; if (textVento.Text == "") { Velocidade_Vento = "0"; } else { Velocidade_Vento = textVento.Text.Replace("km/h", ""); } decimal Umidade_Relativa = 0; if (textUmidade.Text == "") { Umidade_Relativa = 0; } else { Umidade_Relativa = decimal.Parse(textUmidade.Text.Replace("%", "")); } decimal Percentual_Nuvens = 0; if (textNuvens.Text == "") { Percentual_Nuvens = 0; } else { Percentual_Nuvens = decimal.Parse(textNuvens.Text.Replace("%", "")); } decimal Chuva_Volume = 0; if (textVolumeChuva.Text == "") { Chuva_Volume = 0; } else { Chuva_Volume = decimal.Parse(textVolumeChuva.Text); } decimal BBCH = 0; if (textBBCH.Text == "") { BBCH = 0; } else { BBCH = decimal.Parse(textBBCH.Text); } var aplicacao = new Aplicacao { idInstalacao = idInstalacao, Data_Aplicacao = DateTime.Parse(date), Umidade_Relativa = Umidade_Relativa, Temperatura = textTemperatura.Text, Velocidade_Vento = Convert.ToDecimal(Velocidade_Vento.Replace(".", ",")), Percentual_Nuvens = Percentual_Nuvens, Chuva_Data = Convert.ToDateTime(datechuva), Chuva_Volume = Chuva_Volume, idEquipamento = int.Parse(idEquipamentoSelect), BBCH = BBCH, Observacoes = textObservacoes.Text, Longitude = longitude.ToString(), Latitude = latitude.ToString(), Data_Realizada = DateTime.Now, idUsuario = int.Parse(Settings.GeneralSettings), idEstudo_Planejamento = idPlanejamento }; try { if (apliService.SalvarAplicacao(aplicacao) == true) { if (apliService.GerarPlanejamentoAplicacao(idEstudo_, aplicacao.Data_Aplicacao)) { avalService.GerarPlanejamentoAvaliacao(idEstudo_, aplicacao.Data_Aplicacao); } AplicacaoService aps = new AplicacaoService(); var validaPlan = aps.GetPlanejamentoAplic(idEstudo_); if (validaPlan.Count > 0) { if (validaPlan[0].Num_Aplicacao == 1) { aplicacao.idEstudo_Planejamento = validaPlan[0].idEstudo_Planejamento_Aplicacao; var last = apliService.LastID(); aplicacao.IdAplicacao = last.IdAplicacao; apliService.UpdateAplicacao(aplicacao); } } alerta.SetTitle("Sucesso!"); alerta.SetIcon(Android.Resource.Drawable.IcInputAdd); alerta.SetMessage("Aplicação Salva com Sucesso!"); alerta.SetButton("OK", (s, ev) => { alerta.Dismiss(); }); alerta.Show(); LimparCampos(); } else { alerta.SetTitle("ERRO!"); alerta.SetIcon(Android.Resource.Drawable.IcDialogAlert); alerta.SetMessage("Erro ao salvar a Aplicação!"); alerta.SetButton("OK", (s, ev) => { alerta.Dismiss(); }); alerta.Show(); } } catch { alerta.SetTitle("ERRO!"); alerta.SetIcon(Android.Resource.Drawable.IcDialogAlert); alerta.SetMessage("Erro ao salvar a Aplicação!"); alerta.SetButton("OK", (s, ev) => { alerta.Dismiss(); }); alerta.Show(); } } else { alerta.SetTitle("ERRO!"); alerta.SetIcon(Android.Resource.Drawable.IcDialogAlert); alerta.SetMessage("Favor preencher todos os campos obrigatorios!"); alerta.SetButton("OK", (s, ev) => { alerta.Dismiss(); }); alerta.Show(); } }