protected void cargarEstablecimientos() { string msn = ""; EstablecimientoTR tran = new EstablecimientoTR(); DataTable datos = tran.consultarEstablecimiento(ref msn); DataRow fila = datos.NewRow(); //fila["id"] = ""; fila["nombre"] = "Todos"; datos.Rows.InsertAt(fila, 0); if (datos != null) { this.cmb_establecimiento.DataSource = datos; this.cmb_establecimiento.ValueMember = "id"; this.cmb_establecimiento.DisplayMember = "nombre"; } else { Mensaje.error(msn); } this.cmb_establecimiento.Focus(); }
protected void llenarGrid(string nombre) { this.grw_establecimiento.DataBindings.Clear(); grw_establecimiento.Columns.Clear(); string mensaje = ""; EstablecimientoTR tran = new EstablecimientoTR(); DataTable datos = tran.consultarEstablecimientos(ref mensaje, nombre); if (datos != null) { this.grw_establecimiento.DataSource = datos; this.grw_establecimiento.Columns[0].Visible = false; int ancho = this.grw_establecimiento.Width - 20; this.grw_establecimiento.Columns[1].Width = Convert.ToInt16(ancho * 0.25); this.grw_establecimiento.Columns[2].Width = Convert.ToInt16(ancho * 0.74); DataGridViewButtonColumn bcol = new DataGridViewButtonColumn(); bcol.Width = 20; bcol.HeaderText = ""; bcol.Name = "botonEditar"; bcol.UseColumnTextForButtonValue = true; //grw_empleado.Columns.Insert(5, bcol); this.grw_establecimiento.Columns.Add(bcol); } else { Mensaje.error(mensaje); } }
protected void cargarEstablecimientos() { string msn = ""; EstablecimientoTR tran = new EstablecimientoTR(); DataTable datos = tran.consultarEstablecimiento(ref msn); if (datos != null) { this.cmb_establecimiento.DataSource = datos; this.cmb_establecimiento.ValueMember = "id"; this.cmb_establecimiento.DisplayMember = "nombre"; } else { Mensaje.error(msn); } this.cmb_establecimiento.Focus(); }
protected void cargarEstablecimientos() { EstablecimientoTR estb = new EstablecimientoTR(); string msn = ""; DataTable datos = estb.consultarEstablecimiento(ref msn); if (datos != null) { this.cmb_establecimiento.DataSource = datos; this.cmb_establecimiento.ValueMember = "id"; this.cmb_establecimiento.DisplayMember = "nombre"; this.cmb_establecimiento.SelectedIndex = -1; this.txt_documento.Clear(); this.txt_maquina.Text = IPGlobalProperties.GetIPGlobalProperties().HostName;; this.rd_factura.Checked = true; } else { Mensaje.error(msn); } }
private void btn_guardar_Click(object sender, EventArgs e) { if (!validar()) { return; } Establecimiento establecimiento = new Establecimiento(); establecimiento.Idtbl_establecimiento = int.Parse(this.txt_codigo.Text); establecimiento.Nombre = this.txt_nombre.Text; establecimiento.Direccion = this.txt_direccion.Text; EstablecimientoTR tran = new EstablecimientoTR(establecimiento); string msn = ""; if (estadoGuardar && tran.insertarEstablecimiento(ref msn)) { Mensaje.informacion("Establecimiento ingresado exito"); this.limpiar(); txt_codigo.Select(); } else if (!estadoGuardar && tran.actualizarEstablecimiento(ref msn)) { Mensaje.informacion("Establecimiento actualizado con éxito."); if (this.fila != null) { pasarDatos(); } this.limpiar(); txt_codigo.Select(); } else { Mensaje.advertencia(msn); } }
public void buscarEstablecimiento(string codigo) { String mensaje = ""; EstablecimientoTR tran = new EstablecimientoTR(); Establecimiento establecimiento = tran.buscarXCodigo(codigo, ref mensaje); if (establecimiento != null) { llenarCampos(establecimiento); this.idEstablecimiento = establecimiento.Idtbl_establecimiento.ToString(); activarEstadoActualizar(); } else { if (String.IsNullOrEmpty(mensaje)) { Mensaje.advertencia("No se encontró el establecimiento."); } else { Mensaje.error(mensaje); } } }