示例#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
        public void cargarData()
        {
            if (cmb_sedeDestino.SelectedIndex != 1)
            {
                dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCombobox();
            }
            else if (cmb_sedeDestino.SelectedIndex != 1)
            {
                dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarDirFinal();
            }

            //dgv_mostrar.Rows.Add("Direccion");
        }
示例#3
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";*/
        }
示例#4
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();
        }
示例#5
0
        private void dgv_mostrar_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int bandera = 1;

            if (btn_Aceptar.Enabled == false)
            {
                txt_existencia.Text         = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[1].Value.ToString());
                txt_codigoEnvio.Enabled     = true;
                Txt_DirInicial.Enabled      = true;
                txt_inicioTraslado.Enabled  = true;
                cmb_sedeDestino.Enabled     = true;
                cmb_Placa.Enabled           = true;
                cmb_direccionFinal.Enabled  = true;
                btn_Actualizar.Enabled      = false;
                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";
            }
            else
            {
                txt_codigoEnvio.Text    = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[0].Value.ToString());
                txt_inicioTraslado.Text = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[1].Value.ToString());
                Txt_DirInicial.Text     = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[2].Value.ToString());
                cmb_sedeDestino.Text    = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[3].Value.ToString());
                cmb_direccionFinal.Text = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[4].Value.ToString());
                cmb_Placa.Text          = Convert.ToString(dgv_mostrar.Rows[e.RowIndex].Cells[5].Value.ToString());
                //txt_codigoEnvio.Enabled = false;

                this.btn_continuar.Enabled = false;
                //btn_Guardar.Enabled = true;
                //dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarDirFinal();
            }
        }
示例#6
0
 private void btn_Guardar_Click(object sender, EventArgs e)
 {
     //string ConnStr = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=bdcolchoneria;uid=willi;pwd=1234";
     if (txt_codigoTraslado.Text == "" || txt_Descripcion.Text == "" || txt_TotalProductos.Text == "" || cmb_CodigoProducto.SelectedIndex == -1 || cmb_CodigoEnvio.SelectedIndex == -1)
     {
         MessageBox.Show("llene todos los campos");
     }
     else
     {
         try
         {
             OdbcConnection con = new OdbcConnection(ConnStr);
             OdbcCommand    cmd = new OdbcCommand("insert into TBL_Detalle_Envio values ('" + txt_codigoTraslado.Text + "', '" + txt_Descripcion.Text + "', '" + txt_TotalProductos.Text + "', '" + cmb_CodigoProducto.Text.ToString() + "', '" + cmb_CodigoEnvio.Text.ToString() + "')", con);
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
             dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarDetalle();
         } catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         cpg.Accion("Insertar", "5710_Traslado de Productos");
     }
 }
示例#7
0
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCombobox();
 }
示例#8
0
 private void cmb_CodigoEnvio_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCodEnvio();
 }
示例#9
0
 private void cmb_Placa_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarPlaca();
 }
示例#10
0
 private void cmb_direccionFinal_SelectedIndexChanged(object sender, EventArgs e)
 {
     dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarDirFinal();
 }