private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty && this.txtPaterno.Text == string.Empty) { MensajeError("Falta ingresar Algunos Datos, seran Remarcados"); errorIcono.SetError(txtNombre, "Ingrese un Nombre"); errorIcono.SetError(txtPaterno, "Ingrese un Apellido Paterno"); } else { if (this.IsNuevo) { rpta = NTecnico.Insertar(this.txtNombre.Text.Trim(), this.txtPaterno.Text.Trim(), this.txtMaterno.Text.Trim(), Convert.ToInt32(this.txtTelefono.Text.Trim()), this.txtCI.Text.Trim()); } else { rpta = NTecnico.Editar(Convert.ToInt32(this.txtIdTecnico.Text), this.txtNombre.Text.Trim(), this.txtPaterno.Text.Trim(), this.txtMaterno.Text.Trim(), Convert.ToInt32(this.txtTelefono.Text.Trim()), this.txtCI.Text.Trim()); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se inserto Correctamente El Registro"); } else { this.MensajeOk("Se Actualizo Correctamente El Registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); this.pListas.Visible = true; this.pRegistro.Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void cargarComboTecnico() { this.txtTecnico.DropDownList.Columns.Clear(); this.txtTecnico.DropDownList.Columns.Add("nombre").Width = 80; this.txtTecnico.DropDownList.Columns.Add("paterno").Width = 80; this.txtTecnico.DropDownList.Columns.Add("materno").Width = 80; this.txtTecnico.DropDownList.Columns["nombre"].Caption = "Nombre"; this.txtTecnico.DropDownList.Columns["paterno"].Caption = "Paterno"; this.txtTecnico.DropDownList.Columns["materno"].Caption = "Materno"; this.txtTecnico.ValueMember = "idTecnico"; this.txtTecnico.DisplayMember = "nombre"; this.txtTecnico.DataSource = NTecnico.BuscarNombre(this.txtTecnico.Text.Trim()); this.txtTecnico.Refresh(); }
private void dataListado_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataListado.Columns["Eliminar"].Index) { DialogResult Opcion; Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { String Codigo; String Rpta = ""; Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["idTecnico"].Value); Rpta = NTecnico.Eliminar(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOk("Se ELimino Correctamente el Registro"); } else { this.MensajeError(Rpta); } this.Mostrar(); } } else { if (e.ColumnIndex == dataListado.Columns["Editar"].Index) { this.txtIdTecnico.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["idTecnico"].Value); this.txtNombre.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["nombre"].Value); this.txtPaterno.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["paterno"].Value); this.txtMaterno.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["materno"].Value); this.txtTelefono.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["telefono"].Value); this.txtCI.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["ci"].Value); pRegistro.Visible = true; Habilitar(true); pListas.Visible = false; } } }
private void BuscarNombre() { this.dataListado.DataSource = NTecnico.BuscarNombre(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de Registro: " + Convert.ToString(dataListado.Rows.Count); }
private void Mostrar() { this.dataListado.DataSource = NTecnico.Mostrar(); this.OcultarColumnas(); lblTotal.Text = "Total de Registro: " + Convert.ToString(dataListado.Rows.Count); }