Ejemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            Form atividade = new AtividadeView();

            atividade.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        public ActionResult Create(AtividadeView model)
        {
            try
            {
                // TODO: Add insert logic here

                if (ModelState.IsValid)
                {
                    var atividade = new Atividade
                    {
                        Nome              = model.Nome,
                        Descricao         = model.Descricao,
                        DtInicioPrevista  = model.DtInicio,
                        DtTerminoPrevista = model.DtFim
                    };

                    atividade.Projeto = Context.Projeto.Where(p => p.ProjetoId == model.ProjetoId).FirstOrDefault();
                    Context.Atividade.Add(atividade);

                    Context.SaveChanges();
                    return(RedirectToAction("Details", "Projeto", new { Id = model.ProjetoId }));
                }
                var projeto = Context.Projeto.FirstOrDefault(p => p.ProjetoId == model.ProjetoId);
                ViewBag.Projeto = projeto;
                return(View());
            }
            catch (Exception e)
            {
                var projeto = Context.Projeto.FirstOrDefault(p => p.ProjetoId == model.ProjetoId);
                ViewBag.Projeto = projeto;
                return(View());
            }
        }
Ejemplo n.º 3
0
        // <Consulta geral das atividades> \\
        public List <AtividadeView> ReadAll()
        {
            List <AtividadeView> listaAtividades = new List <AtividadeView>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = connection;

            /// <Select>
            ///
            /// SELECT a.id as eventoId, e.nome as nome_evento, a.descricao, c.nomeConferente, c.assunto,
            /// c.conteudo, t.descricao as tipoEvento, e.valor, a.data, a.horaInicio, a.horaFinal, a.cargaHoraria
            /// FROM atividades a, v_conferente c, eventos e, tipos t
            /// WHERE a.id = e.id AND a.id = t.id AND a.id = c.ConferenteID
            ///
            /// </Select>
            cmd.CommandText = @"select * from v_nEvento";

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                AtividadeView a = new AtividadeView();

                // <Evento> \\
                a.Nome_Evento = (string)reader["nome_evento"];
                a.Valor       = (decimal)reader["valor"];
                // </Evento> \\

                // <Tipo> \\
                a.TipoEvento = (string)reader["tipoEvento"];
                // </Tipo> \\

                // <Conferente> \\
                a.NomeConferente = (string)reader["nomeConferente"];
                a.Assunto        = (string)reader["assunto"];
                a.Conteudo       = (string)reader["conteudo"];
                // </Conferente> \\

                // <Atividade> \\
                a.EventoId     = (int)reader["eventoId"];
                a.Descricao    = (string.IsNullOrEmpty(a.Descricao) ? "null" : a.Descricao);
                a.Data         = (string)reader["data"];
                a.HoraInicio   = (string)reader["horaInicio"];
                a.HoraFinal    = (string)reader["horaFinal"];
                a.CargaHoraria = (int)reader["cargaHoraria"];
                // </Atividade> \\

                listaAtividades.Add(a);
            }
            return(listaAtividades);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            AtividadeView atividadeView = new AtividadeView();

            atividadeView.ExibirMenu();
        }