Exemple #1
0
 protected void OnButtonNuevo(object sender, EventArgs e)
 {
     lblMsg.Text = lblError.Text = "";
     if (!ValidarCampos())
     {
         lblError.Text = "No ha ingresado datos para crear.";
     }
     else
     {
         Teatro    daoTheter   = new Teatro();
         TeatroDto theaterInfo = new TeatroDto()
         {
             idCine                = Convert.ToInt32(listaCines.SelectedValue),
             nombreTeatro          = txtNombre.Text,
             telefono1Teatro       = txtTelefono1.Text,
             telefono2Teatro       = txtTelefono2.Text,
             telefono3Teatro       = txtTelefono3.Text,
             idMunicipioTeatro     = Convert.ToInt32(listaMunicipios.SelectedValue),
             idDepeartamentoTeatro = Convert.ToInt32(listaDepartamentos.SelectedValue),
             direccionTeatro       = txtDireccion.Text
         };
         daoTheter.crearTeatro(theaterInfo, 1);
         LimpiarControles();
         btnEliminar.Visible = btnActualizar.Visible = false;
         lblMsg.Text         = "Nuevo registro realizado con éxito.";
         CargarGridInfoData();
     }
 }
 public ManAsientoZona(Teatro teatro, Obra obra, Zona zona)
 {
     InitializeComponent();
     this.teatro = teatro;
     this.obra   = obra;
     this.zona   = zona;
 }
        private void LoadComboObra()
        {
            Teatro teatro = cboTeatro.SelectedItem as Teatro;

            cboObra.DataSource    = servicio.ListarObraTeatro(teatro.IdTeatro);
            cboObra.DisplayMember = "Nombre";
        }
Exemple #4
0
 protected void OnButtonEliminar(object sender, EventArgs e)
 {
     lblMsg.Text = lblError.Text = "";
     if (grdInfo.SelectedIndex == -1)
     {
         lblError.Text = "No ha seleccionado un registro para eliminar.";
     }
     else
     {
         Teatro    daoTheater = new Teatro();
         var       idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         TeatroDto r          = daoTheater.getTeatro(idToLocate);
         if (r != null)
         {
             try {
                 var rslt = daoTheater.crearTeatro(r, 3);
                 if (rslt == -1)
                 {
                     lblError.Text = "El registro de teatro a eliminar no se puede eliminar ya que tiene referencias en el sistema.";
                 }
                 else
                 {
                     lblMsg.Text = "Registro eliminado con éxito.";
                 }
             } catch (Exception) {
                 lblError.Text = "El registro de teatro a eliminar no se puede eliminar ya que tiene referencias en el sistema.";
             }
             CargarGridInfoData();
             LimpiarControles();
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
         }
     }
 }
Exemple #5
0
        private void EnlazarGrilla()
        {
            try
            {
                teatro = cboTeatro.SelectedItem as Teatro;
                obra   = cboObra.SelectedItem as Obra;

                if (teatro.IdTeatro > 0 && obra.IdObra > 0)
                {
                    using (IServiceTeatro servicio = Contenedor.current.Resolve <IServiceTeatro>())
                    {
                        List <Funcion> listFuncion = servicio.ListarFuncionByObraGrilla(obra.IdObra);
                        dgvFuncion.DataSource = listFuncion;

                        String[] diasNombre = new String[7] {
                            "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"
                        };

                        foreach (DataGridViewRow row in dgvFuncion.Rows)
                        {
                            int indice = Convert.ToInt32(row.Cells[3].Value);

                            String nombre = diasNombre.ElementAt(indice);

                            row.Cells[4].Value = nombre;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #6
0
        public Teatro GetById(int id)
        {
            Teatro         teatro   = null;
            string         sql      = "SELECT * FROM TH_TEATRO WHERE IdTeatro = @IdTeatro";
            OleDbParameter idTeatro = UtilDA.SetParameters("@IdTeatro", OleDbType.Integer, id);

            using (var dtr = UtilDA.ExecuteReader(cmd, CommandType.Text, sql, cnx, idTeatro))
            {
                while (dtr.Read())
                {
                    teatro = new Teatro()
                    {
                        Estado              = DataConvert.ToString(dtr["Estado"]),
                        FechaCreacion       = DataConvert.ToDateTime(dtr["FechaCrea"]),
                        FechaModificacion   = DataConvert.ToDateTime(dtr["FechaMod"]),
                        IdTeatro            = DataConvert.ToInt(dtr["IdTeatro"]),
                        Nombre              = DataConvert.ToString(dtr["Nombre"]),
                        UsuarioCreacion     = DataConvert.ToString(dtr["UserCrea"]),
                        UsuarioModificacion = DataConvert.ToString(dtr["UserMod"]),
                        frmTeatro           = DataConvert.ToString(dtr["frmTeatro"])
                    };
                }
            }
            UtilDA.Close(cnx);
            return(teatro);
        }
Exemple #7
0
 protected void OnButtonActualizar(object sender, EventArgs e)
 {
     lblMsg.Text = lblError.Text = "";
     if (!ValidarCampos())
     {
         lblError.Text = "No ha ingresado datos para actualizar.";
     }
     else
     {
         Teatro    daoTheater = new Teatro();
         var       idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
         TeatroDto r          = daoTheater.getTeatro(idToLocate);
         if (r != null)
         {
             r.idCine                = Convert.ToInt32(listaCines.SelectedValue);
             r.idMunicipioTeatro     = Convert.ToInt32(listaMunicipios.SelectedValue);
             r.idDepeartamentoTeatro = Convert.ToInt32(listaDepartamentos.SelectedValue);
             r.nombreTeatro          = txtNombre.Text;
             r.telefono1Teatro       = txtTelefono1.Text;
             r.telefono2Teatro       = txtTelefono2.Text;
             r.telefono3Teatro       = txtTelefono3.Text;
             r.direccionTeatro       = txtDireccion.Text;
             daoTheater.crearTeatro(r, 2);
             CargarGridInfoData();
             LimpiarControles();
             btnNuevo.Visible    = true;
             btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = false;
             lblMsg.Text         = "Actualización realizada con éxito.";
         }
     }
 }
Exemple #8
0
        static void Main(string[] args)
        {
            Teatro teatrin;

            teatrin            = new Teatro(13, 16, "La vaca");
            teatrin.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatrin_Reservado);
            teatrin.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatrin_Reservado1);
            teatrin.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatrin_Rechazado);

            while (true)
            {
                Console.Write("Por favor, ingrese fila: ");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Por favor, ingrese asiento: ");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);

                teatrin.ReservarAsiento(row, col);

                /*
                 * if (teatrin.EstaLibre(row, col))
                 * {
                 *      teatrin.ReservarAsiento(row, col);
                 *      Console.WriteLine("Reservado!!!");
                 * }
                 * else
                 * {
                 *      Console.WriteLine("Cagaste!!!");
                 * }
                 */
            }
        }
Exemple #9
0
        public Teatro Teatro()
        {
            string titulo, diretor, local, lotacao, duracao, classificacao, data;

            string[] elenco;

            System.Console.WriteLine("Digite o título da peça  teatro");
            titulo = Console.ReadLine();
            System.Console.WriteLine("Digite o diretor da peça de teatro");
            diretor = Console.ReadLine();
            System.Console.WriteLine(@"Digite o elenco da peça de teatro, separando cada Ator por ',' (virgula)");
            elenco = Console.ReadLine().Split(';');
            System.Console.WriteLine("Digite o local do teatro");
            local = Console.ReadLine();
            System.Console.WriteLine("Digite a duração da peça");
            duracao = Console.ReadLine();
            System.Console.WriteLine("Digite a lotação do teatro");
            lotacao = Console.ReadLine();
            System.Console.WriteLine("Digite a classificação da peça de teatro");
            classificacao = Console.ReadLine();
            System.Console.WriteLine("Digite a data da peça de teatro");
            data = Console.ReadLine();

            Teatro teatro = new Teatro(titulo, local, Convert.ToInt32(lotacao), duracao, Convert.ToInt32(classificacao), Convert.ToDateTime(data), diretor, elenco);

            return(teatro);
        }
Exemple #10
0
        public IList <Teatro> GetLista()
        {
            List <Teatro> lTeatro = new List <Teatro>();
            Teatro        teatro  = null;
            string        sql     = "SELECT * FROM TH_TEATRO";

            using (var dtr = UtilDA.ExecuteReader(cmd, CommandType.Text, sql, cnx))
            {
                while (dtr.Read())
                {
                    teatro = new Teatro()
                    {
                        Estado              = DataConvert.ToString(dtr["Estado"]),
                        FechaCreacion       = DataConvert.ToDateTime(dtr["FechaCrea"]),
                        FechaModificacion   = DataConvert.ToDateTime(dtr["FechaMod"]),
                        IdTeatro            = DataConvert.ToInt(dtr["IdTeatro"]),
                        Nombre              = DataConvert.ToString(dtr["Nombre"]),
                        UsuarioCreacion     = DataConvert.ToString(dtr["UserCrea"]),
                        UsuarioModificacion = DataConvert.ToString(dtr["UserMod"]),
                        frmTeatro           = DataConvert.ToString(dtr["frmTeatro"])
                    };
                    lTeatro.Add(teatro);
                }
            }
            UtilDA.Close(cnx);
            return(lTeatro);
        }
Exemple #11
0
        /// <summary>
        /// Loads a record for one selected grid row.
        /// </summary>
        /// <param name="sender">Objet which sends event</param>
        /// <param name="e">event parameteres</param>
        protected void OnGridInfoSelectedIndexChanged(object sender, EventArgs e)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("OnGridInfoSelectedIndexChanged Starts");
            }
            Teatro    daoTheater = new Teatro();
            var       idToLocate = Convert.ToInt32(grdInfo.DataKeys[grdInfo.SelectedIndex].Value);
            TeatroDto r          = daoTheater.getTeatro(idToLocate);

            if (r != null)
            {
                listaCines.SelectedValue         = r.idCine.ToString();
                listaMunicipios.SelectedValue    = r.idMunicipioTeatro.ToString();
                listaDepartamentos.SelectedValue = r.idDepeartamentoTeatro.ToString();
                txtNombre.Text      = r.nombreTeatro;
                txtTelefono1.Text   = r.telefono1Teatro;
                txtTelefono2.Text   = r.telefono2Teatro;
                txtTelefono3.Text   = r.telefono3Teatro;
                txtDireccion.Text   = r.direccionTeatro;
                btnNuevo.Visible    = false;
                btnEliminar.Visible = btnActualizar.Visible = btnCancelar.Visible = true;
            }
            if (log.IsDebugEnabled)
            {
                log.Debug("OnGridInfoSelectedIndexChanged Ends");
            }
        }
Exemple #12
0
        static void Main(string[] args)
        {
            Obra      obra1 = new Obra("Romeo Y Julieta", 10);
            Abonado   esp1  = new Abonado("Steven Rúa");
            Abonado   esp2  = new Abonado("Shara Montoya");
            Abonado   esp3  = new Abonado("Celeste Rúa");
            Ocasional esp4  = new Ocasional("Fabiola Jaramillo");
            Ocasional esp5  = new Ocasional("Gustavo Rúa");
            Ocasional esp6  = new Ocasional("Lucia Jaramillo");
            Ocasional esp7  = new Ocasional("Johny Rúa");

            Teatro t = new Teatro("Teatro Junin");

            Console.WriteLine(t.venderBoleta(obra1, esp1));
            Console.WriteLine(t.venderBoleta(obra1, esp2));
            Console.WriteLine(t.venderBoleta(obra1, esp3));
            Console.WriteLine(t.venderBoleta(obra1, esp4));
            Console.WriteLine(t.venderBoleta(obra1, esp5));
            Console.WriteLine(t.venderBoleta(obra1, esp6));
            Console.WriteLine(t.venderBoleta(obra1, esp7));
            Console.WriteLine(t.Cupos);

            obra1.mostrarAbonados();
            obra1.mostrarOcasionales();

            Console.ReadKey();
        }
Exemple #13
0
 private void llenarGrilla()
 {
     try {
         Teatro Teatro = cboTeFilObra.SelectedItem as Teatro;
         dgvObras.DataSource = servicio.ListarObraByTeatro(Teatro.IdTeatro);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ocurrió un error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        static void Main(string[] args)
        {

            Teatro lyceum = new Teatro("Lyceum Theatre", "21 Wellington St, Covent Garden, London WC2E 7RQ, Regno Unito");
            lyceum.AddPosto(new Posto("C", 1, "Platea"));
            lyceum.AddPosto(new Posto("A", 1, "Palco"));
            lyceum.AddPosto(new Posto("B", 1, "Loggione"));
            Compagnia disney = new Compagnia("Walt Disney Theatrical");
            Compagnia william = new Compagnia("William");
            Spettacolo lionKing = new Spettacolo("Lion King", "Musical", "The Lion King è un pluripremiato musical in due atti su libretto di Roger Allers e Irene Mecchi, diretto da Julie Taymor.", "2:00", 26.90, disney);
            Spettacolo hamlet = new Spettacolo("Hamlet", "Tragedia", "È tra le opere più frequentemente rappresentate in quasi ogni paese occidentale ed è considerata un testo cruciale per attori maturi.", "3:00", 20.50, william);
            lyceum.AddRappresentazione(new Rappresentazione(lionKing, new DateTime(2020, 03, 27), "12:30"));
            lyceum.AddRappresentazione(new Rappresentazione(hamlet, new DateTime(2020, 03, 28), "16:30"));
            disney.AddAttore(new Attore("Marco", "Jotaro", new DateTime(1999, 02, 27), "Simba"));
            william.AddAttore(new Attore("Barnette", "Orangello", new DateTime(2000, 04, 18), "Orazio"));
            Persona giulio = new Persona("Giulio", "Johannes", new DateTime(1997, 07, 21));
            Persona simone = new Persona("Simone", "Rossi", new DateTime(1995, 01, 13));
            Biglietto bigliettoGiulio = new Biglietto(giulio, lyceum.getPosto("A", 1, "Palco"),lionKing);
            Biglietto bigliettoSimone = new Biglietto(simone, lyceum.getPosto("B", 1, "Loggione"), hamlet);

            Console.Write("\n Nome teatro:\n " + lyceum.getNome() + "\n\n Indirizzo teatro:\n " + lyceum.getIndirizzo());
            Console.Write("\n\n Posti:\n");

            foreach(Posto posto in lyceum.getPosti())
            {

                Console.Write(" " + posto.getFila() + " " + posto.getNumero() + " " + posto.getTipo() + "\n");

            }

            Console.Write("\n\n Compagnia:\n " + disney.getNome());

            foreach (Attore attore in disney.getAttori())
            {

                Console.Write("\n Attori: \n Nome: " + attore.getNome() + " " + attore.getCognome() + " NATO:" + attore.getDataNascita() + " RUOLO:" + attore.getRuolo());

            }

            Console.Write("\n\n Compagnia:\n " + william.getNome());

            foreach (Attore attore in william.getAttori())
            {

                Console.Write("\n Attori: \n Nome: " + attore.getNome() + " " + attore.getCognome() + " NATO:" + attore.getDataNascita() + " RUOLO:" + attore.getRuolo());

            }

            Console.Write("\n\n Bligietti venduti:\n");
            Console.Write(" " + bigliettoGiulio.getString() + lyceum.getDataRappresentazione(lionKing) + " Prezzo: " + bigliettoGiulio.CalcolaPrezzo() + "\n");
            Console.Write(" " + bigliettoSimone.getString() + lyceum.getDataRappresentazione(hamlet) +" Prezzo: " + bigliettoSimone.CalcolaPrezzo() + "\n");

            Console.ReadKey();
        }
Exemple #15
0
        public List <Teatro> Listar()
        {
            List <Teatro> listaTeatro = teatroRepository.GetLista().ToList();
            Teatro        obj         = new Teatro()
            {
                IdTeatro = 0,
                Nombre   = "Seleccione Teatro"
            };

            listaTeatro.Insert(0, obj);
            return(listaTeatro);
        }
Exemple #16
0
        private void CargarGridInfoData()
        {
            var theaterList = new Teatro().getTeatrosEx();

            if (theaterList.Count > 0)
            {
                btnActualizar.Visible = btnEliminar.Visible = false;
            }
            grdInfo.DataSource    = theaterList;
            grdInfo.SelectedIndex = -1;
            grdInfo.DataBind();
        }
Exemple #17
0
        public bool Insert(Teatro datos)
        {
            string sql = "INSERT INTO TH_TEATRO (Estado,Nombre,FechaCrea,UserCrea,frmTeatro) " +
                         "VALUES (@Estado, @Nombre, @FechaCrea, @UserCrea,@frmTeatro)";

            OleDbParameter estado    = UtilDA.SetParameters("@Estado", OleDbType.VarChar, datos.Estado);
            OleDbParameter nombre    = UtilDA.SetParameters("@Nombre", OleDbType.VarChar, datos.Nombre);
            OleDbParameter fechaCrea = UtilDA.SetParameters("@FechaCrea", OleDbType.Date, DateTime.Now);
            OleDbParameter userCrea  = UtilDA.SetParameters("@UserCrea", OleDbType.VarChar, Sesion.usuario.Login);
            OleDbParameter frmTeatro = UtilDA.SetParameters("@frmTeatro", OleDbType.VarChar, datos.frmTeatro);

            return(UtilDA.ExecuteNonQuery(cmd, CommandType.Text, sql, cnx, false, estado, nombre, fechaCrea, userCrea, frmTeatro));
        }
Exemple #18
0
        public bool Update(Teatro datos)
        {
            string sql = "UPDATE TH_TEATRO SET Estado = @Estado, Nombre = @Nombre, FechaMod = @FechaMod," +
                         "UserMod = @UserMod, frmTeatro = @frmTeatro WHERE IdTeatro = @IdTeatro";

            OleDbParameter estado    = UtilDA.SetParameters("@Estado", OleDbType.VarChar, datos.Estado);
            OleDbParameter nombre    = UtilDA.SetParameters("@Nombre", OleDbType.VarChar, datos.Nombre);
            OleDbParameter fechaMod  = UtilDA.SetParameters("@FechaMod", OleDbType.Date, DateTime.Now);
            OleDbParameter userMod   = UtilDA.SetParameters("@UserMod", OleDbType.VarChar, Sesion.usuario.Login);
            OleDbParameter idTeatro  = UtilDA.SetParameters("@IdTeatro", OleDbType.Integer, datos.IdTeatro);
            OleDbParameter frmTeatro = UtilDA.SetParameters("@frmTeatro", OleDbType.VarChar, datos.frmTeatro);

            return(UtilDA.ExecuteNonQuery(cmd, CommandType.Text, sql, cnx, false, estado, nombre, fechaMod, userMod, frmTeatro, idTeatro));
        }
Exemple #19
0
 private void AsociarObra()
 {
     try
     {
         teatro                = cboTeatro.SelectedItem as Teatro;
         cboObra.DataSource    = servicio.ComboListarObraByTeatro(teatro.IdTeatro);
         cboObra.DisplayMember = "Nombre";
         AsociarZona();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ocurrió un error " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #20
0
 /// <summary>
 /// Event fired to create a new record
 /// </summary>
 /// <param name="sender">object which fires the event</param>
 /// <param name="e">Event arguments</param>
 protected void OnButtonNuevo(object sender, EventArgs e)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonNuevo Starts");
     }
     if (!ValidarCampos())
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("No data info supplied");
         }
         registerToastrMsg(MessageType.Error, "No ha ingresado datos para crear.");
     }
     else
     {
         Teatro    daoTheter   = new Teatro();
         TeatroDto theaterInfo = new TeatroDto()
         {
             idCine                = Convert.ToInt32(listaCines.SelectedValue),
             nombreTeatro          = txtNombre.Text,
             telefono1Teatro       = txtTelefono1.Text,
             telefono2Teatro       = txtTelefono2.Text,
             telefono3Teatro       = txtTelefono3.Text,
             idMunicipioTeatro     = Convert.ToInt32(listaMunicipios.SelectedValue),
             idDepeartamentoTeatro = Convert.ToInt32(listaDepartamentos.SelectedValue),
             direccionTeatro       = txtDireccion.Text
         };
         if (log.IsDebugEnabled)
         {
             log.Debug("Record data [" + theaterInfo.ToString() + "]");
         }
         daoTheter.crearTeatro(theaterInfo, 1);
         LimpiarControles();
         btnEliminar.Visible = btnActualizar.Visible = false;
         registerToastrMsg(MessageType.Success, "Nuevo registro realizado con éxito.");
         CargarGridInfoData();
         if (log.IsDebugEnabled)
         {
             log.Debug("New record created");
         }
     }
     if (log.IsDebugEnabled)
     {
         log.Debug("OnButtonNuevo Ends");
     }
 }
Exemple #21
0
 private void CargarObras()
 {
     try
     {
         teatro = cboTeatro.SelectedItem as Teatro;
         using (IServiceTeatro servicio = Contenedor.current.Resolve <IServiceTeatro>())
         {
             listaObra             = servicio.ListarObraTeatroCombo(teatro.IdTeatro);
             cboObra.DataSource    = listaObra;
             cboObra.DisplayMember = "Nombre";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ocurrió un error " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #22
0
        static void Main(string[] args)
        {
            var p1     = new Abonado("Diego");
            var p2     = new Ocacional("Alejo");
            var obra   = new Obra("El Señor de los Anillos", 10);
            var teatro = new Teatro("Teatro Mayor");

            teatro.VenderBoleta(obra, p1);
            teatro.VenderBoleta(obra, p2);
            teatro.VenderBoleta(obra, p2);
            teatro.VenderBoleta(obra, p2);

            obra.MostrarAbonados();
            obra.MostrarOcasional();
            Console.WriteLine($"obra.Recaudo {obra.Recaudo}");
            Console.Read();
        }
Exemple #23
0
        private async void materialRaisedButton1_Click_1(object sender, EventArgs e)
        {
            if (!isProcessing)
            {
                try
                {
                    isProcessing = true;
                    fechaObra    = dtpFechaObra.Value.Date;
                    fechaObraFin = dtpFechaObraFin.Value.Date;
                    teatro       = cboTeatro2.SelectedItem as Teatro;
                    List <DetalleReserva> lista = new List <DetalleReserva>();
                    using (IServiceTeatro servicio = Contenedor.current.Resolve <IServiceTeatro>())
                    {
                        lista = await servicio.ReporteReservasAsync(teatro.IdTeatro, fechaObra, fechaObraFin.AddDays(1).AddSeconds(-1));
                    }

                    reportViewer1.ProcessingMode = ProcessingMode.Local;

                    reportViewer1.LocalReport.DataSources.Clear();

                    ReportDataSource Reporte = new ReportDataSource("DataSetDetalleReserva", lista);

                    reportViewer1.LocalReport.DataSources.Add(Reporte);

                    //reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportPago.rdlc";

                    List <ReportParameter> parametros = new List <ReportParameter>();
                    parametros.Add(new ReportParameter("NombreTeatro", "" + teatro.Nombre));
                    parametros.Add(new ReportParameter("FechaObra", "" + fechaObra));
                    parametros.Add(new ReportParameter("FechaFin", "" + fechaObraFin));
                    //Añado parametros al reportviewer
                    this.reportViewer1.LocalReport.SetParameters(parametros);
                    reportViewer1.RefreshReport();

                    reportViewer1.Focus();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ocurrió un error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("El reporte se esta ejecutando", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void CargarObras()
 {
     teatro = metroComboBox1.SelectedItem as Teatro;
     using (IServiceTeatro servicio = Contenedor.current.Resolve <IServiceTeatro>())
     {
         try
         {
             listaObra = servicio.ListarObraTeatro(teatro.IdTeatro);
             metroComboBox2.DataSource    = listaObra;
             metroComboBox2.DisplayMember = "Nombre";
         }
         catch (Exception ex)
         {
             MessageBox.Show("Ocurrió un error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     CargarFuncion();
 }
Exemple #25
0
        /// <summary>
        /// Loads theaters in combobox
        /// </summary>
        protected void poblarTeatros()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("poblarTeatros Starts");
            }
            List <TeatroDto> listaTeatros = new Teatro().getTeatros();

            listaTeatros             = listaTeatros.OrderBy(x => x.nombreTeatro).ToList <TeatroDto>();
            lbTeatros.DataSource     = listaTeatros;
            lbTeatros.DataTextField  = "nombreTeatro";
            lbTeatros.DataValueField = "idTeatro";
            lbTeatros.DataBind();
            if (log.IsDebugEnabled)
            {
                log.Debug("poblarTeatros Ends");
            }
        }
Exemple #26
0
        /// <summary>
        /// Loads records for TEATRO in grid view.
        /// </summary>
        private void CargarGridInfoData()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("CargarGridInfoData Starts");
            }
            var theaterList = new Teatro().getTeatrosEx();

            if (theaterList.Count > 0)
            {
                btnActualizar.Visible = btnEliminar.Visible = false;
            }
            grdInfo.DataSource    = theaterList;
            grdInfo.SelectedIndex = -1;
            grdInfo.DataBind();
            if (log.IsDebugEnabled)
            {
                log.Debug("CargarGridInfoData Ends");
            }
        }
Exemple #27
0
        static void Main(string[] args)
        {
            Teatro teatro = new Teatro(13, 16, "La vaca");

            teatro.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatro_Reservado);
            teatro.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatro_Rechazado);

            Console.WriteLine(
                String.Format(
                    "Obra = {0}, espacio = {1} filas, {2} asientos",
                    teatro.Obra, teatro.Filas, teatro.Filas * teatro.AsientosPorFila));

            while (true)
            {
                Console.Write("Fila=");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Asiento=");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);

                /*
                 * bool b = teatro.EstaLibre(row, col);
                 * if (b)
                 * {
                 *      teatro.ReservarAsiento(row, col);
                 *      Console.WriteLine("Reservado.");
                 * }
                 * else
                 * {
                 *      Console.WriteLine("Ocupado.");
                 * }
                 */

                teatro.ReservarAsiento(row, col);

                //Console.WriteLine("Asientos ocupados = {0}", teatro.AsientosOcupados);
                Console.WriteLine();
            }
        }
Exemple #28
0
        private void LoadData()
        {
            try
            {
                listaTeatro             = servicio.ListarTeatros();
                cboTeatro.DataSource    = listaTeatro;
                cboTeatro.DisplayMember = "Nombre";
                cboTeatro.SelectedItem  = FindTeatro(funcion.Obra.Teatro.IdTeatro);

                teatro                = cboTeatro.SelectedItem as Teatro;
                listaObra             = servicio.ComboManGetListaTeatro(teatro.IdTeatro);
                cboObra.DataSource    = listaObra;
                cboObra.DisplayMember = "Nombre";
                cboObra.SelectedItem  = FindObra(funcion.Obra.IdObra);

                cboDia.SelectedIndex    = funcion.Dia + 1;
                cboEstado.SelectedIndex = funcion.Estado == "Activo" ? 0 : 1;
                txtHoarario.Text        = funcion.Horario;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #29
0
        static void Main(string[] args)
        {
            Teatro teatro;

            teatro            = new Teatro("La vaca", 13, 16);
            teatro.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatro_Reservado);
            teatro.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatro_Rechazado);
            while (true)
            {
                Console.Write("Fila=");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Asiento=");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);
                teatro.ReservarAsiento(row, col);
                Console.WriteLine();
            }


            //
            // TODO: Add code to start application here
            //
        }
Exemple #30
0
        public bool CargaMasiva(string path)
        {
            List <ExcelModelMasivo> lista = ExcelHelper.GetListaCargaMasiva(path);

            lista = lista.OrderBy(x => x.Telefono).ThenBy(x => x.FechaReserva).ThenByDescending(x => x.Obra).ToList();
            if (lista.Count == 0)
            {
                throw new Exception("El archivo se encuentra vacio");
            }
            List <Asiento>        listaAsientos    = new List <Asiento>();
            List <DetalleReserva> listaDetalle     = new List <DetalleReserva>();
            List <Reserva>        listaReservas    = new List <Reserva>();
            List <String>         listaPromociones = new List <string>();
            Single precio = 0;

            for (int x = 0; x < lista.Count; x++)
            {
                #region DeclararVariables

                Reserva        reserva = new Reserva();
                DetalleReserva detalle;

                #endregion

                #region CapturarAsientos


                precio += lista[x].Precio;

                if (lista[x].Nombre == null)
                {
                    throw new Exception("Nombre debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Apellidos == null)
                {
                    throw new Exception("Apellidos deben ser ingresados en la fila: " + (x + 2));
                }
                if (lista[x].Telefono == null)
                {
                    throw new Exception("Telefono debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Teatro == null)
                {
                    throw new Exception("Teatro debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].UsuarioRegistro == null)
                {
                    throw new Exception("Usuario Registro debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Zona == null)
                {
                    throw new Exception("Zona debe ser ingresada en la fila: " + (x + 2));
                }
                if (lista[x].Correo == null)
                {
                    throw new Exception("Correo debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Fila == null)
                {
                    throw new Exception("Fila debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Asiento == null)
                {
                    throw new Exception("Asiento debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Funcion == null)
                {
                    throw new Exception("Funcion debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].FechaReserva == null)
                {
                    throw new Exception("Fecha Reserva debe ser ingresado en la fila: " + (x + 2));
                }
                if (lista[x].Obra == null)
                {
                    throw new Exception("Obra Reserva debe ser ingresado en la fila: " + (x + 2));
                }


                Teatro teatro = teatroRepository.GetLista().FirstOrDefault(te => te.Nombre.ToUpper().Trim() == lista[x].Teatro.ToUpper().Trim());
                if (teatro == null)
                {
                    throw new Exception("Teatro no encontrada en la fila: " + (x + 2));
                }
                Asiento asiento = asientoRepository.GetLista().FirstOrDefault(asi => asi.Teatro.IdTeatro == teatro.IdTeatro &&
                                                                              asi.Fila == lista[x].Fila && asi.Descripcion == lista[x].Asiento);
                if (asiento == null)
                {
                    throw new Exception("Asiento no encontrado en la fila: " + (x + 2));
                }
                asiento.EstadoTemporal = lista[x].Zona;
                listaAsientos.Add(asiento);


                detalle                 = new DetalleReserva();
                detalle.Asiento         = asiento;
                detalle.NombreZona      = lista[x].Zona;
                detalle.FechaCreacion   = DateTime.Now;
                detalle.UsuarioCreacion = lista[x].UsuarioRegistro;
                detalle.Estado          = "A";
                detalle.Precio          = lista[x].Precio;
                detalle.NombreFila      = asiento.Fila;
                detalle.NombreAsiento   = asiento.Descripcion;
                if (lista[x].Promocion != null)
                {
                    detalle.NombrePromocion = lista[x].Promocion;
                    if (!listaPromociones.Contains(lista[x].Promocion))
                    {
                        listaPromociones.Add(lista[x].Promocion);
                    }
                }
                listaDetalle.Add(detalle);

                if (x < lista.Count - 1)//saltar ultima vuelta
                {
                    if (lista[x].Telefono == lista[x + 1].Telefono && lista[x].Obra == lista[x + 1].Obra && lista[x].FechaReserva == lista[x + 1].FechaReserva &&
                        lista[x].Funcion == lista[x + 1].Funcion &&
                        lista[x].Teatro == lista[x + 1].Teatro)
                    {
                        continue;
                    }
                }

                #endregion

                #region Obtener Datos Cabecera

                Cliente tempCliente = clienteRepository.GetByTelefono(lista[x].Telefono);
                if (tempCliente == null)
                {
                    Cliente newCliente = new Cliente()
                    {
                        Correo          = lista[x].Correo,
                        Nombre          = lista[x].Nombre,
                        Telefono        = lista[x].Telefono,
                        ApellidoPaterno = lista[x].Apellidos,
                        Apellidomaterno = ""
                    };
                    int idCliente = clienteRepository.GetNewIdCliente(newCliente);
                }
                else
                {
                    tempCliente.Correo          = lista[x].Correo;
                    tempCliente.Nombre          = lista[x].Nombre;
                    tempCliente.Telefono        = lista[x].Telefono;
                    tempCliente.ApellidoPaterno = lista[x].Apellidos;
                    tempCliente.Apellidomaterno = "";
                    clienteRepository.Update(tempCliente);
                }

                reserva.Cliente = tempCliente;
                reserva.Obra    = obraRepository.GetLista().FirstOrDefault(ob => ob.Nombre.ToUpper().Trim() == lista[x].Obra.ToUpper().Trim());
                if (reserva.Obra == null)
                {
                    throw new Exception("Obra no encontrada en la fila: " + (x + 2));
                }
                reserva.Funcion = funcionRepository.GetLista().FirstOrDefault(fu => fu.Horario == lista[x].Funcion && fu.Obra.IdObra == reserva.Obra.IdObra);
                if (reserva.Funcion == null)
                {
                    throw new Exception("Funcion no encontrada en la fila: " + (x + 2));
                }

                reserva.Usuario = usuarioRepository.GetLista().FirstOrDefault(us => us.Login.ToUpper().Trim() == lista[x].UsuarioRegistro.ToUpper().Trim());
                if (reserva.Usuario == null)
                {
                    throw new Exception("Usuario no encontrado en la fila: " + (x + 2));
                }

                if (!String.IsNullOrEmpty(lista[x].Empresa))
                {
                    Empresa objEmpresa = empresaRepository.GetLista().Where(tx => tx.Nombre.ToLower().Equals(lista[x].Empresa.ToLower())).FirstOrDefault();
                    if (objEmpresa == null)
                    {
                        throw new Exception("Empresa no encontrado en la fila: " + (x + 2));
                    }
                    else
                    {
                        reserva.Empresa = objEmpresa.Nombre;
                    }
                }
                else
                {
                    reserva.Empresa = "";
                }


                Reserva reservaExiste = reservaRepository.ReservaExiste(lista[x].FechaReserva, reserva.Funcion.IdFuncion, reserva.Cliente.IdCliente);
                if (reservaExiste != null)
                {
                    throw new Exception("Reserva ya se encuentra registrada en la fila: " + (x + 2));
                }


                string asientos = "";
                listaAsientos.ForEach(tx => {
                    asientos += tx.EstadoTemporal + " / " + tx.Fila + " / " + tx.Descripcion + "\n";
                });
                asientos            = asientos.Substring(0, asientos.LastIndexOf("\n"));
                reserva.Asientos    = asientos;
                reserva.PrecioTotal = precio;

                EstadoReserva estadoReserva = new EstadoReserva()
                {
                    IdEstadoReserva = 1,
                    Nombre          = "Confirmada",
                    Estado          = "A"
                };
                reserva.EstadoReserva = estadoReserva;

                reserva.FechaCreacion   = DateTime.Now;
                reserva.UsuarioCreacion = lista[x].UsuarioRegistro;
                reserva.ListaDetalles   = listaDetalle;
                reserva.FechaReserva    = lista[x].FechaReserva;
                reserva.Horario         = lista[x].Funcion;

                string promociones = "";
                listaPromociones.ForEach(tx => {
                    promociones += tx + ",";
                });

                if (promociones.IndexOf(',') != -1)
                {
                    promociones = promociones.Substring(0, promociones.LastIndexOf(','));
                }

                reserva.NombrePromocion = promociones;
                #endregion

                #region Inserts
                listaReservas.Add(reserva);
                #endregion

                #region Limpiar valores
                listaDetalle     = new List <DetalleReserva>();
                listaAsientos    = new List <Asiento>();
                listaPromociones = new List <string>();
                precio           = 0;
                #endregion
            }
            return(reservaRepository.InsertMasivo(listaReservas));
        }