private void BuscarEmpleados(string tipo_busqueda, string texto_busqueda) { try { DataTable dtEmpleados = NEmpleados.BuscarEmpleado(tipo_busqueda, texto_busqueda, out string rpta); if (dtEmpleados != null) { this.listaEmpleados.DataSource = dtEmpleados; this.listaEmpleados.ValueMember = "Id_empleado"; this.listaEmpleados.DisplayMember = "Nombre_empleado"; } else { if (!rpta.Equals("OK")) { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarEmpleados", "Hubo un error al buscar empleados en el inicio de sesión", ex.Message); } }
public void Buscar() { try { this.dataGridViewEmpleados.DataSource = NEmpleados.Buscar(this.textBoxBuscarApellido.Text); } catch (Exception ex) { MensajeError(ex.Message); } }
public void nombreMuyLargo() { DEmpleado empleado = new DEmpleado(); empleado.Nombre = "Alexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; empleado.Apellido = "Pérez"; empleado.Cedula = "00"; String respuesta = NEmpleados.insertar(empleado); Assert.Fail(respuesta); }
private void radDateTimePicker1_ValueChanged(object sender, EventArgs e) { DataTable datos = NEmpleados.reporteNominaEmpleados(this.radDateTimePicker1.Value); if (datos == null) { return; } this.radGridView1.Columns.Clear(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.DataSource = datos; }
public void inyeccionSQL() { DEmpleado empleado = new DEmpleado(); empleado.Nombre = "','','','','','',1,''); " + "INSERT INTO `sistemagestionrrhh`.`fichas ocupacionales` (`Nombre Cargo`, `Area`, `Definicion`, `Funciones`, `Requisitos`, `Salario Base`) " + "VALUES('Vendedor', 'Ventas', 'Encargado de vender', 'Supervision, administración de asistencias', 'Ingenieria Industrial o carreras a fines', '20000');" + " #"; empleado.Apellido = "AAAAAAAAAAAAAAAAAAA"; empleado.Cedula = "00"; String respuesta = NEmpleados.insertar(empleado); Assert.Fail(respuesta); }
public void Mostrar() { try { this.Dock = DockStyle.Fill; this.dataGridViewEmpleados.DataSource = NEmpleados.Mostrar(numeroPagina, registrosPorPagina); this.dataGridViewEmpleados.Columns[0].Visible = false; cantidadPaginas = NEmpleados.Tamaño(registrosPorPagina); this.labelPagina.Text = String.Format("Página {0} de {1}", numeroPagina, cantidadPaginas); } catch (Exception ex) { MensajeError(ex.Message); } }
private void FrmIniciarSesion_Load(object sender, EventArgs e) { this.txtPass.txtBusqueda.TextAlign = HorizontalAlignment.Center; this.txtPass.Texto_inicial = "Contraseña"; this.txtPass.txtBusqueda.UseSystemPasswordChar = true; string rpta; DataTable tablaEmpleados = NEmpleados.BuscarEmpleados("COMPLETO", "", out rpta); if (tablaEmpleados != null) { this.ListaEmpleados.DataSource = tablaEmpleados; this.ListaEmpleados.ValueMember = "Id_empleado"; this.ListaEmpleados.DisplayMember = "Nombre_empleado"; this.ListaEmpleados.SelectedValue = 0; } else { Mensajes.MensajePregunta("Hubo un error conectando con el servidor, desea intentar de nuevo?", "Intentar de nuevo", "Cerrar", out DialogResult dialog); if (dialog == DialogResult.Yes) { string servicio = Convert.ToString(ConfigurationManager.AppSettings["nameServiceStarter"]); ServiceController sc = new ServiceController(servicio); try { if (sc != null && sc.Status == ServiceControllerStatus.Stopped) { sc.Start(); } sc.WaitForStatus(ServiceControllerStatus.Running); sc.Close(); } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "Iniciar servicio", "Error al iniciar el servicio: ", ex.Message); } } Mensajes.MensajeErrorCompleto(this.Name, "FrmIniciarSesion_Load", "Hubo un error al conectarse con el servidor", "Hubo un error al conectarse con el servidor, por favor intentelo de nuevo o envíe un ticket " + "al administrador del sistema, detalles: " + rpta); } }
private void BuscarEmpleados(string tipo_busqueda, string texto_busqueda) { try { DataTable dtEmpleados = NEmpleados.BuscarEmpleado(tipo_busqueda, texto_busqueda, out string rpta); if (dtEmpleados != null) { this.dgvEmpleados.Enabled = true; this.dgvEmpleados.PageSize = 10; this.dgvEmpleados.SetPagedDataSource(dtEmpleados, this.bindingNavigator1); string[] columns_header = { "Id empleado", "Nombre", "Teléfono", "Correo electrónico", "Cargo", "Password" }; bool[] columns_visible = { false, true, true, true, true, false }; this.dgvEmpleados = DatagridString.ChangeHeaderTextAndVisibleCustomDataGrid(this.dgvEmpleados, columns_header, columns_visible); this.lblResultados.Text = "Se encontraron " + dtEmpleados.Rows.Count + " empleados"; } else { if (!rpta.Equals("OK")) { throw new Exception(rpta); } this.dgvEmpleados.clearDataSource(); this.dgvEmpleados.Enabled = false; this.lblResultados.Text = "No se encontraron empleados"; } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarEmpleados", "Hubo un error al buscar empleados", ex.Message); } }
public void CargarComboBox() { if (esCliente == 1) { this.comboBox.DataSource = NClientes.ListaClientes(); } else if (esEmpleado == 1) { this.comboBox.DataSource = NEmpleados.ListaEmpleados(); } else if (esProducto == 1) { this.comboBox.DataSource = NProductos.ListaProductos(); } this.comboBox.ValueMember = "ID"; this.comboBox.DisplayMember = "NOMBRE"; }
private void buttonGuardar_Click(object sender, EventArgs e) { String mensaje = NEmpleados.Insertar(this.textBoxNombre.Text, this.textBoxApellido.Text, this.textBoxDireccion.Text, this.textBoxCiudad.Text, this.textBoxRegion.Text, this.textBoxPais.Text, this.textBoxTelefono.Text); if (mensaje == "Y") { this._owner.Mensaje(String.Format("El Empleado {0}, {1} ha sido AGREGADO", this.textBoxApellido.Text, this.textBoxNombre.Text)); this._owner.Refrescar(); this.Close(); } else { MensajeError(mensaje); } }
private void BtnLogin_Click(object sender, EventArgs e) { DataTable dtLogin = NEmpleados.Login(this.listaEmpleados.Text, this.txtPass.Text, out string rpta); if (dtLogin != null) { DatosUsuario datos = DatosUsuario.GetInstancia(); datos.Id_usuario = (Int32)dtLogin.Rows[0]["Id_empleado"]; datos.Nombre = dtLogin.Rows[0]["Nombre_empleado"].ToString(); datos.Tipo_usuario = dtLogin.Rows[0]["Cargo_empleado"].ToString(); this.onLogin?.Invoke(dtLogin, e); this.Close(); } else { Mensajes.MensajeInformacion("La contraseña es incorrecta", "Entendido"); } }
private void BuscarEmpleados(string tipo_busqueda, string texto_busqueda) { try { string rpta; DataTable Tabla = NEmpleados.BuscarEmpleados(tipo_busqueda, texto_busqueda, out rpta); this.dgvEmpleados.DataSource = Tabla; if (Tabla != null) { this.dgvEmpleados.Enabled = true; this.lblResultados.Text = "Se encontraron " + Tabla.Rows.Count + " empleados"; string[] columns_header_text = { "Id empleado", "Nombre", "Teléfono", "Correo electrónico", "Cargo", "Contraseña", "Clave maestra", "Estado" }; this.dgvEmpleados = DatagridString.ChangeColumnsHeaderText(this.dgvEmpleados, columns_header_text); bool[] columns_visible = { false, true, true, true, true, false, false, false, false }; this.dgvEmpleados = DatagridString.ChangeColumnsVisible(this.dgvEmpleados, columns_visible); this.CargarPanelColumnas(this.dgvEmpleados); } else { this.dgvEmpleados.Enabled = false; this.lblResultados.Text = "No se encontraron empleados"; } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarEmpleados", "Hubo un error al buscar un empleado", ex.Message); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { if (this.Comprobaciones(out Empleado empleado)) { string rpta = "OK"; string mensaje = ""; if (this.IsEditar) { rpta = NEmpleados.EditarEmpleado(Empleado.DatosEmpleado(empleado), empleado.Id_empleado); mensaje = "Se actualizó correctamente el empleado"; } else { rpta = NEmpleados.InsertarEmpleado(Empleado.DatosEmpleado(empleado), out int id_empleado); mensaje = "Se agregó correctamente el empleado"; } if (rpta.Equals("OK")) { Mensajes.MensajeOkForm(mensaje); this.Close(); } else { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BtnGuardar_Click", "Hubo un error al guardar un empleado", ex.Message); } }
private void cargarTablaEmpleados() { Thread myThread = new Thread(() => { DataTable datos = NEmpleados.reporteEmpleados(); if (datos != null) { this.Invoke(new Action(() => { dataTableEstudiantes.Columns.Clear(); dataTableEstudiantes.DataSource = datos; this.dataTableEstudiantes.Columns[0].IsVisible = false; })); } else { this.Invoke(new Action(() => { MessageBox.Show(this, "No se pudo cargar la información de los empleados", "Error al cargar información"); })); } }); myThread.Start(); }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("Realmente Desea Eliminar los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; string Rpta = ""; foreach (DataGridViewRow row in dgvEmpleados.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(row.Cells[1].Value); Rpta = NEmpleados.Eliminar(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOk("Se Eliminó Correctamente el registro"); } else { this.MensajeError(Rpta); } } } this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { if (this.Comprobaciones(out string clave)) { string rpta = ""; string mensaje = ""; if (this.IsClaveMaestra) { rpta = NEmpleados.ActualizarClaveMaestra(this.EEmpleado.Id_empleado, Convert.ToInt32(clave)); mensaje = "Se guardó la clave maestra correctamente"; } else { rpta = NEmpleados.ActualizarClaveUsuario(this.EEmpleado.Id_empleado, clave); mensaje = "Se guardó la clave de usuario correctamente"; } if (rpta.Equals("OK")) { Mensajes.MensajeOkForm(mensaje); this.Close(); } else { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BtnGuardar_Click", "Hubo un error al guardar la clave maestra o de usuario. IsClaveMaestra: " + this.IsClaveMaestra.ToString(), ex.Message); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { if (this.Comprobaciones()) { string rpta = ""; string mensaje = ""; if (this.IsEditar) { rpta = NEmpleados.EditarEmpleado(this.Variables()); mensaje = "actualizó"; } else { rpta = NEmpleados.InsertarEmpleado(this.Variables()); mensaje = "agregó"; } if (rpta.Equals("OK")) { Mensajes.MensajeOkForm("Se " + mensaje + " el empleado correctamente"); this.Close(); } else { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(ex.Message, Nombre_boton, this.Name, Informacion); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("Desea Eliminar El EMPLEADO De La Base de Datos", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string llave; string eliminar = ""; foreach (DataGridViewRow row in dgEmpleados.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { llave = Convert.ToString(row.Cells[1].Value); eliminar = NEmpleados.Eliminar(Convert.ToInt32(llave)); if (eliminar.Equals("OK")) { this.mensajeOk(" SE ELIMINO EL REGISTRO"); } else { this.mensajeError(eliminar); } } } this.mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void buttonEliminar_Click(object sender, EventArgs e) { try { if (this.dataGridViewEmpleados.Rows.Count > 0) { DialogResult confirmacion = MessageBox.Show("¿Seguro deseas eliminar este empleado?", "Eliminar Empleado", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (confirmacion == DialogResult.OK) { String mensaje = NEmpleados.Eliminar(Convert.ToInt32(ObtenerSeleccion().Cells["ID"].Value)); if (mensaje == "Y") { Mensaje(String.Format("El Empleado {0}, {1} ha sido ELIMINADO", Convert.ToString(ObtenerSeleccion().Cells["APELLIDO"].Value), Convert.ToString(ObtenerSeleccion().Cells["NOMBRE"].Value))); Refrescar(); } else { MensajeError(mensaje); Refrescar(); } } } else { MensajeError("Debes seleccionar una fila para eliminar"); } } catch (Exception ex) { MensajeError(ex.Message); } }
private async Task Login() { try { if (this.ListaEmpleados.Text != "" & this.txtPass.Texto != null) { if (this.ListaEmpleados.Text.Equals("NINGUNO")) { if (this.txtPass.Texto.Equals("administrador")) { DatosInicioSesion datos = DatosInicioSesion.GetInstancia(); datos.Id_empleado = Convert.ToInt32(0); datos.Nombre_empleado = Convert.ToString("Administrador"); datos.Cargo_empleado = "ADMINISTRADOR"; FrmPrincipal frmPrincipal = new FrmPrincipal(); frmPrincipal.WindowState = FormWindowState.Maximized; frmPrincipal.Show(); this.Hide(); } else if (this.txtPass.Texto.Equals("configadmin")) { FrmAdministracionAvanzada frm = new FrmAdministracionAvanzada(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); } } else { var(rpta, objects) = await NEmpleados.Login("LOGIN", Convert.ToString(this.ListaEmpleados.SelectedValue), this.txtPass.Texto); if (rpta.Equals("OK")) { Empleado empleado = (Empleado)objects[0]; Turno turno = (Turno)objects[1]; DatosInicioSesion datos = DatosInicioSesion.GetInstancia(); datos.Id_empleado = empleado.Id_empleado; datos.Nombre_empleado = empleado.Nombre_empleado; datos.Cargo_empleado = empleado.Cargo_empleado; datos.Empleado = empleado; datos.Turno = turno; FrmPrincipal frmPrincipal = new FrmPrincipal { WindowState = FormWindowState.Maximized }; frmPrincipal.Show(); this.Hide(); } else if (rpta.Equals("")) { Mensajes.MensajeInformacion("No se encontró el usuario, intentelo de nuevo", "Entendido"); } else { throw new Exception(rpta); } } } else if (this.ListaEmpleados.Text.Equals("")) { if (this.txtPass.Texto.Equals("configadmin")) { FrmAdministracionAvanzada frm = new FrmAdministracionAvanzada(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); } } else { Mensajes.MensajeErrorForm("La contraseña es obligatoria"); } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BtnIngresar_Click", "Hubo un error al ingresar", ex.Message); } }
public void CargarEmpleados() { this.comboBoxEmpleados.DataSource = NEmpleados.ListaEmpleados(); this.comboBoxEmpleados.ValueMember = "ID"; this.comboBoxEmpleados.DisplayMember = "NOMBRE"; }
private void mostrar() { this.dgEmpleados.DataSource = NEmpleados.Mostrar(); this.OcultarColumnas(); lblTotalEmpleados.Text = "Total de registros: " + Convert.ToString(dgEmpleados.Rows.Count); }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellidos.Text == string.Empty || this.txtDocumento.Text == string.Empty || this.txtUsuario.Text == string.Empty || this.txtContraseña.Text == string.Empty) { mensajeError("falta ingresar algunos datos"); errorIcono.SetError(txtNombre, "ingrese un datos"); errorIcono.SetError(txtApellidos, "ingrese un datos"); errorIcono.SetError(txtDocumento, "ingrese un datos"); errorIcono.SetError(txtUsuario, "ingrese un datos"); errorIcono.SetError(txtContraseña, "ingrese un datos"); } else { if (txtContraseñaC.Text == txtContraseña.Text) { if (this.Nuevo) { rpta = NEmpleados.Insertar(this.txtNombre.Text.ToUpper(), this.txtApellidos.Text.ToUpper(), Convert.ToInt32(this.cbidTD.SelectedValue), Convert.ToString(this.txtDocumento.Text.ToUpper()), this.txtDireccion.Text.ToUpper(), this.txtTelefono.Text.ToUpper(), this.cbAcceso.Text, this.txtUsuario.Text, this.txtContraseña.Text); } else { rpta = NEmpleados.Editar(Convert.ToInt32(txtEmp_id.Text), this.txtNombre.Text.ToUpper(), this.txtApellidos.Text.ToUpper(), Convert.ToInt32(this.cbidTD.SelectedValue), Convert.ToString(this.txtDocumento.Text.ToUpper()), this.txtDireccion.Text.ToUpper(), this.txtTelefono.Text.ToUpper(), this.cbAcceso.Text, this.txtUsuario.Text, this.txtContraseña.Text); } if (rpta.Equals("OK")) { if (this.Nuevo) { this.mensajeOk("se registro el Empleado"); } else { this.mensajeOk("se actualizaron los datos del Empleado"); } } else { this.mensajeError(rpta); } this.Nuevo = false; this.Editar = false; this.Botones(); this.limpiar(); this.mostrar(); } else { MessageBox.Show("LAS CONTRASEÑAS NO COINCIDEN"); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BuscarEmpleado() { this.dgEmpleados.DataSource = NEmpleados.BuscarEmpleado(this.txtBuscarEmpleado.Text); this.OcultarColumnas(); lblTotalEmpleados.Text = "Total de registros: " + Convert.ToString(dgEmpleados.Rows.Count); }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtCedula.Text == string.Empty) { MensajeError("Faltan ingresar algunos datos, seran remarcados"); erroricono.SetError(txtCedula, "Ingrese un valor"); erroricono.SetError(txtNombre, "Ingrese un valor"); erroricono.SetError(txtApellido, "Ingrese un valor"); erroricono.SetError(txtSalario, "Ingrese un valor"); } else { System.IO.MemoryStream ms = new System.IO.MemoryStream(); this.pbImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] image = ms.GetBuffer(); if (this.IsNuevo) { rpta = NEmpleados.Insertar(this.txtCedula.Text.Trim(), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.dtpFechaIngreso.Value.Date, Convert.ToInt32(this.cmbPuestos.SelectedValue), Convert.ToInt32(this.cmbDepartamentos.SelectedValue), image, Convert.ToDecimal(this.txtSalario.Text), this.chkEstado.Text.Trim()); } else { rpta = NEmpleados.Editar(Convert.ToInt32(this.txtIdEmpleados.Text), this.txtCedula.Text.Trim(), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.dtpFechaIngreso.Value.Date, Convert.ToInt32(this.cmbPuestos.SelectedValue), Convert.ToInt32(this.cmbDepartamentos.SelectedValue), image, Convert.ToDecimal(this.txtSalario.Text), this.chkEstado.Text.Trim()); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se inserto de forma correcta el registro"); } else { this.MensajeOk("Se actualizo de forma correcta el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//Metodo BuscarNombre private void BuscarNombre() { this.dataListado.DataSource = NEmpleados.BuscarNombre(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de registro: " + Convert.ToString(dataListado.Rows.Count); }
//Metodo mostrar private void Mostrar() { this.dataListado.DataSource = NEmpleados.Mostrar(); this.OcultarColumnas(); lblTotal.Text = "Total de registro: " + Convert.ToString(dataListado.Rows.Count); }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellido.Text == string.Empty || this.txtDireccion.Text == string.Empty || this.txtPais.Text == string.Empty || this.txtAcceso.Text == string.Empty || this.txtClave.Text == string.Empty ) { MensajeError("Falta ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtNombre, "Ingrese un valor"); errorIcono.SetError(txtApellido, "Ingrese un valor"); errorIcono.SetError(txtDireccion, "Ingrese un valor"); errorIcono.SetError(txtPais, "Ingrese un valor"); } else { System.IO.MemoryStream ms = new System.IO.MemoryStream(); this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] imagen = ms.GetBuffer(); if (this.IsNuevo) { rpta = NEmpleados.Insertar(this.txtApellido.Text.Trim(), this.txtNombre.Text.Trim(), dtFecha_Nacimiento.Value, this.txtDireccion.Text.Trim(), this.txtPais.Text.Trim().ToUpper(), imagen, //Helpers.ImageHelper.ImageToByteArray(pxImagen.Image), this.txtAcceso.Text.Trim(), this.txtUsuario.Text.Trim(), this.txtClave.Text.Trim() ); } else // editar empleados { rpta = NEmpleados.Editar(Convert.ToInt32(this.txtIdEmpleado.Text), this.txtApellido.Text, this.txtNombre.Text, dtFecha_Nacimiento.Value, this.txtDireccion.Text, this.txtPais.Text.Trim().ToUpper(), Helpers.ImageHelper.ImageToByteArray(pxImagen.Image), this.txtAcceso.Text.Trim(), // this.txtUsuario.Text.Trim(), this.txtClave.Text); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se Insertó de forma correcta el registro"); } else { this.MensajeOk("Se Actualizó de forma correcta el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { } }
private void BuscarPais() { this.dgvEmpleados.DataSource = NEmpleados.BuscarPais(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total Registros: " + Convert.ToString(dgvEmpleados.Rows.Count); }
private void radButton2_Click(object sender, EventArgs e) { string nombre, apellido, direccion, cedula, telefono; int genero; DEmpleado empleado = new DEmpleado(); nombre = this.txtNombre_estudiante.Text; apellido = this.txtApellido_estudiante.Text; direccion = this.radTextBox3.Text; cedula = this.radMaskedEditBox2.Text; telefono = this.radMaskedEditBox1.Value.ToString(); if (this.radRadioButton1.IsChecked)//Radio Button Genero Masculino { genero = DEmpleado.Genero_Hombre; } else { genero = DEmpleado.Genero_Mujer; } if (nombre.Equals(String.Empty)) { MessageBox.Show("El nombre no puede estar vacío"); return; } if (apellido.Equals(String.Empty)) { MessageBox.Show("El apellido no puede estar vacío"); return; } if (direccion.Equals(String.Empty)) { MessageBox.Show("El direccion no puede estar vacío"); return; } if (cedula.Equals(String.Empty)) { MessageBox.Show("La cedula no puede estar vacía"); return; } if (telefono.Equals(String.Empty)) { MessageBox.Show("El telefono no puede estar vacío"); return; } empleado.Nombre = nombre; empleado.Apellido = apellido; empleado.Direccion = direccion; empleado.Cedula = cedula; empleado.Telefono = telefono; empleado.Estado = this.radDropDownList1.SelectedItem.Text; empleado.IdFichaOcupacional = 1; empleado.FechaContratacion = this.radDateTimePicker1.Value; empleado.Genero = genero; String resultado = NEmpleados.insertar(empleado); if (resultado.Equals("OK")) { MessageBox.Show("Guardado correctamente"); this.txtNombre_estudiante.Text = String.Empty; this.txtApellido_estudiante.Text = String.Empty; this.radTextBox3.Text = String.Empty; this.radMaskedEditBox2.Text = String.Empty; this.radMaskedEditBox1.Text = String.Empty; } else { MessageBox.Show(resultado); } }