示例#1
0
        private void btn_continuar_Click(object sender, EventArgs e)
        {
            if (txt_codigoEnvio.Text == "" || Txt_DirInicial.Text == "" || txt_inicioTraslado.Text == "" || cmb_sedeDestino.SelectedIndex == -1 || cmb_direccionFinal.SelectedIndex == -1 || cmb_Placa.SelectedIndex == -1)
            {
                MessageBox.Show("llene todos los campos");
            }
            else
            {
                txt_codigoTraslado.Enabled = true;
                txt_Descripcion.Enabled    = true;
                txt_TotalProductos.Enabled = true;
                cmb_CodigoProducto.Enabled = true;
                cmb_CodigoEnvio.Enabled    = true;

                try
                {
                    OdbcConnection con = new OdbcConnection(ConnStr);
                    OdbcCommand    cmd = new OdbcCommand("insert into TBL_Envio_Encabezado values ('" + txt_codigoEnvio.Text + "', '" + txt_inicioTraslado.Text + "', '" + Txt_DirInicial.Text + "', '" + cmb_sedeDestino.Text.ToString() + "', '" + cmb_direccionFinal.Text.ToString() + "', '" + cmb_Placa.Text.ToString() + "')", con);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                } catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                cmb_CodigoProducto.DataSource  = CapaDatos_TrasladoProductos.llenarCodProducto();
                cmb_CodigoProducto.ValueMember = "PK_Codigo_Producto";
                cmb_CodigoEnvio.DataSource     = CapaDatos_TrasladoProductos.llenarCodEnvio();
                cmb_CodigoEnvio.ValueMember    = "PK_Codigo_Encabezado_Envio";

                this.btn_continuar.Enabled = false;
                btn_Guardar.Enabled        = true;
            }
        }
示例#2
0
        private void btn_editar_Click(object sender, EventArgs e)
        {
            btn_Aceptar.Enabled        = true;
            txt_codigoEnvio.Enabled    = true;
            Txt_DirInicial.Enabled     = true;
            txt_inicioTraslado.Enabled = true;
            cmb_sedeDestino.Enabled    = true;
            cmb_Placa.Enabled          = true;
            cmb_direccionFinal.Enabled = true;
            dgv_mostrar.DataSource     = CapaDatos_TrasladoProductos.llenarCodEnvio();
            btn_Actualizar.Enabled     = true;

            /* cmb_sedeDestino.DataSource = CapaDatos_TrasladoProductos.llenarCombobox();
             * cmb_sedeDestino.ValueMember = "PK_id_Sede";
             *
             * cmb_direccionFinal.DataSource = CapaDatos_TrasladoProductos.llenarDirFinal();
             * cmb_direccionFinal.ValueMember = "PK_correlativo_Destino";
             * cmb_Placa.DataSource = CapaDatos_TrasladoProductos.llenarPlaca();
             * cmb_Placa.ValueMember = "PK_id_Vehiculos";*/
        }
示例#3
0
        private void btn_Actualizar_Click(object sender, EventArgs e)
        {
            btn_Actualizar.Enabled = true;
            try
            {
                OdbcConnection con = new OdbcConnection(ConnStr);
                // OdbcCommand cmd = new OdbcCommand("update TBL_Envio_Encabezado set Fecha='" + txt_inicioTraslado.Text + "', Punto_origen='" + Txt_DirInicial.Text + "', FK_id_Sede= '" + cmb_sedeDestino.Text.ToString() + "', FK_correlativo_destino='" + cmb_direccionFinal.Text.ToString() + "', FK_id_Vehiculos = '" + cmb_Placa.Text.ToString() + "' where PK_Codigo_Encabezado_Envio= '" + txt_codigoEnvio.Text + "'", con);

                OdbcCommand cmd = new OdbcCommand("update TBL_Envio_Encabezado set Fecha='" + txt_inicioTraslado.Text + "', Punto_origen='" + Txt_DirInicial.Text + "', FK_id_Sede= '" + cmb_sedeDestino.Text.ToString() + "', FK_correlativo_destino='" + cmb_direccionFinal.Text.ToString() + "', FK_id_Vehiculos= '" + cmb_Placa.Text.ToString() + "' where PK_Codigo_Encabezado_Envio= '" + txt_codigoEnvio.Text + "'", con);


                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCodEnvio();
        }
示例#4
0
 private void cmb_CodigoEnvio_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCodEnvio();
 }