private async void CreateAgenda()
        {
            List <AgendaEvento> agenda = new List <AgendaEvento>();

            //Quinta-feira
            //Cloud Computing
            AgendaEvento Danilo_cloud = new AgendaEvento()
            {
                Trilha = "Cloud Computing", Data = new DateTime(2014, 8, 6), HoraInicio = new DateTime(2014, 8, 6, 13, 10, 0, 0), HoraTermino = new DateTime(2014, 8, 6, 14, 0, 0), Titulo = "Microsoft Azure: Opção de Nuvem para Todo o Desenvolvedor", Descricao = "Sabemos que quando a palavra \"MIcrosoft\" é citada, logo se pensa em uma plataforma fechada e proprietária. Entenda como isso mudou ao longo dos anos e como hoje o Microsoft Azure é uma solução de Nuvem que suporta diversas soluções e cenários open source. Abordaremos as principais funcionalidades existentes e o que há no roadmap para o futuro.", Palestrante = "Danilo Bordini", TwitterPalestrante = "@dbordini", UrlFotoPalestrante = "http://dbordini.azurewebsites.net/wp-content/uploads/2013/06/smartcard-2012_09_27-14_59_08-UTC-237x300.jpg", UrlSitePalestrante = "http://dbordini.azurewebsites.net/", MiniBio = "Danilo Bordini é graduado em Tecnologia da Informação pela FATEC ? Sorocaba, com Especialização em Marketing pela FGV. Certificado como MCSE e MCSA em Windows 2000 / 2003 / 2008, trabalha na trabalha na área de informática desde 1996, passando pelas disciplinas de Desenvolvimento de Software e Redes de Computadores. Hoje, ocupa a função de \"Technical Evangelist Manager\", liderando um time de Especialistas em Desenvolvimento de Software & Infraestrutura."
            };

            agenda.Add(Danilo_cloud);

            //Software Livre
            AgendaEvento vinicius_OpenSource = new AgendaEvento()
            {
                Trilha = "Software Livre", Data = new DateTime(2014, 8, 6), HoraInicio = new DateTime(2014, 8, 6, 13, 10, 0, 0), HoraTermino = new DateTime(2014, 8, 6, 14, 0, 0), Titulo = "Microsoft e OpenSource - Por que e como contribuir?", Descricao = "Nesta sessão falaremos da importância da iniciativa Open Souce na Microsoft, apresentando alguns dos projetos que estamos trabalhando e como você pode contribuir.", Palestrante = "Vinícius Souza", TwitterPalestrante = "@vbs_br", UrlFotoPalestrante = "http://viniciussouza.azurewebsites.net/wp-content/uploads/2012/08/favicon.png", UrlSitePalestrante = "http://viniciussouza.azurewebsites.net/", MiniBio = "Vinícius é Bacharel em Ciência da computação com mais de 10 anos de experiência em desenvolvimento utilizando diferentes plataformas. Atualmente trabalha como evangelista de desenvolvimento no time evangelistas da Microsoft Brasil. Além da paixão por tecnologia, pratica automodelismo off road, IoT, joga muito game e está aprendendo a tocar guitarra."
            };

            agenda.Add(vinicius_OpenSource);

            //15:40 às 16:30
            AgendaEvento Debate_Opensource_Cloud = new AgendaEvento()
            {
                Trilha = "Software Livre", Data = new DateTime(2014, 8, 6), HoraInicio = new DateTime(2014, 8, 6, 15, 40, 0, 0), HoraTermino = new DateTime(2014, 8, 6, 16, 30, 0), Titulo = "Software Livre e Computação em Nuvem (Debate)", Descricao = "Debate com os palestrantes sobre a utilização de nuvem e suas implicações", Palestrante = "Vinícius Souza", TwitterPalestrante = "@vbs_br", UrlFotoPalestrante = "http://viniciussouza.azurewebsites.net/wp-content/uploads/2012/08/favicon.png", UrlSitePalestrante = "http://viniciussouza.azurewebsites.net/", MiniBio = "Vinícius é Bacharel em Ciência da computação com mais de 10 anos de experiência em desenvolvimento utilizando diferentes plataformas. Atualmente trabalha como evangelista de desenvolvimento no time evangelistas da Microsoft Brasil. Além da paixão por tecnologia, pratica automodelismo off road, IoT, joga muito game e está aprendendo a tocar guitarra."
            };

            agenda.Add(Debate_Opensource_Cloud);


            foreach (AgendaEvento agenda_item in agenda)
            {
                await agendaTable.InsertAsync(agenda_item);
            }
        }
Exemplo n.º 2
0
        //public void lnkFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        //{
        //    LinkLabel lnk = new LinkLabel();
        //    lnk = (LinkLabel)sender;
        //    lnk.Links[lnk.Links.IndexOf(e.Link)].Visited = true;

        //    ProcessStartInfo psi = new ProcessStartInfo();
        //    psi.FileName = e.Link.LinkData.ToString().Split('\\')[e.Link.LinkData.ToString().Split('\\').Count() -1].ToString();
        //    psi.WorkingDirectory = Path.GetDirectoryName(e.Link.LinkData.ToString());
        //    psi.Arguments = "p1=hardCodedv1 p2=v2";
        //    Process.Start(psi);
        //}

        private void btnEnviarArquivo_Click(object sender, EventArgs e)
        {
            //Para enviar o arquivo, é necessário selecionar um tema
            if (ddlTema.SelectedIndex == -1)
            {
                MessageBox.Show("Para enviar o arquivo de palestra, você deve informar o tema.");
                return;
            }

            int          keyAgenda = ((KeyValuePair <int, string>)ddlTema.SelectedItem).Key;
            AgendaEvento agenda    = null;

            try
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Multiselect = true;
                if (dialog.ShowDialog() == DialogResult.OK) // if user clicked OK
                {
                    //string nomeArquivo = dialog.SafeFileName;
                    agenda = new AgendaEventoDAO().BuscarPorCodigo(keyAgenda, this.pathDiretorio);
                    if (agenda != null)
                    {
                        string[] arquivosSelecionados = dialog.FileNames;
                        for (int i = 0; i < arquivosSelecionados.Length; i++)
                        {
                            FileStream arquivoUsuario = File.OpenRead(arquivosSelecionados[i]);
                            FileStream arquivoSaida   = File.Create(agenda.PathPalestra(this.pathDiretorio) + @"/ " + Path.GetFileName(arquivosSelecionados[i]));
                            int        b;

                            while ((b = arquivoUsuario.ReadByte()) > -1)
                            {
                                arquivoSaida.WriteByte((byte)b);
                            }

                            arquivoSaida.Flush();
                            arquivoSaida.Close();
                            arquivoUsuario.Close();
                        }

                        ddlTema_SelectedIndexChanged(null, null);
                        MessageBox.Show("Arquivo(s) enviado(s) para o servidor com sucesso. Será realizada uma cópia dos arquivos para a sala da palestra.");
                    }
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                MessageBox.Show("Ocorreu um erro: O sistema está sem permissão de escrita no diretório informado. Por favor, tente novamente após a autorização");
                return;
            }

            try
            {
                CopiarArquivosParaSala(agenda);
            }
            catch (UnauthorizedAccessException ex)
            {
                MessageBox.Show("Ocorreu um erro ao copiar o(s) arquivo(s) para a sala da palestra: O IP " + agenda.Sala.IP + " está sem permissão de escrita no diretório informado.");
                return;
            }
        }
        public ActionResult EditarEvento(AgendaEvento model)
        {
            CultureInfo brasil = new CultureInfo("pt-BR");
            //[0]	"IdAgendaEvento"
            //[1]	"idDocenteEdit"
            //[2]	"Descricao"
            //[3]	"DataIni"
            //[4]	"TipoEventoEdit"
            //[5]	"DataFim"

            var dataStr = Request.Form["dataini"];

            model.DataIni = DateTime.Parse(dataStr, brasil);
            if (Request.Form["datafim"] != null && Request.Form["datafim"] != "")
            {
                var dataStr2 = Request.Form["datafim"];
                model.DataFim = DateTime.Parse(dataStr2, brasil);
            }


            model.IdDocente  = int.Parse(Request.Form["IdDocente"]);
            model.TipoEvento = byte.Parse(Request.Form["TipoEvento"]);


            if (model.DataIni == model.DataFim)
            {
                model.DataFim = null;
            }

            BL.AgendaEvento.Update(model);
            return(null);
        }
Exemplo n.º 4
0
        void CopiarArquivosParaSala(AgendaEvento agenda)
        {
            string[] files = Directory.GetFiles(agenda.PathPalestra(this.pathDiretorio));
            if (files.Length > 0)
            {
                for (int i = 0; i < files.Length; i++)
                {
                    FileStream arquivoSala = File.OpenRead(files[i]);
                    new AgendaEventoDAO().CriarDiretorios(@"\\" + agenda.Sala.IP + @"\PALESTRAS", agenda.Palestrante.Codigo, agenda.Sala.Codigo, agenda.Data, agenda.Hora, agenda.TemaFormatado, this.pathDiretorio);
                    FileStream arquivoSaida = File.Create(@"\\" + agenda.PathPalestra(agenda.Sala.IP) + @"/ " + Path.GetFileName(files[i]));
                    int        b;

                    while ((b = arquivoSala.ReadByte()) > -1)
                    {
                        arquivoSaida.WriteByte((byte)b);
                    }

                    arquivoSaida.Flush();
                    arquivoSaida.Close();
                    arquivoSala.Close();
                    //if (i == 0)
                    //    lblNomeArquivo.Text = "* " + nome;
                    //else
                    //    lblNomeArquivo.Text += "\r\n* " + nome;
                }
            }
        }
Exemplo n.º 5
0
        public List <AgendaEvento> ListarTodos()
        {
            List <AgendaEvento> agendas = new List <AgendaEvento>();
            //Sala usuario = null;
            DataTable resultado = new DataTable();

            using (OleDbConnection oConn = new OleDbConnection(ConexaoSingle.conexao))
            {
                oConn.Open();

                using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM SALA_PAL.DBF ORDER BY DATA, HORA"))
                {
                    cmd.Connection = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        for (int i = 0; i < resultado.Rows.Count; i++)
                        {
                            AgendaEvento agendaEvento = new AgendaEvento();
                            agendaEvento.Palestrante     = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_PALESTR"].ToString()), null);
                            agendaEvento.Codigo          = int.Parse(resultado.Rows[i]["ID"].ToString());
                            agendaEvento.Sala            = new SalaDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_SALA"].ToString()), null);
                            agendaEvento.Data            = DateTime.Parse(resultado.Rows[i]["DATA"].ToString());
                            agendaEvento.Hora            = resultado.Rows[i]["HORA"].ToString();
                            agendaEvento.Tema            = resultado.Rows[i]["TEMA"].ToString();
                            agendaEvento.ArquivoPalestra = resultado.Rows[i]["FILENAME"].ToString();
                            agendas.Add(agendaEvento);
                        }
                    }
                }
            }
            return(agendas);
        }
Exemplo n.º 6
0
        public AgendaEvento BuscarPorCodigo(int pCodigo, string pPath)
        {
            AgendaEvento agendaEvento = null;

            using (OleDbConnection oConn = new OleDbConnection(String.IsNullOrEmpty(pPath) ? ConexaoSingle.conexao : ConexaoSingle.conexaoRemota(pPath)))
            {
                oConn.Open();
                DataTable resultado = new DataTable();
                using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM SALA_PAL.DBF WHERE ID = @ID"))//this works and creates an empty .dbf file
                {
                    cmd.Parameters.Add("@ID", OleDbType.Numeric).Value = pCodigo;
                    cmd.Connection = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        agendaEvento                 = new AgendaEvento();
                        agendaEvento.Palestrante     = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[0]["ID_PALESTR"].ToString()), pPath);
                        agendaEvento.Codigo          = int.Parse(resultado.Rows[0]["ID"].ToString());
                        agendaEvento.Sala            = new SalaDAO().BuscarPorCodigo(int.Parse(resultado.Rows[0]["ID_SALA"].ToString()), pPath);
                        agendaEvento.Data            = DateTime.Parse(resultado.Rows[0]["DATA"].ToString());
                        agendaEvento.Hora            = resultado.Rows[0]["HORA"].ToString();
                        agendaEvento.Tema            = resultado.Rows[0]["TEMA"].ToString();
                        agendaEvento.ArquivoPalestra = resultado.Rows[0]["FILENAME"].ToString();
                        //evento.Datas = this.DatasEvento();
                        return(agendaEvento);
                    }
                }
                return(agendaEvento);
            }
        }
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            AgendaEvento agendaEvento = await db.AgendaEventoes.FindAsync(id);

            db.AgendaEventoes.Remove(agendaEvento);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        public List <AgendaEvento> ListarTodos(int?pCodigoPalestrante, int?pCodigoSala, DateTime?data, string pPath)
        {
            List <AgendaEvento> agendas = new List <AgendaEvento>();
            //Sala usuario = null;
            DataTable resultado = new DataTable();

            using (OleDbConnection oConn = new OleDbConnection(String.IsNullOrEmpty(pPath) ? ConexaoSingle.conexao : ConexaoSingle.conexaoRemota(pPath)))
            {
                oConn.Open();

                using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM SALA_PAL.DBF "))
                {
                    cmd.CommandText += " where 1=1";

                    if (pCodigoPalestrante.HasValue)
                    {
                        cmd.CommandText += " AND ID_PALESTR = @PALEST";
                        cmd.Parameters.Add("@PALEST", OleDbType.Numeric).Value = pCodigoPalestrante;
                    }

                    if (pCodigoSala.HasValue)
                    {
                        cmd.CommandText += " AND ID_SALA = @SALA";
                        cmd.Parameters.Add("@SALA", OleDbType.Numeric).Value = pCodigoSala;
                    }

                    if (data.HasValue)
                    {
                        cmd.CommandText += " AND DATA = @DATA";
                        cmd.Parameters.Add("@DATA", OleDbType.Date).Value = data;
                    }

                    cmd.CommandText += " ORDER BY DATA, HORA";
                    cmd.Connection   = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        for (int i = 0; i < resultado.Rows.Count; i++)
                        {
                            AgendaEvento agendaEvento = new AgendaEvento();
                            agendaEvento.Palestrante     = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_PALESTR"].ToString()), pPath);
                            agendaEvento.Codigo          = int.Parse(resultado.Rows[i]["ID"].ToString());
                            agendaEvento.Sala            = new SalaDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_SALA"].ToString()), pPath);
                            agendaEvento.Data            = DateTime.Parse(resultado.Rows[i]["DATA"].ToString());
                            agendaEvento.Hora            = resultado.Rows[i]["HORA"].ToString();
                            agendaEvento.Tema            = resultado.Rows[i]["TEMA"].ToString();
                            agendaEvento.ArquivoPalestra = resultado.Rows[i]["FILENAME"].ToString();
                            agendas.Add(agendaEvento);
                        }
                    }
                }
            }
            return(agendas);
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Palestrante,MiniBioPalestrante,UrlSitePalestrante,TwitterPalestrante,UrlFotoPalestrante,Trilha,Titulo,Descricao,Data,HoraInicio,HoraTermino,CreatedAt,Deleted,UpdatedAt,Version")] AgendaEvento agendaEvento)
        {
            if (ModelState.IsValid)
            {
                db.Entry(agendaEvento).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(agendaEvento));
        }
        // GET: AgendaEventoes/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgendaEvento agendaEvento = await db.AgendaEventoes.FindAsync(id);

            if (agendaEvento == null)
            {
                return(HttpNotFound());
            }
            return(View(agendaEvento));
        }
Exemplo n.º 11
0
        public ActionResult CadastrarEvento(AgendaEvento model)
        {
            CultureInfo brasil = new CultureInfo("pt-BR");

            var dataStr = Request.Form["dataini"];

            model.DataIni = DateTime.Parse(dataStr, brasil);
            if (Request.Form["datafim"] != null && Request.Form["datafim"] != "")
            {
                var dataStr2 = Request.Form["datafim"];
                model.DataFim = DateTime.Parse(dataStr2, brasil);
            }

            if (model.DataIni == model.DataFim)
            {
                model.DataFim = null;
            }

            var evDateIni = BL.AgendaEvento.Get(c => c.IdDocente == model.IdDocente && c.DataIni == model.DataIni);
            var evDateFim = BL.AgendaEvento.Get(c => c.IdDocente == model.IdDocente && c.DataFim == model.DataFim);

            var getDateIni = evDateIni.ToList().Select(c => c.DataIni).FirstOrDefault();
            var getDateFim = evDateFim.ToList().Select(c => c.DataFim).FirstOrDefault();
            var isConflict = false;

            if (getDateIni.HasValue || getDateFim.HasValue)
            {
                getDateIni = getDateIni.HasValue ? getDateIni : model.DataIni;
                getDateFim = getDateFim.HasValue ? getDateFim : model.DataFim;
                isConflict = TimePeriodOverlap(model.DataIni.Value, model.DataFim.Value, getDateIni.Value, getDateFim.Value);
                if (isConflict)
                {
                    var message = "Não foi possível cadastrar evento, pois há colisão de datas.";
                    return(Json(message, JsonRequestBehavior.AllowGet));
                }
            }
            //model.TipoEvento = byte.Parse(Request.QueryString["TipoEvento"]);
            BL.AgendaEvento.Add(model);

            return(null);
        }
Exemplo n.º 12
0
        internal static AgendaEvento MapToModel(AgendaEventoViewModel item)
        {
            var docente = new AgendaEvento()
            {
                DataFim    = DateTime.Parse(item.DataFim),
                DataIni    = DateTime.Parse(item.DataIni),
                HoraIni    = DateTime.Parse(item.HoraIni),
                HoraFim    = DateTime.Parse(item.HoraFim),
                TipoEvento = byte.Parse(item.TipoEvento),
                IdDocente  = int.Parse(item.IdDocente),
                DiaSemana  = item.DiaSemana.Replace("Domingo", "0")
                             .Replace("Segunda", "1")
                             .Replace("Terca", "2")
                             .Replace("Quarta", "3")
                             .Replace("Quinta", "4")
                             .Replace("Sexta", "5")
                             .Replace("Sabado", "6").Replace(",", "").Replace(" ", "").Replace("/", ""),
            };

            return(docente);
        }
Exemplo n.º 13
0
        public AgendaEvento VerificaExistenciaEvento(int pSala, DateTime Data, string pHora, int?pCodigo)
        {
            AgendaEvento agendaEvento = null;

            using (OleDbConnection oConn = new OleDbConnection(ConexaoSingle.conexao))
            {
                oConn.Open();
                DataTable resultado = new DataTable();
                using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM SALA_PAL.DBF WHERE ID_SALA = @SALA AND DATA = @DATA_EVENTO AND HORA = @HORA"))//this works and creates an empty .dbf file
                {
                    if (pCodigo.HasValue)
                    {
                        cmd.CommandText += " AND ID <> @ID";
                        cmd.Parameters.Add("@ID", OleDbType.Numeric).Value = pCodigo.Value;
                    }

                    cmd.Parameters.Add("@SALA", OleDbType.Numeric).Value     = pSala;
                    cmd.Parameters.Add("@DATA_EVENTO", OleDbType.Date).Value = Data;
                    cmd.Parameters.Add("@HORA", OleDbType.VarChar).Value     = pHora;
                    cmd.Connection = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        agendaEvento                 = new AgendaEvento();
                        agendaEvento.Palestrante     = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[0]["ID_PALESTR"].ToString()), null);
                        agendaEvento.Codigo          = int.Parse(resultado.Rows[0]["ID"].ToString());
                        agendaEvento.Sala            = new SalaDAO().BuscarPorCodigo(pSala, null);
                        agendaEvento.Data            = DateTime.Parse(resultado.Rows[0]["DATA"].ToString());
                        agendaEvento.Hora            = pHora;
                        agendaEvento.ArquivoPalestra = resultado.Rows[0]["FILENAME"].ToString();
                        //evento.Datas = this.DatasEvento();
                        return(agendaEvento);
                    }
                }
                return(agendaEvento);
            }
        }
Exemplo n.º 14
0
        public List <AgendaEvento> BuscaAgendaPorPalestrante(int pPalestrante, string path)
        {
            List <AgendaEvento> agendas = new List <AgendaEvento>();
            //Sala usuario = null;
            DataTable resultado = new DataTable();

            using (OleDbConnection oConn = new OleDbConnection(string.IsNullOrEmpty(path) ? ConexaoSingle.conexao : ConexaoSingle.conexaoRemota(path)))
            {
                oConn.Open();

                using (OleDbCommand cmd = new OleDbCommand(" SELECT * FROM SALA_PAL.DBF "))
                {
                    cmd.CommandText += " where ID_PALESTR = @ID_PALESTR";
                    cmd.Parameters.Add("@ID_PALESTR", OleDbType.Numeric).Value = pPalestrante;
                    cmd.Connection = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        for (int i = 0; i < resultado.Rows.Count; i++)
                        {
                            AgendaEvento agendaEvento = new AgendaEvento();
                            agendaEvento.Palestrante     = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_PALESTR"].ToString()), path);
                            agendaEvento.Codigo          = int.Parse(resultado.Rows[i]["ID"].ToString());
                            agendaEvento.Sala            = new SalaDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_SALA"].ToString()), path);
                            agendaEvento.Data            = DateTime.Parse(resultado.Rows[i]["DATA"].ToString());
                            agendaEvento.Hora            = resultado.Rows[i]["HORA"].ToString();
                            agendaEvento.Tema            = resultado.Rows[i]["TEMA"].ToString();
                            agendaEvento.ArquivoPalestra = resultado.Rows[i]["FILENAME"].ToString();
                            agendas.Add(agendaEvento);
                        }
                    }
                }
            }
            return(agendas);
        }