コード例 #1
0
 private void btn_Eliminar_Click(object sender, EventArgs e)
 {
     if (txt_idOpe.Text != "")//sirve para elmininar datos de la tabla
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("DELETE FROM TBL_Operacion WHERE idTBL_Operacion = {0}", txt_idOpe.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             int         ban = cmd.ExecuteNonQuery();
             if (ban == 1)
             {
                 MessageBox.Show("Operacion eliminada", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 actualizar();
             }
             else
             {
                 MessageBox.Show("Operacion no encontrada", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             txt_idOpe.Text = "";
             txt_idOpe.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("Escriba una operacion", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txt_idOpe.Focus();
     }
 }
コード例 #2
0
 private void btn_Ingresar_Click(object sender, EventArgs e)
 {
     if (txt_idOpe.Text != "" && txtnom.Text != "" && txtdes.Text != "")//ingresa campos a la tabla
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO TBL_Operacion VALUES({0}, '{1}','{2}'); ", txt_idOpe.Text, txtnom.Text, txtdes.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             txt_idOpe.Text = "";
             txtnom.Text    = "";
             txtdes.Text    = "";
             MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #3
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
 private void btn_Editar_Click(object sender, EventArgs e)
 {
     if (Cmb_Area.Text != "" && cmbProc.Text != "" && cmbEst.Text != "" && cmbP.Text != "" && dtp_inicio.Text != "" && dtp_final.Text != "")//proceso que edita la tabla en si
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("UPDATE  TBL_Insercion_empleado_proceso SET  TBL_Estado_proceso_idTBL_Estado_proceso ={0}, TBL_Estado_idTBL_Estado = {1}, TBL_Proceso_idTBL_Proceso = {2} ,Fecha_inicio = '{3}',Fecha_final_contemplada= '{4}'WHERE TBL_Empleado_idTBL_Empleado ={5}", cmbProc.Text, cmbEst.Text, cmbP.Text, dtp_inicio.Text, dtp_final.Text, Cmb_Area.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             cmbProc.SelectedIndex  = -1;
             cmbEst.SelectedIndex   = -1;
             cmbP.SelectedIndex     = -1;
             txtemp.Text            = "";
             txtproc.Text           = "";
             txtproce.Text          = "";
             txt_InAp.Text          = "";
             txt_InNom.Text         = "";
             Cmb_Area.SelectedIndex = -1;
             actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #4
0
 private void btn_Editar_Click(object sender, EventArgs e)
 {
     if (txt_idOpe.Text != "" && txtnom.Text != "" && txtdes.Text != "")//proceso que edita la tabla en si
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             txt_idOpe.ReadOnly = true;
             string      sql = string.Format("UPDATE TBL_Operacion SET Nombre_operacion = '{0}', Descripcion = '{1}'WHERE idTBL_Operacion = {2}", txtnom.Text, txtdes.Text, txt_idOpe.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txt_idOpe.Text = "";
             txtnom.Text    = "";
             txtdes.Text    = "";
             actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #5
0
 private void btn_Editar_Click(object sender, EventArgs e)
 {
     if (txt_idProc.Text != "" && txtnom.Text != "" && txtdes.Text != "" && cmbRec.Text != "")//proceso que edita la tabla en si
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("UPDATE TBL_Proceso SET TBL_Operacion_idTBL_Operacion = {0}, Nombre_proceso= '{1}', Descripcion='{2}', pk_id_receta_materia={3} WHERE idTBL_Proceso = {4}", txtid.Text, txtnom.Text, txtdes.Text, cmbRec.Text, txt_idProc.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             MessageBox.Show("ACTUALIZADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtid.Text           = "";
             txt_idProc.Text      = "";
             txtnom.Text          = "";
             txtdes.Text          = "";
             cmbRec.SelectedIndex = -1;
             actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #6
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
 private void btn_Ingresar_Click(object sender, EventArgs e)
 {
     if (Cmb_Area.Text != "" && cmbProc.Text != "" && cmbEst.Text != "" && cmbP.Text != "" && dtp_inicio.Text != "" && dtp_final.Text != "")//ingresa campos a la tabla
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("INSERT INTO TBL_Insercion_empleado_proceso VALUES({0},{1},{2},{3},'{4}','{5}'); ", Cmb_Area.Text, cmbProc.Text, cmbEst.Text, cmbP.Text, dtp_inicio.Text, dtp_final.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             cmd.ExecuteNonQuery();
             Cmb_Area.SelectedIndex = -1;
             txtemp.Text            = "";
             txtproc.Text           = "";
             txtproce.Text          = "";
             txt_InAp.Text          = "";
             txt_InNom.Text         = "";
             cmbProc.SelectedIndex  = -1;
             cmbEst.SelectedIndex   = -1;
             cmbP.SelectedIndex     = -1;
             dtp_inicio.Text        = "";
             dtp_final.Text         = "";
             MessageBox.Show("GUARDADO!", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("COMPLETE TODOS LOS CAMPOS!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #7
0
        private void actualizar()//carga los datos de la tabla al datagrid
        {
            OdbcConnection conexion = CapaDatos.getDB();

            try
            {
                string         sql    = string.Format("SELECT idTBL_Operacion,Nombre_operacion,Descripcion from TBL_Operacion");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                dgv_ingreso.Rows.Clear();
                while (reader.Read())
                {
                    dgv_ingreso.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
コード例 #8
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
        private void actualizar()//carga los datos de la tabla al datagrid
        {
            OdbcConnection conexion = CapaDatos.getDB();

            try
            {
                string         sql    = string.Format("SELECT TBL_Empleado_idTBL_Empleado, TBL_Estado_proceso_idTBL_Estado_proceso, TBL_Estado_idTBL_Estado, TBL_Proceso_idTBL_Proceso, Fecha_inicio, Fecha_final_contemplada from TBL_Insercion_empleado_proceso;");
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                dgv_ingreso.Rows.Clear();
                while (reader.Read())
                {
                    dgv_ingreso.Rows.Add(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            conexion.Close();
        }
コード例 #9
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
 private void btn_Eliminar_Click(object sender, EventArgs e)
 {
     if (Cmb_Area.Text != "")//sirve para elmininar datos de la tabla
     {
         OdbcConnection conexion = CapaDatos.getDB();
         try
         {
             string      sql = string.Format("DELETE FROM  TBL_Insercion_empleado_proceso WHERE TBL_Empleado_idTBL_Empleado = {0}", Cmb_Area.Text);
             OdbcCommand cmd = new OdbcCommand(sql, conexion);
             int         ban = cmd.ExecuteNonQuery();
             if (ban == 1)
             {
                 MessageBox.Show("Ingreso eliminado", "MENSAJE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 actualizar();
                 Cmb_Area.SelectedIndex = -1;
                 txtemp.Text            = "";
                 txtproc.Text           = "";
                 txtproce.Text          = "";
                 txt_InAp.Text          = "";
                 txt_InNom.Text         = "";
             }
             else
             {
                 MessageBox.Show("Ingreso no encontrado", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             Cmb_Area.SelectedIndex = -1;
             Cmb_Area.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         conexion.Close();
     }
     else
     {
         MessageBox.Show("Seleccione un Ingreso", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Cmb_Area.Focus();
     }
 }
コード例 #10
0
        public void Receta_designada()
        {
            OdbcConnection conecction = CapaDatos.getDB();

            try
            {
                string         Query  = string.Format("SELECT PK_Receta_Detalle FROM TBL_Receta_Detalle;");
                OdbcCommand    cmd    = new OdbcCommand(Query, conecction);
                OdbcDataReader reader = cmd.ExecuteReader();
                cmbRec.SelectedIndex = -1;
                cmbRec.Items.Clear();
                while (reader.Read())
                {
                    cmbRec.Items.Add(reader.GetString(0));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conecction.Close();
        }
コード例 #11
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
 public void Empleado_()//carga el appelido a un textbox desde la eleccion del combobox
 {
     if (Cmb_Area.SelectedIndex != -1)
     {
         OdbcConnection conecction = CapaDatos.getDB();
         try
         {
             string         Query  = string.Format("SELECT Apellido FROM tbl_empleados WHERE ID_Empleado={0};", Cmb_Area.Text);
             OdbcCommand    cmd    = new OdbcCommand(Query, conecction);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 txt_InAp.Text = reader.GetString(0);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         conecction.Close();
     }
 }
コード例 #12
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
        public void Id()//carga el ID del empleado al combobox
        {
            OdbcConnection conecction = CapaDatos.getDB();

            try
            {
                string         Query  = string.Format("SELECT ID_Empleado FROM tbl_empleados;");
                OdbcCommand    cmd    = new OdbcCommand(Query, conecction);
                OdbcDataReader reader = cmd.ExecuteReader();
                Cmb_Area.SelectedIndex = -1;
                Cmb_Area.Items.Clear();
                while (reader.Read())
                {
                    Cmb_Area.Items.Add(reader.GetString(0));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conecction.Close();
        }
コード例 #13
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
 public void Procesos_()//carga el proceso de eleccion del combobox
 {
     if (Cmb_Area.SelectedIndex != -1)
     {
         OdbcConnection conecction = CapaDatos.getDB();
         try
         {
             string         Query  = string.Format("SELECT Nombre_proceso FROM TBL_Proceso WHERE idTBL_Proceso={0};", cmbP.Text);
             OdbcCommand    cmd    = new OdbcCommand(Query, conecction);
             OdbcDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
             {
                 txtproce.Text = reader.GetString(0);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         conecction.Close();
     }
 }
コード例 #14
0
ファイル: Ingreso.cs プロジェクト: estuardoPerez/Produccion
        public void Estado_emp()//carga el id del estado del empleado a un combobox
        {
            OdbcConnection conecction = CapaDatos.getDB();

            try
            {
                string         Query  = string.Format("SELECT idTBL_Estado FROM TBL_Estado_empleado");
                OdbcCommand    cmd    = new OdbcCommand(Query, conecction);
                OdbcDataReader reader = cmd.ExecuteReader();
                cmbEst.SelectedIndex = -1;
                cmbEst.Items.Clear();
                while (reader.Read())
                {
                    cmbEst.Items.Add(reader.GetString(0));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conecction.Close();
        }