Esempio n. 1
0
        private void actualizar()
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT P.ESTADO_PELICULA, P.ID_PELICULA, P.NOMBRE_PELICULA, P.SINOPSIS_PELICULA, C.DESCRIPCION_CLASIFICACION, G.DESCRIPCION_GENERO, P.DURACION_PELICULA FROM PELICULA P, CLASIFICACION C, GENERO G WHERE P.ID_CLASIFICACION = C.ID_CLASIFICACION AND P.ID_GENERO = G.ID_GENERO;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                dataGridView2.Rows.Clear();
                while (reader.Read())
                {
                    if (reader.GetInt32(0) == 0)
                    {
                        dataGridView2.Rows.Add(reader.GetString(1), reader.GetString(2), "ESTRENADA", reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6));
                    }
                    else
                    {
                        dataGridView2.Rows.Add(reader.GetString(1), reader.GetString(2), "PROXIMO ESTRENO", reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
Esempio n. 2
0
 private void Btn_formatoAceptar_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox5.Text != "" && comboBox1.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO CINE VALUES(NULL, '{0}', '{1}', (SELECT ID_DEPARTAMENTO FROM DEPARTAMENTO WHERE NOMBRE_DEPARTAMENTO = '{2}')); ", textBox2.Text, textBox5.Text, comboBox1.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             textBox2.Text           = "";
             textBox5.Text           = "";
             comboBox1.SelectedIndex = -1;
             textBox2.Focus();
             MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 3
0
 private void Btn_formatoAceptar_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox5.Text != "" && textBox7.Text != "" && comboBox1.Text != "" && comboBox3.Text != "" && comboBox4.Text != "" && textBox9.Text != "" && textBox11.Text != "" && pictureBox5.Image != null)
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO PELICULA VALUES (NULL, '{0}', {1}, '{2}', (SELECT ID_CLASIFICACION FROM CLASIFICACION WHERE DESCRIPCION_CLASIFICACION = '{3}'), (SELECT ID_GENERO FROM GENERO WHERE DESCRIPCION_GENERO = '{4}'), '{5}', '{6}', '{7}');", textBox2.Text, comboBox1.SelectedIndex, textBox5.Text, comboBox3.Text, comboBox4.Text, textBox7.Text, textBox9.Text, textBox11.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             if (cmd.ExecuteNonQuery() == 1)
             {
                 textBox2.Text           = "";
                 textBox5.Text           = "";
                 textBox7.Text           = "";
                 textBox9.Text           = "";
                 textBox11.Text          = "";
                 comboBox1.SelectedIndex = -1;
                 comboBox3.SelectedIndex = -1;
                 comboBox4.SelectedIndex = -1;
                 pictureBox5.Image       = null;
                 textBox2.Focus();
                 MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox6.Text != "" && textBox6.Text != "" && comboBox4.Text != "" && comboBox2.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("UPDATE SALA SET FILAS_SALA = {0}, COLUMNAS_SALA = {1}, ID_CINE = (SELECT ID_CINE FROM CINE WHERE NOMBRE_CINE = '{2}'), ID_EXPERIENCIA = (SELECT ID_EXPERIENCIA FROM EXPERIENCIA WHERE DESCRIPCION_EXPERIENCIA = '{3}'), NUMERO_SALA = '{4}' WHERE ID_SALA = {5}", textBox6.Text, textBox1.Text, comboBox4.Text, comboBox2.Text, textBox8.Text, textBox3.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             textBox1.Enabled        = false; textBox1.Text = "";
             textBox6.Enabled        = false; textBox6.Text = "";
             textBox3.Enabled        = true; textBox3.Text = "";
             textBox8.Enabled        = false; textBox8.Text = "";
             textBox4.Text           = "";
             comboBox2.SelectedIndex = -1; comboBox2.Enabled = false;
             comboBox4.SelectedIndex = -1; comboBox4.Enabled = false;
             button10.Enabled        = true;
             button2.Enabled         = true;
             button7.Enabled         = false;
             button6.Enabled         = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = '{0}'", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Usuario no encontrado!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("Escriba nombre de usuario!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
 private void Btn_formatoAceptar_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text != "" && comboBox3.Text != "" && comboBox8.Text != "" && comboBox4.Text != "" && comboBox7.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO FUNCION VALUES (NULL, (SELECT ID_PELICULA FROM PELICULA WHERE NOMBRE_PELICULA = '{0}'), '{1}', (SELECT ID_SUBTITULADO FROM SUBTITULADO WHERE DESCRIPCION_SUBTITULADO = '{2}'), (SELECT ID_IDIOMA FROM IDIOMA WHERE DESCRIPCION_IDIOMA = '{3}'), (SELECT ID_HORARIO FROM HORARIO WHERE DESCRIPCION_HORARIO = '{4}'), {5}, (SELECT ID_FORMATO FROM FORMATO WHERE DESCRIPCION_FORMATO = '{6}')); ", comboBox8.Text, dateTimePicker1.Text, comboBox1.Text, comboBox3.Text, comboBox4.Text, comboBox7.Text, comboBox11.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             dateTimePicker1.Value    = DateTime.Now;
             comboBox1.SelectedIndex  = -1;
             comboBox3.SelectedIndex  = -1;
             comboBox4.SelectedIndex  = -1;
             comboBox8.SelectedIndex  = -1;
             comboBox7.SelectedIndex  = -1;
             comboBox11.SelectedIndex = -1;
             comboBox8.Focus();
             MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 7
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT * FROM HORARIO WHERE ID_HORARIO = {0}", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("HORARIO NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN HORARIO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox6.Text != "" && textBox8.Text != "" && comboBox2.Text != "" && comboBox5.Text != "" && comboBox6.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("UPDATE PELICULA SET NOMBRE_PELICULA = '{0}', ESTADO_PELICULA = '{1}', SINOPSIS_PELICULA = '{2}', ID_CLASIFICACION = (SELECT ID_CLASIFICACION FROM CLASIFICACION WHERE DESCRIPCION_CLASIFICACION = '{3}'), ID_GENERO = (SELECT ID_GENERO FROM GENERO  WHERE DESCRIPCION_GENERO = '{4}'), DURACION_PELICULA = '{5}' WHERE ID_PELICULA = {6}", textBox8.Text, comboBox6.Text, textBox6.Text, comboBox5.Text, comboBox2.Text, textBox1.Text, textBox3.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             textBox1.Enabled        = false; textBox1.Text = "";
             textBox6.Enabled        = false; textBox6.Text = "";
             textBox8.Enabled        = false; textBox8.Text = "";
             textBox3.Enabled        = true; textBox3.Text = "";
             textBox4.Text           = "";
             comboBox2.SelectedIndex = -1; comboBox2.Enabled = false;
             comboBox5.SelectedIndex = -1; comboBox5.Enabled = false;
             comboBox6.SelectedIndex = -1; comboBox6.Enabled = false;
             button10.Enabled        = true;
             button2.Enabled         = true;
             button7.Enabled         = false;
             button6.Enabled         = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 9
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT C.ID_CINE, C.NOMBRE_CINE, C.DIRECCION_CINE, D.NOMBRE_DEPARTAMENTO FROM CINE C, DEPARTAMENTO D WHERE D.ID_DEPARTAMENTO = C.ID_DEPARTAMENTO AND ID_CINE = '{0}'", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("CINE NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID CINE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
Esempio n. 10
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox6.Text != "" && comboBox2.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("UPDATE CINE SET NOMBRE_CINE = '{0}', DIRECCION_CINE = '{1}', ID_DEPARTAMENTO = (SELECT ID_DEPARTAMENTO FROM DEPARTAMENTO WHERE NOMBRE_DEPARTAMENTO = '{2}') WHERE ID_CINE = {3}", textBox1.Text, textBox6.Text, comboBox2.Text, textBox3.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             textBox1.Enabled        = false; textBox1.Text = "";
             textBox6.Enabled        = false; textBox6.Text = "";
             textBox3.Enabled        = true; textBox3.Text = "";
             textBox4.Text           = "";
             comboBox2.SelectedIndex = -1; comboBox2.Enabled = false;
             button10.Enabled        = true;
             button2.Enabled         = true;
             button7.Enabled         = false;
             button6.Enabled         = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 11
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT P.ID_PELICULA, P.NOMBRE_PELICULA, P.ESTADO_PELICULA, P.SINOPSIS_PELICULA, C.DESCRIPCION_CLASIFICACION, G.DESCRIPCION_GENERO, P.DURACION_PELICULA FROM PELICULA P, CLASIFICACION C, GENERO G WHERE P.ID_CLASIFICACION = C.ID_CLASIFICACION AND P.ID_GENERO = G.ID_GENERO AND ID_PELICULA = {0}", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("PELICULA NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID PELICULA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
Esempio n. 12
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("DELETE FROM CINE WHERE ID_CINE = '{0}'", textBox4.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             int         ban = cmd.ExecuteNonQuery();
             if (ban == 1)
             {
                 MessageBox.Show("CINE ELIMINADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 actualizar();
             }
             else
             {
                 MessageBox.Show("CINE NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Text = "";
             textBox3.Text = "";
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID CINE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
Esempio n. 13
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && comboBox2.Text != "" && comboBox5.Text != "" && comboBox6.Text != "" && comboBox9.Text != "" && comboBox10.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("UPDATE FUNCION SET ID_PELICULA = {0}, FECHA_FUNCION = '{1}', ID_SUBTITULADO = '{2}', ID_IDIOMA = '{3}', ID_HORARIO = '{4}', ID_SALA = {5} WHERE ID_FUNCION = {6}", comboBox2.Text, textBox1.Text, comboBox10.Text, comboBox9.Text, comboBox6.Text, comboBox5.Text, textBox3.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             textBox1.Enabled        = false; textBox1.Text = "";
             textBox3.Enabled        = true; textBox3.Text = "";
             textBox4.Text           = "";
             comboBox2.SelectedIndex = -1; comboBox2.Enabled = false;
             comboBox5.SelectedIndex = -1; comboBox5.Enabled = false;
             comboBox6.SelectedIndex = -1; comboBox6.Enabled = false;
             comboBox10.Enabled      = false; comboBox10.SelectedIndex = -1;
             comboBox9.Enabled       = false; comboBox9.SelectedIndex = -1;
             button10.Enabled        = true;
             button2.Enabled         = true;
             button7.Enabled         = false;
             button6.Enabled         = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 14
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT S.ID_SALA, S.FILAS_SALA, S.COLUMNAS_SALA, C.NOMBRE_CINE, E.DESCRIPCION_EXPERIENCIA, S.NUMERO_SALA FROM SALA S, CINE C, EXPERIENCIA E WHERE S.ID_CINE = C.ID_CINE AND S.ID_EXPERIENCIA = E.ID_EXPERIENCIA AND ID_SALA = '{0}'", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("SALA NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA ID SALA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
Esempio n. 15
0
 private void Btn_formatoAceptar_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox5.Text != "" && comboBox1.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO SALA VALUES(NULL, {0}, {1}, (SELECT ID_CINE FROM CINE WHERE NOMBRE_CINE = '{2}'), (SELECT ID_EXPERIENCIA FROM EXPERIENCIA WHERE DESCRIPCION_EXPERIENCIA = '{3}'), {4});", textBox2.Text, textBox5.Text, comboBox1.Text, comboBox3.Text, textBox7.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             textBox2.Text           = "";
             textBox5.Text           = "";
             textBox7.Text           = "";
             comboBox1.SelectedIndex = -1;
             comboBox3.SelectedIndex = -1;
             textBox7.Focus();
             MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 16
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (textBox4.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT F.ID_FUNCION, P.NOMBRE_PELICULA, F.FECHA_FUNCION, S.DESCRIPCION_SUBTITULADO, I.DESCRIPCION_IDIOMA, H.DESCRIPCION_HORARIO, F.ID_SALA, FR.DESCRIPCION_FORMATO FROM FUNCION F, PELICULA P, SUBTITULADO S, IDIOMA I, HORARIO H, FORMATO FR WHERE F.ID_PELICULA = P.ID_PELICULA AND F.ID_SUBTITULADO = S.ID_SUBTITULADO AND F.ID_IDIOMA = I.ID_IDIOMA AND F.ID_HORARIO = H.ID_HORARIO AND F.ID_FORMATO = FR.ID_FORMATO AND ID_FUNCION = {0}", textBox4.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dataGridView2.Rows.Clear();
                 dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), reader.GetString(7));
                 textBox4.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("FUNCION NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             textBox4.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID FUNCION!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox4.Focus();
     }
 }
Esempio n. 17
0
        private void actualizar()
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT * FROM USUARIO;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                dataGridView2.Rows.Clear();
                while (reader.Read())
                {
                    if (reader.GetInt32(2) == 0)
                    {
                        dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), "admin [0]");
                    }
                    else
                    {
                        dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), "usuario [1]");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
Esempio n. 18
0
        private void button7_Click(object sender, EventArgs e)
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = '{0}'", Txt_loginUser.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    conexion.Close();
                    conexion = TaquillaDB.getDB();
                    sql      = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = '{0}' AND PASS_USUARIO = MD5('{1}');", Txt_loginUser.Text, Txt_loginPass.Text);
                    cmd      = new OdbcCommand(sql, conexion);
                    reader   = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        if (reader.GetInt32(2) == 0)
                        {
                            OdbcConnection cnx = TaquillaDB.getDB();
                            sql = string.Format("INSERT INTO BITACORA VALUES (NULL, 'LOG IN', NOW(), '{0}', USER());", Txt_loginUser.Text);
                            OdbcCommand cm = new OdbcCommand(sql, cnx);
                            cm.ExecuteNonQuery();
                            Txt_loginUser.Text = "";
                            Txt_loginPass.Text = "";
                            frm_main nuevo = new frm_main(this);
                            this.Hide();
                            nuevo.Show();
                        }
                        else
                        {
                            MessageBox.Show("Falta de privilegios!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Txt_loginUser.Text = "";
                            Txt_loginUser.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password incorrect!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Txt_loginPass.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Usuario no valido!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Txt_loginUser.Text = "";
                    Txt_loginUser.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            Txt_loginPass.Text      = "";
            Chk_gestionPass.Checked = false;
            conexion.Close();
        }
Esempio n. 19
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT P.ID_PELICULA, P.NOMBRE_PELICULA, P.ESTADO_PELICULA, P.SINOPSIS_PELICULA, C.DESCRIPCION_CLASIFICACION, G.DESCRIPCION_GENERO, P.DURACION_PELICULA, P.VIDEO_PELICULA, P.IMAGEN_PELICULA FROM PELICULA P, CLASIFICACION C, GENERO G WHERE P.ID_CLASIFICACION = C.ID_CLASIFICACION AND P.ID_GENERO = G.ID_GENERO AND ID_PELICULA = {0}", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 textBox1.Enabled          = true;
                 textBox6.Enabled          = true;
                 textBox8.Enabled          = true;
                 textBox10.Enabled         = true;
                 textBox12.Enabled         = true;
                 comboBox2.Enabled         = true;
                 comboBox6.Enabled         = true;
                 comboBox5.Enabled         = true;
                 textBox3.Enabled          = false;
                 button10.Enabled          = false;
                 button2.Enabled           = false;
                 button8.Enabled           = true;
                 button7.Enabled           = true;
                 button6.Enabled           = true;
                 button11.Enabled          = true;
                 textBox8.Text             = reader.GetString(1);
                 comboBox6.SelectedIndex   = reader.GetInt32(2);
                 textBox6.Text             = reader.GetString(3);
                 comboBox5.SelectedIndex   = comboBox5.FindString(reader.GetString(4));
                 comboBox2.SelectedIndex   = comboBox2.FindString(reader.GetString(5));
                 textBox1.Text             = reader.GetString(6);
                 textBox10.Text            = reader.GetString(7);
                 textBox12.Text            = reader.GetString(8);
                 pictureBox6.ImageLocation = textBox12.Text;
             }
             else
             {
                 MessageBox.Show("PELICULA NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID PELICULA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
Esempio n. 20
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT F.ID_FUNCION, P.NOMBRE_PELICULA, F.FECHA_FUNCION, S.DESCRIPCION_SUBTITULADO, I.DESCRIPCION_IDIOMA, H.DESCRIPCION_HORARIO, F.ID_SALA, FR.DESCRIPCION_FORMATO FROM FUNCION F, PELICULA P, SUBTITULADO S, IDIOMA I, HORARIO H, FORMATO FR WHERE F.ID_PELICULA = P.ID_PELICULA AND F.ID_SUBTITULADO = S.ID_SUBTITULADO AND F.ID_IDIOMA = I.ID_IDIOMA AND F.ID_HORARIO = H.ID_HORARIO AND F.ID_FORMATO = FR.ID_FORMATO AND ID_FUNCION = '{0}'", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 dateTimePicker2.Enabled  = true;
                 comboBox2.Enabled        = true;
                 comboBox10.Enabled       = true;
                 comboBox9.Enabled        = true;
                 comboBox6.Enabled        = true;
                 comboBox5.Enabled        = true;
                 comboBox12.Enabled       = true;
                 textBox3.Enabled         = false;
                 button10.Enabled         = false;
                 button2.Enabled          = false;
                 button7.Enabled          = true;
                 button6.Enabled          = true;
                 comboBox2.SelectedIndex  = comboBox2.FindString(reader.GetString(1));
                 dateTimePicker2.Value    = reader.GetDate(2);
                 comboBox10.SelectedIndex = comboBox10.FindString(reader.GetString(3));
                 comboBox9.SelectedIndex  = comboBox9.FindString(reader.GetString(4));
                 comboBox6.SelectedIndex  = comboBox6.FindString(reader.GetString(5));
                 comboBox5.SelectedIndex  = comboBox5.FindString(reader.GetString(6));
                 comboBox12.SelectedIndex = comboBox12.FindString(reader.GetString(7));
             }
             else
             {
                 MessageBox.Show("FUNCION NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID FUNCION!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
Esempio n. 21
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT USU_USUARIO FROM USUARIO WHERE USU_USUARIO = UPPER('{0}')", textBox1.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (!reader.Read() || (textBox3.Text == textBox1.Text))
             {
                 conexion.Close();
                 conexion = TaquillaDB.getDB();
                 sql      = string.Format("UPDATE USUARIO SET USU_USUARIO = UPPER('{0}'), PASS_USUARIO = MD5('{1}'), INSERT_USUARIO = {2}, SELECT_USUARIO = {3}, UPDATE_USUARIO = {4}, DELETE_USUARIO = {5} WHERE USU_USUARIO = '{6}';", textBox1.Text, textBox2.Text, Convert.ToInt32(checkBox9.Checked), Convert.ToInt32(checkBox8.Checked), Convert.ToInt32(checkBox7.Checked), Convert.ToInt32(checkBox6.Checked), textBox3.Text);
                 cmd      = new OdbcCommand(sql, conexion);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 textBox1.Enabled  = false; textBox1.Text = "";
                 textBox2.Enabled  = false; textBox2.Text = "";
                 textBox3.Enabled  = true; textBox3.Text = "";
                 textBox4.Text     = "";
                 button10.Enabled  = true;
                 button1.Enabled   = true;
                 button6.Enabled   = false;
                 button7.Enabled   = false;
                 checkBox8.Enabled = false; checkBox8.Checked = false;
                 checkBox7.Enabled = false; checkBox7.Checked = false;
                 checkBox6.Enabled = false; checkBox6.Checked = false;
                 checkBox9.Enabled = false; checkBox9.Checked = false;
                 checkBox1.Enabled = false;
             }
             else
             {
                 MessageBox.Show("USUARIO EXISTENTE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 22
0
        public void CargarGrid1()//carga la informacion del dg1
        {
            OdbcConnection conexion = TaquillaDB.getDB();
            string         sql      = string.Format("SELECT * FROM USUARIO;");
            OdbcCommand    cmd      = new OdbcCommand(sql, conexion);
            OdbcDataReader reader   = cmd.ExecuteReader();

            dataGridView1.RowHeadersVisible        = false;
            dataGridView1.AllowUserToAddRows       = false;
            dataGridView1.AllowUserToDeleteRows    = false;
            dataGridView1.AllowUserToOrderColumns  = false;
            dataGridView1.AllowUserToResizeColumns = false;
            dataGridView1.AllowUserToResizeRows    = false;
            dataGridView1.AutoResizeColumns();
            dataGridView1.BorderStyle = BorderStyle.None;
        }
Esempio n. 23
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT * FROM FUNCION WHERE ID_FUNCION = '{0}'", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 textBox1.Enabled         = true;
                 comboBox2.Enabled        = true;
                 comboBox10.Enabled       = true;
                 comboBox9.Enabled        = true;
                 comboBox6.Enabled        = true;
                 comboBox5.Enabled        = true;
                 textBox3.Enabled         = false;
                 button10.Enabled         = false;
                 button2.Enabled          = false;
                 button7.Enabled          = true;
                 button6.Enabled          = true;
                 comboBox2.SelectedIndex  = comboBox2.FindString(reader.GetString(1));
                 textBox1.Text            = reader.GetString(2);
                 comboBox10.SelectedIndex = comboBox10.FindString(reader.GetString(3));
                 comboBox9.SelectedIndex  = comboBox9.FindString(reader.GetString(4));
                 comboBox6.SelectedIndex  = comboBox6.FindString(reader.GetString(5));
                 comboBox5.SelectedIndex  = comboBox5.FindString(reader.GetString(6));
             }
             else
             {
                 MessageBox.Show("FUNCION NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN ID FUNCION!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
Esempio n. 24
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "" && comboBox1.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT USU_USUARIO FROM USUARIO WHERE USU_USUARIO = '{0}'", textBox1.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (!reader.Read() || (textBox3.Text == textBox1.Text))
             {
                 conexion.Close();
                 conexion = TaquillaDB.getDB();
                 int nivel = comboBox1.SelectedIndex;
                 sql = string.Format("UPDATE USUARIO SET USU_USUARIO = '{0}', PASS_USUARIO = '{1}', PRIVILEGIO_USUARIO = {2} WHERE USU_USUARIO = '{3}';", textBox1.Text, textBox2.Text, nivel, textBox3.Text);
                 cmd = new OdbcCommand(sql, conexion);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 textBox1.Enabled  = false; textBox1.Text = "";
                 textBox2.Enabled  = false; textBox2.Text = "";
                 textBox3.Enabled  = true; textBox3.Text = "";
                 textBox4.Text     = "";
                 button10.Enabled  = true;
                 button1.Enabled   = true;
                 button6.Enabled   = false;
                 button7.Enabled   = false;
                 comboBox1.Enabled = false; comboBox1.SelectedIndex = -1;
                 checkBox1.Enabled = false;
             }
             else
             {
                 MessageBox.Show("USUARIO EXISTENTE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 25
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT S.ID_SALA, S.FILAS_SALA, S.COLUMNAS_SALA, C.NOMBRE_CINE, E.DESCRIPCION_EXPERIENCIA, S.NUMERO_SALA FROM SALA S, CINE C, EXPERIENCIA E WHERE S.ID_CINE = C.ID_CINE AND S.ID_EXPERIENCIA = E.ID_EXPERIENCIA AND ID_SALA = '{0}'", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 textBox1.Enabled        = true;
                 textBox6.Enabled        = true;
                 textBox8.Enabled        = true;
                 comboBox2.Enabled       = true;
                 comboBox4.Enabled       = true;
                 textBox3.Enabled        = false;
                 button10.Enabled        = false;
                 button2.Enabled         = false;
                 button7.Enabled         = true;
                 button6.Enabled         = true;
                 textBox6.Text           = reader.GetString(1);
                 textBox1.Text           = reader.GetString(2);
                 comboBox4.SelectedIndex = comboBox4.FindString(reader.GetString(3));
                 comboBox2.SelectedIndex = comboBox2.FindString(reader.GetString(4));
                 textBox8.Text           = reader.GetString(5); textBox8.Focus();
             }
             else
             {
                 MessageBox.Show("SALA NO ENCONTRADA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA UN SALA!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
        /*AQUI SE GENERAN LOS REPORTES SEMANALES*/

        public void CargarGrid1()//carga la informacion del dg1
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT SUM(MONTO_PAGO_FACTURA) FROM CINE,FACTURA,SALA,FUNCION,RESERVACION WHERE CINE.ID_CINE=SALA.ID_CINE AND FUNCION.ID_SALA=SALA.ID_SALA AND RESERVACION.ID_FUNCION=FUNCION.ID_FUNCION AND RESERVACION.ID_FACTURA=FACTURA.ID_FACTURA AND FACTURA.FECHA_FACTURA BETWEEN '{0}' AND '{1}' AND CINE.NOMBRE_CINE='{2}';", dateTimePicker1.Text, dateTimePicker2.Text, comboBox1.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0));
                }
            }
            catch (Exception e) {
                MessageBox.Show("Ocurrio un error por favor verifique");
            }
        }
        /*AQUI SE GENERAN LOS REPORTES SEMANALES*/

        public void CargarGrid1()//carga la informacion del dg1
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT SUM(Q.MONTO_PAGO_FACTURA) AS GANANCIAS,C.NOMBRE_CINE FROM FACTURA AS Q, CINE AS C, SALA AS S, FUNCION AS F, RESERVACION AS R WHERE C.ID_CINE=S.ID_CINE AND F.ID_SALA=S.ID_SALA AND F.ID_FUNCION=R.ID_FUNCION AND R.ID_FACTURA=Q.ID_FACTURA AND Q.FECHA_FACTURA BETWEEN '{0}' AND '{1}' GROUP BY C.ID_CINE;", dateTimePicker1.Text, dateTimePicker2.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1));
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.ToString());
            }
        }
Esempio n. 28
0
 private void button10_Click(object sender, EventArgs e)
 {
     if (textBox3.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = UPPER('{0}')", textBox3.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 textBox1.Enabled  = true;
                 textBox2.Enabled  = true;
                 textBox3.Enabled  = false;
                 button10.Enabled  = false;
                 button6.Enabled   = true;
                 button7.Enabled   = true;
                 button1.Enabled   = false;
                 checkBox1.Enabled = true;
                 textBox1.Text     = reader.GetString(0);
                 //textBox2.Text = reader.GetString(1);
                 checkBox9.Enabled = true; checkBox9.Checked = reader.GetBoolean(2);
                 checkBox8.Enabled = true; checkBox8.Checked = reader.GetBoolean(3);
                 checkBox7.Enabled = true; checkBox7.Checked = reader.GetBoolean(4);
                 checkBox6.Enabled = true; checkBox6.Checked = reader.GetBoolean(5);
             }
             else
             {
                 MessageBox.Show("USUARIO NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("ESCRIBA NOMBRE DE USUARIO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBox3.Focus();
     }
 }
Esempio n. 29
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox6.Text != "")
     {
         OdbcConnection conexion = TaquillaDB.getDB();
         try
         {
             string         sql    = string.Format("SELECT ID_FORMATO FROM FORMATO WHERE DESCRIPCION_FORMATO = '{0}'", textBox1.Text);
             OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (!reader.Read() || (textBox3.Text == reader.GetString(0)))
             {
                 conexion.Close();
                 conexion = TaquillaDB.getDB();
                 sql      = string.Format("UPDATE FORMATO SET DESCRIPCION_FORMATO = '{0}', PRECIO_FORMATO = {1} WHERE ID_FORMATO = '{2}';", textBox1.Text, textBox6.Text, textBox3.Text);
                 cmd      = new OdbcCommand(sql, conexion);
                 cmd.ExecuteNonQuery();
                 MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 textBox1.Enabled = false; textBox1.Text = "";
                 textBox6.Enabled = false; textBox6.Text = "";
                 textBox3.Enabled = true; textBox3.Text = "";
                 textBox4.Text    = "";
                 button10.Enabled = true;
                 button2.Enabled  = true;
                 button7.Enabled  = false;
                 button6.Enabled  = false;
             }
             else
             {
                 MessageBox.Show("FORMATO EXISTENTE!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 30
0
        /*AQUI SE GENERAN LOS REPORTES SEMANALES*/

        public void CargarGrid1()//carga la informacion del dg1
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT H.DESCRIPCION_HORARIO,COUNT(*) FROM HORARIO AS H,FUNCION AS F, RESERVACION AS R, FACTURA AS Q WHERE H.ID_HORARIO=F.ID_HORARIO AND F.ID_FUNCION=R.ID_FUNCION AND R.ID_FACTURA=Q.ID_FACTURA AND Q.FECHA_FACTURA BETWEEN '{0}' AND '{1}' GROUP BY H.ID_HORARIO;", dateTimePicker2.Text, dateTimePicker1.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    dataGridView1.Rows.Add(reader.GetString(0), reader.GetString(1));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }