private void actualizar() { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT * FROM HORARIO;"); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); dataGridView2.Rows.Clear(); while (reader.Read()) { dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1)); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }
private void actualizar() { 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;"); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); dataGridView2.Rows.Clear(); while (reader.Read()) { 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)); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }
private void actualizar() { 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;"); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); dataGridView2.Rows.Clear(); while (reader.Read()) { dataGridView2.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6)); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); }
private void button7_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox6.Text != "" && textBox8.Text != "" && comboBox2.Text != "" && comboBox5.Text != "" && comboBox6.Text != "" && textBox10.Text != "" && textBox12.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.SelectedIndex, 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 = ""; textBox10.Enabled = false; textBox10.Text = ""; textBox12.Enabled = false; textBox12.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; button8.Enabled = false; button11.Enabled = false; pictureBox6.Image = null; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } else { MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Btn_gestionAceptar_Click(object sender, EventArgs e) { if (Txt_gestionUsuario.Text != "" && Txt_gestionPass.Text != "" && Cmb_gestionPrivilegios.Text != "") { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT USU_USUARIO FROM USUARIO WHERE USU_USUARIO = '{0}'", Txt_gestionUsuario.Text); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { conexion.Close(); conexion = TaquillaDB.getDB(); int nivel = Cmb_gestionPrivilegios.SelectedIndex; sql = string.Format("INSERT INTO USUARIO VALUES('{0}','{1}',{2});", Txt_gestionUsuario.Text, Txt_gestionPass.Text, nivel); cmd = new OdbcCommand(sql, conexion); cmd.ExecuteNonQuery(); Txt_gestionUsuario.Text = ""; Txt_gestionPass.Text = ""; Cmb_gestionPrivilegios.SelectedIndex = -1; MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } 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); } }
private void button10_Click(object sender, EventArgs e) { if (textBox3.Text != "") { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT * FROM FORMATO WHERE ID_FORMATO = {0}", textBox3.Text); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { textBox1.Enabled = true; textBox6.Enabled = true; textBox3.Enabled = false; button10.Enabled = false; button2.Enabled = false; button7.Enabled = true; button6.Enabled = true; textBox1.Text = reader.GetString(1); textBox6.Text = reader.GetString(2); } else { MessageBox.Show("FORMATO NO ENCONTRADO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } conexion.Close(); } else { MessageBox.Show("ESCRIBA ID FORMATO!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox3.Focus(); } }
private void consulta() { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT NOMBRE_CINE FROM CINE;"); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); comboBox1.Items.Clear(); while (reader.Read()) { comboBox1.Items.Add(reader.GetString(0)); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); this.Close(); } conexion.Close(); }
private void Btn_formatoAceptar_Click(object sender, EventArgs e) { if (textBox2.Text != "" && textBox5.Text != "") { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT ID_FORMATO FROM FORMATO WHERE DESCRIPCION_FORMATO = '{0}'", textBox2.Text); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { conexion.Close(); conexion = TaquillaDB.getDB(); sql = string.Format("INSERT INTO FORMATO VALUES(NULL, '{0}',{1});", textBox2.Text, textBox5.Text); cmd = new OdbcCommand(sql, conexion); cmd.ExecuteNonQuery(); textBox2.Text = ""; textBox5.Text = ""; textBox2.Focus(); MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } 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); } }
private void formato() { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("SELECT DESCRIPCION_EXPERIENCIA FROM EXPERIENCIA ;"); OdbcCommand cmd = new OdbcCommand(sql, conexion); OdbcDataReader reader = cmd.ExecuteReader(); comboBox2.Items.Clear(); comboBox3.Items.Clear(); while (reader.Read()) { comboBox2.Items.Add(reader.GetString(0)); comboBox3.Items.Add(reader.GetString(0)); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); this.Close(); } conexion.Close(); }
private void button7_Click(object sender, EventArgs e) { if (comboBox2.Text != "" && comboBox5.Text != "" && comboBox6.Text != "" && comboBox9.Text != "" && comboBox10.Text != "") { OdbcConnection conexion = TaquillaDB.getDB(); try { string sql = string.Format("UPDATE FUNCION SET ID_PELICULA = (SELECT ID_PELICULA FROM PELICULA WHERE NOMBRE_PELICULA = '{0}'), FECHA_FUNCION = '{1}', ID_SUBTITULADO = (SELECT ID_SUBTITULADO FROM SUBTITULADO WHERE DESCRIPCION_SUBTITULADO = '{2}'), ID_IDIOMA = (SELECT ID_IDIOMA FROM IDIOMA WHERE DESCRIPCION_IDIOMA = '{3}'), ID_HORARIO = (SELECT ID_HORARIO FROM HORARIO WHERE DESCRIPCION_HORARIO = '{4}'), ID_SALA = {5}, ID_FORMATO = (SELECT ID_FORMATO FROM FORMATO WHERE DESCRIPCION_FORMATO = '{6}') WHERE ID_FUNCION = {7}", comboBox2.Text, dateTimePicker2.Text, comboBox10.Text, comboBox9.Text, comboBox6.Text, comboBox5.Text, comboBox12.Text, textBox3.Text); OdbcCommand cmd = new OdbcCommand(sql, conexion); cmd.ExecuteNonQuery(); MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dateTimePicker2.Enabled = false; dateTimePicker2.Value = DateTime.Now; 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; comboBox12.Enabled = false; comboBox12.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); } }
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(); bool[] privilegios = new bool[4]; if (reader.Read()) { conexion.Close(); conexion = TaquillaDB.getDB(); sql = string.Format("SELECT INSERT_USUARIO, SELECT_USUARIO, UPDATE_USUARIO, DELETE_USUARIO 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()) { privilegios[0] = Convert.ToBoolean(reader.GetInt32(0)); privilegios[1] = Convert.ToBoolean(reader.GetInt32(1)); privilegios[2] = Convert.ToBoolean(reader.GetInt32(2)); privilegios[3] = Convert.ToBoolean(reader.GetInt32(3)); if (privilegios[0] || privilegios[1] || privilegios[2] || privilegios[3]) { 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 = ""; Txt_loginUser.Focus(); frm_menu nuevo = new frm_menu(this, privilegios); this.Hide(); nuevo.Show(); cnx.Close(); } 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(); }