public ActionResult AlterarProjeto(int id) { //ViewBag.ListarHabilidades = new SelectList(SkillDao.ListarSkills(), "Id", "TipoSkill"); ViewBag.ListarProjetos = new SelectList(ProjetosDao.ListarProjetos(), "Id", "Descricao"); //var lista = new List<TipoPessoa>() //{ // new TipoPessoa{Codigo = 1, Descricao = "Pessoa Física"}, // new TipoPessoa{Codigo = 2, Descricao = "Pessoa Jurídica"} //}; //ViewBag.ListarTipoPessoa = new SelectList(lista, "Codigo", "Descricao"); var lista = new List <TipoPgtoProj>() { new TipoPgtoProj { Tipo = 1, Descricao = "Valor Variável" }, new TipoPgtoProj { Tipo = 2, Descricao = "Valor Fixo" } }; ViewBag.ListarTipoPagamento = new SelectList(lista, "Tipo", "Descricao"); return(VerificarProjeto(id, "AlterarProjeto")); }
public ActionResult ListarProjetos(string sortOrder, string filtro, string busca, int?page) { using (var ctx = new ProjectManagerConnection()) { ViewBag.CurrentSort = sortOrder; ViewBag.NomeParam = String.IsNullOrEmpty(sortOrder) ? "Nome_Desc" : ""; ViewBag.DateParam = sortOrder == "Date" ? "Date_Desc" : "Date"; if (busca != null) { page = 1; } else { busca = filtro; } ViewBag.CurrentFilter = busca; IEnumerable <CadProjeto> projetos = ProjetosDao.ListarProjetos(); if (!String.IsNullOrEmpty(busca)) { projetos = projetos.Where(s => s.Descricao.ToUpper().Contains(busca.ToUpper()) || s.Situacao.ToUpper().Contains(busca.ToUpper())); } switch (sortOrder) { case "Nome_Desc": projetos = projetos.OrderByDescending(s => s.Descricao); break; case "Data": projetos = projetos.OrderBy(s => s.Situacao); break; case "Data_Desc": projetos = projetos.OrderByDescending(s => s.Situacao); break; default: projetos = projetos.OrderBy(s => s.Descricao); break; } int numRegistro = 5; int numPagina = (page ?? 1); return(View(projetos.ToPagedList(numPagina, numRegistro))); } //ViewBag.ListClient = new SelectList(ClientesDao.ListarClientesDois(), "IdCliente", "Descricao"); //ViewBag.ListarProjetos = ProjetosDao.ListarProjetosInfo(); //ViewBag.ListaTipoSkill = SkillDao.ListarSkillsInfo().ToList(); //ViewBag.ListaTipoPessoa = ColaboradoresDao.ListarColaboradoresInfo(); //var listaProjeto = ProjetosDao.ListarProjetos(); //return View(listaProjeto); }
public ActionResult IncluirColabProjeto() { ViewBag.Skills = new SelectList(ColaboradoresDao.ListarSkillsInfo(), "IdSkill", "Descricao"); ViewBag.Colaboradores = new SelectList(ColaboradoresDao.ListarColaboradores(), "IDCOLABORADOR", "Nome"); ViewBag.Projetos = new SelectList(ProjetosDao.ListarProjetos(), "IDPROJETO", "Descricao"); return(View()); }
public ActionResult IncluirTarefa() { ViewBag.ListaDeColaboradores = new SelectList(ColaboradoresDao.ListarColaboradores(), "Id", "Nome"); ViewBag.ListaDeProjetos = new SelectList(ProjetosDao.ListarProjetos(), "Id", "Descricao"); return(View()); }
public ActionResult AlterarProjeto(int id) { List <TipoStatusProjeto> tiposstatus = new List <TipoStatusProjeto>() { new TipoStatusProjeto { Codigo = 1, Descricao = "EM ANDAMENTO" }, new TipoStatusProjeto { Codigo = 2, Descricao = "PAUSADO" }, new TipoStatusProjeto { Codigo = 3, Descricao = "FINALIZADO" } }; List <TipoStatusProjeto> tiposescopo = new List <TipoStatusProjeto>() { new TipoStatusProjeto { Codigo = 1, Descricao = "ABERTO" }, new TipoStatusProjeto { Codigo = 2, Descricao = "FECHADO" } }; ViewBag.TiposEscopo = new SelectList(tiposescopo, "Codigo", "Descricao"); ViewBag.TiposStatus = new SelectList(tiposstatus, "Codigo", "Descricao"); ViewBag.Clientes = new SelectList(clientesDao.Listar().ToList(), "IDCLIENTE", "RazaoSocial"); var projeto = ProjetosDao.BuscarProjeto(id); return(View(projeto)); }
public ActionResult MostrarDetalhesProjeto(int id) { var projeto = ProjetosDao.BuscarProjeto(id); var horasTrabalhadas = AtividadesDao.TotalHorasProjetos(id); var colaboradores = ProjColaboradorDao.ListarColaboradoresProjeto(id); double valorPagoColaboradores = 0; double valorPagoColaboradoresProjeto = 0; int horas; foreach (var item in colaboradores) { horas = AtividadesDao.TotalHorasColaborador(item.IDPROJ_COLAB); valorPagoColaboradores += (item.ValorColaborador * horas); valorPagoColaboradoresProjeto += (item.ValorHoraProjColab * horas); } double valorTotal = 0; if (projeto.Escopo == 1) { if (projeto.ValorDespesas != 0 || projeto.ValorDespesas != null) { valorTotal += ((projeto.ValorProjeto * horasTrabalhadas) + valorPagoColaboradoresProjeto) - (double)projeto.ValorDespesas - valorPagoColaboradores; } else { valorTotal += ((projeto.ValorProjeto * horasTrabalhadas) + valorPagoColaboradoresProjeto) - valorPagoColaboradores; } } else { if (projeto.ValorDespesas != 0 || projeto.ValorDespesas != null) { valorTotal = projeto.ValorProjeto - valorPagoColaboradores - (double)projeto.ValorDespesas; } else { valorTotal = projeto.ValorProjeto - valorPagoColaboradores; } } var valores = new ProjetoValoresViewModel() { NumHorasProj = (int)projeto.NumHoras, HorasRestantes = AtividadesDao.TotalHorasRestante(id), HorasTrabalhadas = horasTrabalhadas, ValorTotal = valorTotal, ValorPagoColaboradores = valorPagoColaboradores, ValorPedidoColaboradores = valorPagoColaboradoresProjeto, ValorDespesas = (double)projeto.ValorDespesas, ValorOrca = projeto.ValorProjeto }; ViewBag.Valores = valores; ViewBag.Colaboradores = colaboradores; return(View(projeto)); }
public ActionResult MostrarDetalhes(int id) { //return VerificarProjeto(id, "MostrarDetalhes"); if (ModelState.IsValid) { var projeto = ProjetosDao.BuscarProjeto(id); var horasConsumidas = ProjetosDao.HorasConsumidasNoProjeto(id); var x = ProjetosDao.ValorPagoAosColaboradores(projeto.Id); HorasFirstViewModel proj; if (projeto.TipoPgtoProj == 2) { proj = new HorasFirstViewModel() { IdCliente = projeto.TBCadClientes.RazaoSocial, Descricao = projeto.Descricao, NumeroHoras = projeto.NumeroHoras, DataInicio = projeto.DataInicio, DataTermino = projeto.DataTermino, Situacao = projeto.Situacao, TipoPgtoProj = projeto.TipoPgtoProj, Orcamento = projeto.Orcamento, ValorDespesas = projeto.ValorDespesas, HorasRestantes = projeto.NumeroHoras - horasConsumidas, VtotalPagoColabs = ProjetosDao.ValorPagoAosColaboradores(id), Lucro = projeto.Orcamento - projeto.ValorDespesas - x }; } else { proj = new HorasFirstViewModel() { IdCliente = projeto.TBCadClientes.RazaoSocial, Descricao = projeto.Descricao, NumeroHoras = projeto.NumeroHoras, DataInicio = projeto.DataInicio, DataTermino = projeto.DataTermino, Situacao = projeto.Situacao, TipoPgtoProj = projeto.TipoPgtoProj, Orcamento = projeto.Orcamento, ValorDespesas = projeto.ValorDespesas, HorasRestantes = projeto.NumeroHoras - horasConsumidas, VtotalPagoColabs = ProjetosDao.ValorPagoAosColaboradores(id), Lucro = projeto.Orcamento * projeto.NumeroHoras - projeto.ValorDespesas - x }; } return(View(proj)); } else { return(RedirectToAction("ListarProjetos")); } }
public ActionResult ExcluirProjeto(CadProjeto projeto) { try { ProjetosDao.ExcluirProjeto(projeto); return(RedirectToAction("ListarProjetos")); } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_Erro")); } }
public ActionResult IncluirProjeto(CadProjeto projeto) { try { if (!ModelState.IsValid) { return(IncluirProjeto()); } ProjetosDao.IncluirProjeto(projeto); TempData["Mensagem"] = "Projeto cadastrado com sucesso..."; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_erro")); } }
public ActionResult AlterarProjeto(CadProjeto projeto) { try { if (!ModelState.IsValid) { throw new Exception("ModelState is invalid!"); } ProjetosDao.AlterarProjeto(projeto); TempData["Mensagem"] = "Projeto alterado com sucesso..."; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_erro")); } }
public ActionResult AlterarProjeto(CadProjeto projeto) { try { if (!ModelState.IsValid) { return(View()); } ProjetosDao.AlterarProjeto(projeto); return(RedirectToAction("ListarProjetos")); } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_Erro")); } }
public ActionResult PontoColaborador(int id) { var colabProj = ProjColaboradorDao.BuscarProjetoColaborador(id); var colaborador = ColaboradoresDao.BuscarColaborador(colabProj.IDCOLABORADOR); var projeto = ProjetosDao.BuscarProjeto(colabProj.IDPROJETO); var atividade = new Atividade() { IDPROJ_COLAB = id }; ViewBag.Lista = AtividadesDao.ListarPontosPorProjeto(id).ToList(); ViewBag.Colaborador = ColaboradoresDao.BuscarColaborador(colabProj.IDCOLABORADOR); ViewBag.Colab = new ColaboradorProjetoViewModel() { Id = id, Descricao = projeto.Descricao + " / " + colaborador.Nome }; return(View(atividade)); }
private ActionResult VerificarProjeto(int id, string view) { try { var Projeto = ProjetosDao.BuscarProjeto(id); if (Projeto == null) { throw new Exception("Projeto não existe"); } return(View(view, Projeto)); } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_Erro")); } }
public ActionResult DetalhesColaborador(int id) { try { if (Request.IsAjaxRequest()) { var projetoColab = ProjColaboradorDao.BuscarProjetoColaborador(id); var projeto = ProjetosDao.BuscarProjeto(projetoColab.IDPROJETO); var horaTrab = AtividadesDao.TotalHorasColaborador(projetoColab.IDPROJ_COLAB); if (projeto.NumHoras == null) { projeto.NumHoras = 0; } var valores = new ProjetoValoresViewModel() { ValorColaborador = projetoColab.ValorColaborador, HorasTrabalhadas = horaTrab, ValorPagoColaboradores = projetoColab.ValorColaborador * horaTrab, ValorPedidoColaboradores = projetoColab.ValorHoraProjColab * horaTrab, HorasRestantes = (int)projeto.NumHoras - horaTrab, NumHorasProj = (int)projeto.NumHoras }; ViewBag.Projetos = ProjColaboradorDao.ListarProjetosColaborador(id); ViewBag.Skill = ColaboradoresDao.BuscarSkillInfo(ColaboradoresDao.BuscarColaborador(projetoColab.IDCOLABORADOR).IDSKILL).Descricao; return(PartialView("_ValoresColaborador", valores)); } else { ViewBag.Projetos = ProjColaboradorDao.ListarProjetosColaborador(id); ViewBag.Skill = ColaboradoresDao.BuscarSkillInfo(ColaboradoresDao.BuscarColaborador(id).IDSKILL).Descricao; return(VerificarColaborador(id, "DetalhesColaborador")); } } catch (Exception ex) { ViewBag.MensagemErro = ex.Message; return(View("_erro")); } }
public ActionResult ListaDeProjetosCliente(int id) { var lista = ProjetosDao.ListaProjetosCliente(id); return(View(lista)); }
// GET: Projetos public ActionResult Index() { ViewBag.Projetos = ProjetosDao.ListarProjetos(); return(View()); }
public ActionResult HorasColaborador(int id) { var lista = ProjetosDao.HorasColaborador(id); return(View(lista)); }