示例#1
0
        public void CancelarAgregados()
        {
            try
            {
                List <int> lstAgregado = new List <int>();
                string     sql         = "SELECT ID FROM tMusicaCabecaAgregado WHERE MusicaCabecaInscritoID = " + this.Control.ID;
                bd.Consulta(sql);

                while (bd.Consulta().Read())
                {
                    lstAgregado.Add(bd.LerInt("ID"));
                }

                MusicaCabecaAgregado oAgregado = new MusicaCabecaAgregado();
                foreach (var id in lstAgregado)
                {
                    oAgregado.Excluir(id);
                }

                bd.Fechar();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                bd.Fechar();
            }
        }
        /// <summary>
        /// Exclui o item corrente da lista
        /// </summary>
        /// <returns></returns>
        public override bool Excluir()
        {
            try
            {
                bool ok = musicaCabecaAgregado.Excluir();
                if (ok)
                {
                    lista.RemoveAt(Indice);
                }

                return(ok);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public object AlterarInscricaoAgregado(int Evento, int clienteID, int AgregadoID)
        {
            try
            {
                string retorno = "Cancelar";

                MusicaCabecaAgregado oAgregado = new MusicaCabecaAgregado();
                oAgregado.Ler(Evento, AgregadoID);

                MusicaCabecaInscrito oInscrito = new MusicaCabecaInscrito();
                oInscrito.Ler(Evento, clienteID);

                if (oAgregado.Control.ID > 0)
                {
                    oAgregado.Excluir();

                    retorno = "Efetuar";
                }
                else
                {
                    oAgregado.AgregadoID.Valor             = AgregadoID;
                    oAgregado.MusicaCabecaInscritoID.Valor = oInscrito.Control.ID;
                    oAgregado.DataInscricao.Valor          = DateTime.Now;
                    oAgregado.Inserir(oInscrito.Assinante.Valor, Evento);
                }

                return(retorno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                bd.Fechar();
            }
        }