private void Examinar(EstadoBarraEnum unEstadoBarra = EstadoBarraEnum.EXAMINANDO) { try { if (this.tabLista.Visible) { //CargarCombos(); //this.objetoLocal = OrdenPedidoPr.Instancia.RegistroPorId((int)ValorCelda("id")); //this.objetoLocal = (ordenpedido)this.dgrLista.CurrentRow.DataBoundItem.ObjetoBLV(); this.objetoLocal = (ordenpedido)this.dgrLista.CurrentRow.DataBoundItem; this._conveniosPagos1.IdentificadorPago = this.objetoLocal.fkidentificadorespago; } if (this.objetoLocal == null) { throw new Exception("El actual registro fue modificado, anulado o eliminado\npor favor verifique"); } else { this.idRegistro = this.objetoLocal.id; } CargarCampos(); //GestionOpciones(); this.GestionBarra(unEstadoBarra); } catch (Exception ex) { General.Mensaje(ex.Message); } }
public void Eliminar() { if (this._txtIdRO.Text != "0") { if (MessageBox.Show("Esta seguro de anular el registro ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { this.objetoLocal = new ordenpedido() { id = (int)ValorCelda("id") }; OrdenPedidoPr.Instancia.Borrar(this.objetoLocal); this.Actualizar(); } } }
public void Nuevo() { this.raiseEvent = true; this.objetoLocal = new ordenpedido(); this.objetoLocal.fkusuario = General.usuarioActivo.fkusuario; this.objetoLocal.fkdetallesordenespedido = new List <detalleordenpedido>(); this.objetoLocal.fkdetallesordenespedido.CargarGrid(this._dgrFKDetallesOrdenesPedido); this.GestionBarra(EstadoBarraEnum.EDITANDO); General.LimpiarControles(this.listaControles); this.CargarControlesAdicionales(); //CargarCombos(); //this._txtIdentificacionSN.Focus(); //this._cboTipoPersona.Focus(); this.raiseEvent = false; //this.editando = true; }
private void OrdenesPedido_FormClosing(object sender, FormClosingEventArgs e) { DialogResult resultado = VerificaCambios(); switch (resultado) { case DialogResult.Cancel: e.Cancel = true; break; case DialogResult.Yes: this.Guardar(); break; } if (!e.Cancel) { this.objetoLocal = null; } }
public int Grabar(ordenpedido item) { int i = 0; using (ispDB db = new ispDB()) { try { db.BeginTransaction(); PagoPr.Instancia.Grabar(item.fkidentificadorespago.fkconveniospago); if (item.id == 0) { item.id = db.ordenespedidos.Max(x => x.id); item.id++; } i = db.InsertOrReplace(item); db.detallesordenespedidos.Where(x => x.idordenpedido == item.id).Delete(); for (int ix = 0; ix < item.fkdetallesordenespedido.Count(); ix++) { detalleordenpedido detalle = item.fkdetallesordenespedido.ElementAt(ix); if (detalle.idordenpedido == 0) { detalle.idordenpedido = item.id; } } db.BulkCopy(item.fkdetallesordenespedido); db.CommitTransaction(); } catch (Exception) { db.RollbackTransaction(); throw; } } return(i); }
public int Borrar(ordenpedido item) { item.esanulado = true; return(item.BorrarObjetoT()); }