//ACTUALIZAR public void actualizarDetalleFormulario(int indice, DETALLE_FORMULARIO detalleFormulario) { using (TransactionScope transaction = new TransactionScope()) { var objDetalleFormulario = modeloEntidades.DETALLE_FORMULARIO.Where(qq => qq.IDDETFORM == indice).Single(); modeloEntidades.Entry(objDetalleFormulario).CurrentValues.SetValues(detalleFormulario); modeloEntidades.SaveChanges(); transaction.Complete(); } }
//INSERTAR public void insertarDetalleFormulario(DETALLE_FORMULARIO detalleFormulario) { using (TransactionScope transaction = new TransactionScope()) { using (modeloEntidades) { modeloEntidades.DETALLE_FORMULARIO.Add(detalleFormulario); modeloEntidades.SaveChanges(); transaction.Complete(); } } }
private void addListaDetalleFormulario(DETALLE_FORMULARIO detalle) { DataGridViewRow tempRow = new DataGridViewRow(); //ID DataGridViewCell cellTransporte = new DataGridViewTextBoxCell(); cellTransporte.Value = detalle.NOMBRETRANSPORTE; tempRow.Cells.Add(cellTransporte); //NOMBRE TIPO_TRANSPORTE tipo = (new clsTipoTransporteBLL()).buscarConId(Convert.ToInt32(detalle.IDTIPOTRANSPORTE)); DataGridViewCell cellTipoTrans = new DataGridViewTextBoxCell(); cellTipoTrans.Value = tipo.TIPOTRANSPORTE; tempRow.Cells.Add(cellTipoTrans); //Ruta RUTA ruta = (new clsRutaBLL()).buscarConId(Convert.ToInt32(detalle.IDRUTA)); DataGridViewCell cellRuta = new DataGridViewTextBoxCell(); cellRuta.Value = ruta.RUTACOMPLETA; tempRow.Cells.Add(cellRuta); //NIVEL DataGridViewCell cellSalida = new DataGridViewTextBoxCell(); cellSalida.Value = detalle.SALIDATRANSPORTE; tempRow.Cells.Add(cellSalida); //NIVEL DataGridViewCell cellLlegada = new DataGridViewTextBoxCell(); cellLlegada.Value = detalle.LLEGADATRANSPORTE; tempRow.Cells.Add(cellLlegada); //NIVEL DataGridViewCell cellMonto = new DataGridViewTextBoxCell(); cellMonto.Value = detalle.MONTOTRANSPORTE; tempRow.Cells.Add(cellMonto); tempRow.Tag = detalle.IDDETFORM; dtgTransporte.Rows.Add(tempRow); }