/// <summary>
        /// Evalúa la nueva selección en el grid de Eventos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvEventos_SelectionChanged(object sender, EventArgs e)
        {
            dgvMercados.Rows.Clear();
            id = (int)dgvEventos.CurrentRow.Cells[2].Value;
            Evento seleccionado = EventoDAO.GetEventoById(id);

            if (seleccionado == null)
            {
                tbSeleccionado.Text  = "";
                tbSeleccionado2.Text = "";
            }
            else
            {
                tbSeleccionado.Text  = "PARTIDO: " + seleccionado.Local + " - " + seleccionado.Visitante + "\r\n" + "ID EVENTO: " + seleccionado.ID.ToString();
                tbSeleccionado2.Text = "PARTIDO: " + seleccionado.Local + " - " + seleccionado.Visitante + " ----- ID EVENTO: " + seleccionado.ID.ToString();

                List <Mercado> mercados = MercadoDAO.GetMercadosByEventoId(id);
                if (mercados.Count != 0)
                {
                    dgvMercados.Visible = true;
                    foreach (Mercado m in mercados)
                    {
                        apuestas = ApuestaDAO.GetByMercado(m.ID);
                        dgvMercados.Rows.Add(m.ID, m.Tipo, m.CuotaOver, m.CuotaUnder, m.DineroOver, m.DineroUnder, apuestas.Count, m.ID_Evento);
                    }
                }
                else
                {
                    tbMercadoSeleccionado.Text = "";
                }
            }
        }
Beispiel #2
0
        protected void btnDesatribuir_Click(object sender, EventArgs e)
        {
            int atv      = SequencialAtividade_Evento(ddwTipoVoluntario.DataValueField, Convert.ToInt32(Session["evento"]));
            int varRet   = 0;
            int coutRows = grwVolAtr.Rows.Count;

            for (int i = 0; i < coutRows; i++)
            {
                CheckBox chk    = (CheckBox)grwVolAtr.Rows[i].FindControl("CheckBox2");
                Label    lblCpf = (Label)grwVolAtr.Rows[i].FindControl("Label1");
                if (chk.Checked)
                {
                    EventoDAO oEdv = new EventoDAO();
                    int       aux  = oEdv.desatribuirVolutarioEvento(lblCpf.Text, atv.ToString());
                    if (aux == 1)
                    {
                        varRet++;
                    }
                }
            }

            if (varRet > 0)
            {
                Response.Write(string.Format("<script>alert('Foram desatribuidos {0} voluntários a este evento ');window.location = 'atribuicaoVol.aspx';</script>", varRet));
            }
        }
Beispiel #3
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            MemoryStream mstream = new MemoryStream();

            pcbEvento.Image.Save(mstream, pcbEvento.Image.RawFormat);
            byte[] img = mstream.ToArray();

            evento.nome          = txtNome.Text;
            evento.endereco      = txtEndereco.Text;
            evento.dataHora      = Convert.ToDateTime(txtDataHora.Text);
            evento.valorIngresso = Double.Parse(txtValorIngresso.Text);
            evento.imgEvent      = img;

            EventoDAO dao = new EventoDAO();

            dao.update(evento);

            MessageBox.Show("Evento alterado com sucesso", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (loadEventos != null)
            {
                loadEventos();
            }

            this.Hide();
        }
Beispiel #4
0
        public FormEvento()
        {
            InitializeComponent();
            //var form = (Home2)Tag;
            //form.Show();
            //Close();
            panelBanner.Width = this.Width;

            //panelBanner.BackgroundImage = Image.FromFile("d:\\teste.jpg");
            //Verifica se já existe evento
            if (System.IO.File.Exists(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)))
            {
                //pictureBox1.Image = Resize(new Bitmap(evento.PathFile), pictureBox1.Width, pictureBox1.Height);
                panelBanner.BackgroundImage = Helper.Resize(new Bitmap(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)), panelBanner.Width, panelBanner.Height);
            }

            Evento evento = new EventoDAO().VerificaExistenciaEvento();

            if (evento != null) // Se for edição
            {
                tbxNomeEvento.Text = evento.Nome;
                //tbxFileName.Text = evento.PathFile;

                this.ID = evento.Codigo;
                foreach (DateTime data in evento.Datas)
                {
                    listBox1.Items.Add(data.ToString("dd/MM/yyyy"));
                }
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            Evento evento;
            EventoDAO eventoDAO = new EventoDAO();
            evento = eventoDAO.Buscar(textBox1.Text);

            try
            {
                using (OracleCommand Comando = new OracleCommand())
                {
                    Comando.Connection = ConexaoBD.Conectar();
                    Comando.CommandType = System.Data.CommandType.Text;
                    Comando.CommandText = "SELECT ID_EVENTO, NOME, DATA_INICIO, DATA_FIM, LOCAL, ID_RESPONSAVEL FROM EVENTO WHERE ID_EVENTO = :idevento";
                    Comando.Parameters.Add(":idevento", OracleType.Number).Value = OracleNumber.Parse(textBox1.Text);

                    OracleDataReader leitor = Comando.ExecuteReader();
                    while (leitor.HasRows)
                    {
                        leitor.Read();

                        leitor.NextResult();
                    }

                }
            }
            catch (OracleException ex) {
                MessageBox.Show(ex.Message);
            }
        }
        public ActionResult AlteraEvento(Evento obj)
        {
            EventoDAO dao = new EventoDAO();

            dao.altera(obj);
            return(RedirectToAction("frmBuscaEvento"));
        }
Beispiel #7
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tbxNomeEvento.Text))
            {
                MessageBox.Show("Nome do evento é obrigatório");
                return;
            }

            //if (String.IsNullOrEmpty(tbxFileName.Text))
            //{
            //    MessageBox.Show("Banner é obrigatório");
            //    return;
            //}

            if (this.RetornaDatasInformadas().Count == 0)
            {
                MessageBox.Show("Informe uma data para o evento");
                return;
            }

            Evento evento = new EventoDAO().VerificaExistenciaEvento();

            if (evento == null)
            {
                evento = new Evento();
            }
            evento.Nome = tbxNomeEvento.Text;
            //evento.Arquivo = openFileDialog1.SafeFileName;
            evento.Datas = RetornaDatasInformadas();
            new EventoDAO().SalvarEvento(evento.Nome, evento.Datas);
            MensagemSucesso("Dados Salvos com sucesso");
        }
        private void FormInfo_Load(object sender, EventArgs e)
        {
            //Pega todos os eventos e verifica o ano deles
            EventoDAO dao = new EventoDAO();

            List <string> anos = new List <string>();

            foreach (Evento evento in dao.Select())
            {
                string ano = evento.Data_Inicio.Substring(6);
                MessageBox.Show("Ano: " + ano);

                bool igual = false;

                foreach (string a in anos)
                {
                    //Percorre a lista de anos e se tiver algum igual nao adiciona
                    if (a.Equals(ano))
                    {
                        igual = true;
                    }
                }

                if (!igual)
                {
                    anos.Add(ano);
                }
            }

            cbAno.Items.AddRange(anos.ToArray());
            cbEvento.Items.AddRange(dao.Select().ToArray());
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EventoDAO oEvd = new EventoDAO();
            Evento    oEv  = new Evento();

            oEv = oEvd.BuscarEventoCod(Convert.ToString(Session["evento"]));
            if (!oEv.Equals(null))
            {
                //CarregaDropDownList(oEv.iCodEvento);
                txtNomeEvento.Text = oEv.sNomeEvento;
                DateTime dateInicio = new DateTime();
                DateTime.TryParse(oEv.sDataInicio, out dateInicio);
                DateTime dateFim = new DateTime();
                DateTime.TryParse(oEv.sDataFim, out dateFim);
                txtDTinico.Text = dateInicio.ToString("yyyy-MM-dd");
                txtDtFim.Text   = dateFim.ToString("yyyy-MM-dd");
                lblCodEve.Text  = Convert.ToString(oEv.iCodEvento);
                string codAtv = ddwTipoVoluntario.DataValueField;
                SqlDataSource1.SelectCommand = string.Format("SELECT V.CPF,V.PRIMEIRO_NOME +' '+V.ULTIMO_NOME AS 'VOLUNTÁRIO' , TV.NOME_TIPO_VOLUNTARIO FROM VOLUNTARIO V, TIPO_VOLUNTARIO TV, ATIVIDADE A, TIPO_VOLUNTARIO_x_ATIVIDADE TVA WHERE V.TIPO_VOLUNTARIO = TV.COD_TIPO_VOLUNTARIO AND V.CPF NOT IN(SELECT V.CPF FROM VOLUNTARIO V, EVENTO E, VOLUNTARIO_x_ATIVIDADE_x_EVENTO VAE, ATIVIDADE_x_EVENTO AE, ATIVIDADE A WHERE V.CPF = VAE.VOLUNTARIO AND VAE.ATIVIDADE_x_EVENTO = AE.SEQUENCIAL AND AE.ATIVIDADE = A.COD_ATIVIDADE AND E.COD_EVENTO = AE.EVENTO AND E.COD_EVENTO = {0} AND A.COD_ATIVIDADE = {1}) AND TVA.ATIVIDADE = A.COD_ATIVIDADE AND TVA.TIPO_VOLUNTARIO = TV.COD_TIPO_VOLUNTARIO AND A.COD_ATIVIDADE = {1}", oEv.iCodEvento, codAtv);
                SqlDataSource2.SelectCommand = string.Format("SELECT V.CPF,V.PRIMEIRO_NOME +' '+V.ULTIMO_NOME AS 'VOLUNTÁRIO' , TV.NOME_TIPO_VOLUNTARIO FROM VOLUNTARIO V, TIPO_VOLUNTARIO TV, VOLUNTARIO_x_ATIVIDADE_x_EVENTO VAE, ATIVIDADE A, EVENTO E, ATIVIDADE_x_EVENTO AE WHERE V.TIPO_VOLUNTARIO = TV.COD_TIPO_VOLUNTARIO AND VAE.VOLUNTARIO = V.CPF AND VAE.ATIVIDADE_x_EVENTO = AE.SEQUENCIAL AND AE.ATIVIDADE = A.COD_ATIVIDADE AND AE.EVENTO = E.COD_EVENTO AND E.COD_EVENTO = {0} AND A.COD_ATIVIDADE = {1}", oEv.iCodEvento, codAtv);
                SqlDataSource3.SelectCommand = string.Format("SELECT V.CPF, V.PRIMEIRO_NOME + ' ' + V.ULTIMO_NOME AS 'VOLUNTÁRIO', TV.NOME_TIPO_VOLUNTARIO FROM VOLUNTARIO V, TIPO_VOLUNTARIO TV, VOLUNTARIO_x_ATIVIDADE_x_EVENTO VAE, ATIVIDADE A, EVENTO E, ATIVIDADE_x_EVENTO AE WHERE V.TIPO_VOLUNTARIO = TV.COD_TIPO_VOLUNTARIO AND VAE.VOLUNTARIO = V.CPF AND VAE.ATIVIDADE_x_EVENTO = AE.SEQUENCIAL AND AE.ATIVIDADE = A.COD_ATIVIDADE AND AE.EVENTO = E.COD_EVENTO AND E.COD_EVENTO = {0} AND A.COD_ATIVIDADE = {1}", oEv.iCodEvento, codAtv);
                SqlDataSource4.SelectCommand = string.Format("SELECT A.COD_ATIVIDADE, A.NOME_ATIVIDADE, A.QTD_VOLUNTARIOS, A.QTD_MINUTOS, A.STATUS FROM ATIVIDADE A, EVENTO E, ATIVIDADE_x_EVENTO AE WHERE A.COD_ATIVIDADE = AE.ATIVIDADE AND E.COD_EVENTO = AE.EVENTO AND A.STATUS <> 'I' AND COD_EVENTO = {0} ", oEv.iCodEvento);
                CarregaDropDownListCordenador();
                //CarregaGridVolunDisponiveis(oEv.iCodEvento, ddwTipoVoluntario.DataValueField);
                //CarregaGridVolunAtribuidos(oEv.iCodEvento, ddwTipoVoluntario.DataValueField);
            }
            else
            {
                Response.Write(string.Format("<script>alert('Evento {0} não carregado');</script>", Convert.ToString(Session["evento"])));
            }
        }
        public ActionResult frmBuscaEvento()
        {
            EventoDAO eventoDAO = new EventoDAO();

            ViewBag.lstEvento = eventoDAO.busca();
            return(View());
        }
        /// <summary>
        /// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public ActionResult CadastraEvento(Evento obj)
        {
            EventoDAO dao = new EventoDAO();

            dao.cadastraEvento(obj);
            return(RedirectToAction("frmBuscaEvento"));
        }
        public ActionResult Cadastrar(int?Categorias, HttpPostedFileBase fupImagem, Evento evento)
        {
            evento.Data = DateTime.Now;

            ViewBag.Categorias = new SelectList(CategoriaEventoDAO.RetornarCategoriasEvento(), "CategoriaId", "Descricao");
            //Validação das anotações que foram definidas no modelo
            if (ModelState.IsValid)
            {
                evento.CategoriaEvento = CategoriaEventoDAO.BuscarCatEventoPorId(Categorias);
                if (fupImagem != null)
                {
                    string caminho = System.IO.Path.Combine(Server.MapPath("~/Images/"), fupImagem.FileName);
                    fupImagem.SaveAs(caminho);
                    evento.Imagem = fupImagem.FileName;
                }
                else
                {
                    evento.Imagem = "semimg.jpeg";
                }
                if (EventoDAO.CadastrarEvento(evento))
                {
                    return(RedirectToAction("Index", "Evento"));
                }
                //ModelState.AddModelError("", "Não é possível adicionar um evento com a mesma descrição!");
                return(View(evento));
            }
            return(View(evento));
        }
Beispiel #13
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            EventoDAO  dao1 = new EventoDAO();
            ConviteDAO dao2 = new ConviteDAO();

            foreach (Evento evento in dao1.Select())
            {
                foreach (Convite convite in dao2.Select())
                {
                    if (convite.IdEvento == evento.Id)
                    {
                        if (convite.Email.Equals(tbEmail.Text))
                        {
                            this.EVENTO = evento;
                            temEvento   = true;
                        }
                    }
                }
            }

            if (temEvento)
            {
                //Abre tela evento
                Form form = new FormConfirmacao(EVENTO);
                form.Show();
            }
        }
        public void Atualizar(int idEvento, EventoModelView eventoModelView)
        {
            var _eventoDAO = new EventoDAO();
            var evento     = _eventoDAO.ObterPorId(idEvento);

            evento = PrepararEvento(eventoModelView, evento);
            _eventoDAO.Atualizar(evento);
        }
        /// <summary>
        /// Abre el formulario para editar un evento concreto
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditarEvento_Click(object sender, EventArgs e)
        {
            Evento       evento  = EventoDAO.GetEventoById(id);
            UpdateEvento newForm = new UpdateEvento(evento);

            newForm.ShowDialog(this);
            FillData();
        }
        public ActionResult Alterar(Evento evento)
        {
            Evento e = EventoDAO.BuscarEventoPorId(evento.EventoId);

            e.Descricao = evento.Descricao;
            EventoDAO.AlterarEvento(evento);
            return(RedirectToAction("Index", "Evento"));
        }
Beispiel #17
0
        public void Atualizar(int id, EventoModelView eventoModelView)
        {
            var eventoDao = new EventoDAO();
            var evento    = eventoDao.ObterPorId(id);

            evento = PrepararEvento(eventoModelView, evento);
            eventoDao.Atualizar(evento);
        }
        public void Inserir(EventoModelView eventoModelView)
        {
            var evento     = new Event();
            var _eventoDAO = new EventoDAO();

            evento = PrepararEvento(eventoModelView, evento);
            _eventoDAO.Inserir(evento);
        }
 public static EventoDAO GetEventoDAO()
 {
     if (eventoDAO == null)
     {
         eventoDAO = new EventoDAO();
     }
     return(eventoDAO);
 }
 protected void btnSalvar_Click(object sender, EventArgs e)
 {
     if (operacao == 1)
     {
         bool bObrPreenchidos = validaObrigatorio();
         if (bObrPreenchidos != true)
         {
             lblAlerta.Text    = "Campos obrigatorios não foram preenchidos, para continuar, preencha todos os campos obrigatorios.";
             lblAlerta.Visible = true;
         }
         else
         {
             bool bExisteEvento = validaSeExiste();
             if (bExisteEvento != true)
             {
                 bool bDataConsistente = validaConsisData();
                 if (bDataConsistente == true)
                 {
                     EventoDAO oEvd   = new EventoDAO();
                     bool      auxRet = oEvd.inserirEvento(txtNomeEvento.Text, txtDataInicio.Text, txtDataFim.Text, Convert.ToInt32(ddlTipoEvento.Text), txtEndereco.Text);
                     if (auxRet == true)
                     {
                         Response.Write(string.Format("<script>alert('Cadastro Efetuado.');</script>"));
                         string        strCmd = string.Format("select COD_EVENTO from EVENTO where NOME_EVENTO = '{0}'", txtNomeEvento.Text);
                         SqlDataReader dr1    = SqlDB.Instancia.FazerSelect(strCmd);
                         if (dr1.HasRows)
                         {
                             Session["evento"] = Convert.ToString(dr1["COD_EVENTO"]);
                             dr1.Close();
                         }
                     }
                 }
                 else
                 {
                     Response.Write("<script>alert('Cadastro não efetuado, data de fim menor que a data de inicio ou data de inicio anterior a data atual.');</script>");
                 }
             }
             else
             {
                 Response.Write("<script>alert('Cadastro não efetuado, já existe um evento com o mesmo nome.');</script>");
             }
         }
     }
     else
     {
         string strCmd = string.Format("UPDATE EVENTO SET DATA_INICIO = '{0}', DATA_FIM = '{1}', ENDERECO = '{2}' WHERE NOME_EVENTO = '{3}'", txtDataInicio.Text, txtDataFim.Text, txtEndereco.Text, txtNomeEvento.Text);
         int    ret    = SqlDB.Instancia.FazerUpdate(strCmd);
         if (ret > 0)
         {
             Response.Write(string.Format("<script>alert('Cadastro Efetuado');</script>"));
         }
         else
         {
             Response.Write("<script>alert('Alteração não Efetuada.');</script>");
         }
     }
 }
Beispiel #21
0
        public JsonResult GetAll()
        {
            var jsonData = new
            {
                data = EventoDAO.GetData(allData: false)
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Evento    oEv  = new Evento();
            EventoDAO oEvd = new EventoDAO();

            oEv = oEvd.BuscarEventoCod(Convert.ToString(Session["evento"]));
            txt_decla_evento.Text = oEv.sNomeEvento;
            lblCod.Text           = Convert.ToString(oEv.iCodEvento);
        }
Beispiel #23
0
 /// <summary>
 /// Constructor del formulario.
 /// Se configuran de los selectores de fecha y hora
 /// </summary>
 public AddEvento()
 {
     InitializeComponent();
     tbId.Text              = (EventoDAO.SelectMaxId() + 1).ToString();
     dtimeDia.MinDate       = DateTime.Now;
     dtimeHora.CustomFormat = "HH:mm";
     dtimeHora.Format       = DateTimePickerFormat.Custom;
     dtimeHora.ShowUpDown   = true;
     tbId.Enabled           = false;
 }
 /// <summary>
 /// Actualiza el grid de Eventos
 /// </summary>
 private void FillData()
 {
     eventos = EventoDAO.GetAll();
     dgvEventos.Rows.Clear();
     foreach (Evento e in eventos)
     {
         string partido = e.Local + " - " + e.Visitante;
         dgvEventos.Rows.Add(partido, e.Fecha, e.ID);
     }
 }
        public void Inserir(EventosModelView eventoModelView)
        {
            var evento = new Evento();

            evento = PrepararEvento(eventoModelView, evento);

            var eventoDao = new EventoDAO();

            eventoDao.Inserir(evento);
        }
Beispiel #26
0
 public bool RegistrarEvento(Evento objEvento)
 {
     try
     {
         return(EventoDAO.getInstance().RegistrarEvento(objEvento));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #27
0
 public List <Cliente> ListaCliente()
 {
     try
     {
         return(EventoDAO.getInstance().ListaCliente());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #28
0
 public void InserirEventoMultiplo(Evento evento)
 {
     try
     {
         EventoDAO dao = new EventoDAO();
         dao.InserirEventoMultiplo(evento);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #29
0
        public List <Evento> BuscarTodosEventos()
        {
            try
            {
                EventoDAO dao = new EventoDAO();

                return(dao.BuscarTodosEventos());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #30
0
        public JsonResult Get(int EventoId)
        {
            Evento evento = EventoDAO.GetData(EventoId, Estatus: true, allData: true).FirstOrDefault();

            Session["sessionEvento"] = evento;
            //var LTag = new List<Tag>(TagDAO.GetTagsByAlbum(album.AlbumId));
            var a = new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { Datos = evento /*, Tags = LTag */ }
            };

            return(a);
        }
Beispiel #31
0
        /// <summary>
        /// Sale del formulario
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSalir_Click(object sender, EventArgs e)
        {
            string fecha = EstructuracionFecha();

            if (OriginalFechaString != fecha || OriginalLocal != tbLocalUpdate.Text || OriginalVisitante != tbVisitanteUpdate.Text || OriginalGolesLocal != tbGolesLocal.Text || OriginalGolesVisitante != tbGolesVisitante.Text)
            {
                DialogResult res = MessageBox.Show("¿Quieres guardar los cambios realizados?", "Confirmación edición evento", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (res == DialogResult.Yes)
                {
                    Evento evento = new Evento(Int32.Parse(tbIdUpdate.Text), DateTime.Parse(fecha), tbLocalUpdate.Text, Int32.Parse(tbGolesLocal.Text), tbVisitanteUpdate.Text, Int32.Parse(tbGolesVisitante.Text));
                    EventoDAO.Update(evento);
                }
            }
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int id = int.Parse(textBox6.Text);
                string nome = textBox1.Text;
                string data_inicio = (textBox2.Text);
                string data_fim = (textBox3.Text);
                string local = textBox4.Text;
                int id_responsavel = int.Parse(textBox5.Text);

                Evento Evento = new Evento(id, nome, data_inicio, data_fim, local, id_responsavel);

                EventoDAO EventoDAO = new EventoDAO();

                EventoDAO.Incluir(Evento);

                MessageBox.Show("Evento cadastrado com sucesso!");
            }
            catch (OracleException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                Evento Evento;
                EventoDAO EventoDAO = new EventoDAO();
                Evento = EventoDAO.Buscar(textBox6.Text);
                textBox1.Text = Evento.Nome;
                textBox2.Text = Evento.Data_inicio;
                textBox3.Text = Evento.Data_fim;
                textBox4.Text = Evento.Local;
                textBox5.Text = Evento.Id_responsavel.ToString();
            }

            catch (Exception E)

            {
                MessageBox.Show("Esse ID não está cadastrado, verifique!");
            }
        }