public void EditarPesaje(Pesaje objPesaje) { BDParacasEntities context = new BDParacasEntities(); Pesaje objPesajeOri = context.Pesaje.FirstOrDefault(X => X.PesajeId == objPesaje.PesajeId); // creo que no se edita context.SaveChanges(); }
private void btnRegistrar_Click(object sender, EventArgs e) { if (!ValidarComponentes()) return; if (MessageBox.Show("¿Está seguro de registrar un Pesaje?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (chkHabRegCont.Checked) { ContenedorBC objContenedorBC = new ContenedorBC(); Contenedor objContenedor = new Contenedor(); objContenedor.Codigo = txtExpNumContenedor.Text.ToUpper(); objContenedor.Embarcadero = txtExpEmbarcadero.Text.ToUpper(); objContenedor.PesoManifiesto = Convert.ToDecimal(txtExpPesoManifiesto.Text.ToString()); objContenedor.AgenteAduana = txtExpAgenteAduanas.Text; objContenedor.Autorizacion = Convert.ToInt32(txtExpReserva.Text.ToString()); objContenedor.TipoMovimiento = "EXP"; objContenedor.Tara = Convert.ToDecimal(txtExpTara.Text.ToString()); objContenedor.TamanoContenedorId = Convert.ToInt32(cbTamanio.SelectedValue.ToString()); objContenedor.TipoContenedorId = Convert.ToInt32(cbTipoContenedor.SelectedValue.ToString()); objContenedor.NumeroViaje = txtExpNumViaje.Text; objContenedor.EIR = txtExpEIR.Text; objContenedor.Estado = 1; objContenedor.PrecintoAduanero = txtExpPrecintoAduanero.Text; objContenedor.Precinto1 = txtExpPrecinto1.Text; objContenedor.Precinto2 = txtExpPrecinto2.Text; objContenedor.Precinto3 = txtExpPrecinto3.Text; objContenedor.Ubicacion = txtExpUbicacion.Text.ToUpper(); objContenedor.NaveId = NaveId; objContenedor.Fecha = DateTime.Now; objContenedor.FechaIzaje = dtpExpIzajeFec.Value.Date + dtpExpIzajeHor.Value.TimeOfDay; objContenedor.FechaBarco = dtpExpBarcoFec.Value.Date + dtpExpBarcoHor.Value.TimeOfDay; objContenedor.FechaMuelle = dtpExpMuelleFec.Value.Date + dtpExpMuelleHor.Value.TimeOfDay; objContenedorBC.RegistrarContenedor(objContenedor); } PesajeBC objPesajeBC = new PesajeBC(); Pesaje objPesaje = new Pesaje(); objPesaje.UsuarioId = UsuarioId; objPesaje.ConductorId = ConductorId; objPesaje.VehiculoId = VehiculoId; objPesaje.AutorizacionId = AutorizacionId; objPesaje.Observacion = txtObservacion.Text.Trim().ToUpper(); objPesaje.Fecha = DateTime.Today; objPesaje.Estado = 1; objPesaje.Bruto = Convert.ToDecimal(txtPeso.Text.ToString()); objPesaje.Neto = Convert.ToDecimal(txtPesoAutorizacion.Text.ToString()); objPesaje.NaveId = NaveId; objPesaje.Tarja =Convert.ToInt32(nudTarja.Value.ToString()); objPesaje.Bultos = Convert.ToInt32(lblNroBultos.Text.ToString()); objPesaje.HoraGancho = DateTime.Now; objPesaje.CodContenedor = cbContenedor.SelectedValue.ToString(); if (txtTipo.Text == "EXPORTACION") objPesaje.Tipo = "EXP"; else objPesaje.Tipo = "IMP"; objPesajeBC.RegistrarPesaje(objPesaje); GuiaRemisionBC objGuiaRemisionBC = new GuiaRemisionBC(); PesajeId = objPesajeBC.BuscarUltimoIdPesaje(); objGuiaRemisionBC.ActualizarIdGuiaRemision(PesajeId); MessageBox.Show("Se registró satisfactoriamente el Pesaje", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); }
public void RegistrarPesaje(Pesaje objPesaje) { BDParacasEntities context = new BDParacasEntities(); context.Pesaje.Add(objPesaje); context.SaveChanges(); }