public static bool EliminarEmpleado(String id) { int id_empleado = Convert.ToInt32(id.ToString()); bool respuesta = new EmpleadoLN().EliminarEmpleado(id_empleado); return(respuesta); }
private void LlenarEmpleado() { try { this.Cursor = Cursors.WaitCursor; EmpleadoEN oRegistroEN = new EmpleadoEN(); EmpleadoLN oRegistroLN = new EmpleadoLN(); oRegistroEN.Where = ""; oRegistroEN.OrderBy = ""; if (oRegistroLN.ListadoParaCombos(oRegistroEN, Program.oDatosDeConexioEN)) { cmbEmpleado.DataSource = oRegistroLN.TraerDatos(); cmbEmpleado.DisplayMember = "Nombre"; cmbEmpleado.ValueMember = "IdEmpleado"; cmbEmpleado.SelectedIndex = -1; } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Información del tipo de cuentas", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void tsbGuardar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { EmpleadoEN oRegistroEN = InformacionDelRegistro(); EmpleadoLN oRegistroLN = new EmpleadoLN(); if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexioEN, "AGREGAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdEmpleado.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdEmpleado; EvaluarErrorParaMensageEnPantalla(oRegistroLN.Error, "Guardar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } else { OperacionARealizar = "GUARDAR"; OctenerValoresDeConfiguracion(); LlenarMetodoSegunOperacion(); EstableserTituloDeLaVentana(); DesavilitarControlesSegunOperacion(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Guardar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void LlenarEmpleados() { var Lista = EmpleadoLN.getInstance().ListarEmpleados(); ddlEmpleado.DataSource = Lista; ddlEmpleado.DataValueField = "Rut"; ddlEmpleado.DataTextField = "Nombre"; ddlEmpleado.DataBind(); ddlEmpleado.Items.Insert(0, new ListItem(" Luego un empleado", "0")); }
private void LlenarCamposSegunBaseDeDatosSegunID() { this.Cursor = Cursors.WaitCursor; EmpleadoEN oRegistrosEN = new EmpleadoEN(); EmpleadoLN oRegistrosLN = new EmpleadoLN(); oRegistrosEN.IdEmpleado = ValorLlavePrimariaEntidad; if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexioEN)) { if (oRegistrosLN.TraerDatos().Rows.Count > 0) { DataRow Fila = oRegistrosLN.TraerDatos().Rows[0]; txtNombre.Text = Fila["Nombre"].ToString(); txtApellidos.Text = Fila["Apellidos"].ToString(); txtCedula.Text = Fila["Cedula"].ToString(); txtDireccion.Text = Fila["Direccion"].ToString(); txtTelefono.Text = Fila["Telefono"].ToString(); txtCelular.Text = Fila["Celular"].ToString(); txtCorreoElectronico.Text = Fila["Correo"].ToString(); txtNoINSS.Text = Fila["NoINSS"].ToString(); cmbAreaLaboral.SelectedValue = Convert.ToInt32(Fila["IdAreaLaboral"].ToString()); cmbCargo.SelectedValue = Convert.ToInt32(Fila["IdCargo"].ToString()); cmbMunicipio.SelectedValue = Convert.ToInt32(Fila["IdCiudad"].ToString()); oRegistrosEN = null; oRegistrosLN = null; } else { string Mensaje; Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado." + "\n\r-----Causas---- " + "\n\r1. Este registro pudo haber sido eliminado por otro usuario." + "\n\r2. El listado no está actualizado.", Nombre_Entidad); MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; this.Close(); } } else { this.Cursor = Cursors.Default; MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; } this.Cursor = Cursors.Default; }
public override bool ValidateUser(string username, string password) { bool ok = false; Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(username, password); if (objEmpleado != null) { ok = true; } return(ok); }
public override bool ValidateUser(string username, string password) { bool ok = false; Empleado objEmpleado = new EmpleadoLN().iniciarSesionEmpleado(username, password); if (objEmpleado != null) { ok = true; } return(ok); }
protected void btnIngresar_Click(object sender, EventArgs e) { Emplead objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsuario.Text, txtPassword.Text); if (objEmpleado != null) { Response.Write("<script>alert('USUARIO CORRECTO .')</script>"); } else { Response.Write("<script>alert('USUARIO inCORRECTO .')</script>"); } }
protected void btnRegistrarUsuario_Click(object sender, EventArgs e) { Empleado objEmpleado = obtenerDatosEmpleado(); bool respuesta = new EmpleadoLN().RegistrarEmpleado(objEmpleado); if (respuesta == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "MensajeEmpleadoCorrecto();", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "MensajeEmpleadoInorrecto();", true); } }
protected void btnEntrar_Click(object sender, EventArgs e) { Empleado objEmpleado = EmpleadoLN.getInstance().AcessoSistema(txtUsuario.Text, txtPassword.Text); if (objEmpleado != null) { Response.Write("<script>alert('USUARIO CORRETO.')</script>"); Response.Redirect("PainelGeral.aspx"); } else { Response.Write("<script>alert('USUARIO INCORRETO.')</script>"); } }
protected void btnIngresar_Click(object sender, EventArgs e) { var Empleado = EmpleadoLN.getInstance().getAccess(txtUsuario.Text, txtPassword.Text); if (Empleado != null) { Response.Write("<script>alert('Usuario Correcto') </script>"); Response.Redirect("PanelGeneral.aspx"); } else { Response.Write("<script>alert('Usuario Incorrecto') </script>"); } }
protected void btnIngresar_Click(object sender, EventArgs e) { // Ya tengo los datos que corresponden para el login Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsuario.Text, txtPassword.Text); if (objEmpleado != null) { // significa que si ha accedido a la base de datos y que a su vez ha traido un objeto Response.Write("<script>alert('USUARIO CORRECTO.')</script>"); Response.Redirect("PanelGeneral.aspx"); } else { Response.Write("<script>alert('USUARIO INCORRECTO.')</script>"); } }
public static List <Empleado> ListarEmpleados() { List <Empleado> ListaEmpleados = null; try { ListaEmpleados = new EmpleadoLN().ListarEmpleados(); } catch (Exception ex) { ListaEmpleados = new EmpleadoLN().ListarEmpleados(); throw ex; } return(ListaEmpleados); }
//protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e) //{ // bool auth = Membership.ValidateUser(LoginUser.UserName, LoginUser.Password); // if (auth) // { // Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(LoginUser.UserName, LoginUser.Password); // if (objEmpleado != null) // { // SessionManager = new SessionManager(Session); // SessionManager.UserSession = objEmpleado.Usuario.ToString(); // FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false); // //Response.Write("<script>alert('USUARIO CORRECTO')</script>"); // //Response.Redirect("PanelGeneral.aspx"); // } // else // { // Response.Write("<script>alert('USUARIO INCORRECTO')</script>"); // } // } //} protected void btnIngresar_Click(object sender, EventArgs e) { Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsername.Text, txtPassword.Text); if (objEmpleado != null) { //SessionManager = new SessionManager(Session); //SessionManager.UserSessionObjeto = objEmpleado; Session["UserSistemaWeb"] = objEmpleado.Usuario.ToString(); Response.Redirect("~/PanelGeneral.aspx"); } else { lblMensajeError.Text = "Usuario y/o Contraseña Incorrecto"; } }
private void LlenarListado() { try { this.Cursor = Cursors.WaitCursor; EmpleadoEN oRegistroEN = new EmpleadoEN(); EmpleadoLN oRegistroLN = new EmpleadoLN(); oRegistroEN.Where = WhereDinamico(); if (oRegistroLN.Listado(oRegistroEN, Program.oDatosDeConexioEN)) { dgvLista.Columns.Clear(); System.Diagnostics.Debug.Print(oRegistroLN.TraerDatos().Rows.Count.ToString()); if (Activar_Filtros == true) { dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistroLN.TraerDatos()); } else { dgvLista.DataSource = oRegistroLN.TraerDatos(); } FormatearDGV(); this.dgvLista.ClearSelection(); tsbNoRegistros.Text = "No Registros: " + oRegistroLN.TotalRegistros().ToString(); } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Lelnar listado del registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
protected void btnIngresar_Click(object sender, EventArgs e) { // string user = txtusuario.Text; // string password = txtPassword.Text; // string userName = "******"; // string passName = "4ug02000"; // // if (user.Equals(userName) && password.Equals(passName)) Empleado objEmpleado = EmpleadoLN.getInstance().AccesoDatos(txtusuario.Text, txtPassword.Text); if (objEmpleado != null) { Response.Write("<script> alert ('Usuario Correcto'); </script>"); } else { Response.Write("<script> alert ('Usuario Incorrecto'); </script>"); } }
protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e) { bool auth = Membership.ValidateUser(LoginUser.UserName, LoginUser.Password); if (auth) { Empleado objEmpleado = new EmpleadoLN().iniciarSesionEmpleado(LoginUser.UserName, LoginUser.Password); if (objEmpleado != null) { SessionManager = new SessionManager(Session); SessionManager.UserSessionObjeto = objEmpleado; FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "MensajeEmpleadoIncorrecto();", true); } }
protected void LoginUser_Aunthenticate(object sender, AuthenticateEventArgs e) { bool auth = Membership.ValidateUser(LoginUser.UserName, LoginUser.Password); if (auth) { Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(LoginUser.UserName, LoginUser.Password); if (objEmpleado != null) { SessionManager _SessionManager = new SessionManager(Session); //SessionManager.UserSessionId = objEmpleado.ID.ToString(); _SessionManager.UserSessionEmpleado = objEmpleado; FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false); } else { Response.Write("<script>alert('USUARIO INCORRECTO.')</script>"); } } }
protected void btnBuscar_Click(object sender, EventArgs e) { if (!Regex.IsMatch(txtDNI.Text, "[^0-9]") && txtDNI.Text.Length != 8) { hfIdEmpleado.Value = "0"; ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('INGRESAR NÚMERO DE DOCUMENTO VÁLIDO')", true); return; } if (txtDNI.Text.Length == 8) { Empleado objEmpleado = EmpleadoLN.getInstance().BuscarEmpleado(txtDNI.Text); if (objEmpleado != null) { if (objEmpleado.ID != 0) { hfIdEmpleado.Value = objEmpleado.ID.ToString(); ListarPermisosAsignados(objEmpleado.ID, 0); // 0 es para asignados ListarPermisosNoAsignados(objEmpleado.ID, 1); // 1 es para no asignados } else { hfIdEmpleado.Value = "0"; ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO')", true); //Response.Write("<script>alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO.')</script>"); } } else { hfIdEmpleado.Value = "0"; ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO')", true); //Response.Write("<script>alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO.')</script>"); } } else { hfIdEmpleado.Value = "0"; } }
private void tsbActualizar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { if (txtIdentificador.Text.Length == 0 || txtIdentificador.Text == "0") { MessageBox.Show("No se puede continuar. Ha ocurrido un error y el registro no ha sido cargado correctamente.", OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("¿Está seguro que desea aplicar los cambios al registro seleccionado?", "Actualizar la Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == System.Windows.Forms.DialogResult.No) { return; } EmpleadoEN oRegistroEN = InformacionDelRegistro(); EmpleadoLN oRegistroLN = new EmpleadoLN(); if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexioEN, "ACTUALIZAR")) { if (PermitirCambiarRegistroAunqueEstenVinculados == true && AplicarCambio == true) { if (MessageBox.Show(string.Format("Está seguro que desea actualizar los cambios en el registro seleccionado ya que este se encuentra asociado a otras Entidades de manera interna? {0} {1}", Environment.NewLine, oRegistroLN.Error), "Confirmación de Actualización", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { this.Cursor = Cursors.Default; return; } } else { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, "Actualizar la información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "ACTUALIZAR")) { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, "Actualizar la información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (oRegistroLN.Actualizar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdEmpleado.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdEmpleado; EvaluarErrorParaMensageEnPantalla(oRegistroLN.Error, "Actualizar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Actualizar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void tsbEliminar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { if (txtIdentificador.Text.Length == 0 || txtIdentificador.Text == "0") { MessageBox.Show("No se puede continuar. Ha ocurrido un error y el registro no ha sido cargado correctamente.", OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("¿Está seguro que desea eliminar el registro?", "Eliminar la Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == System.Windows.Forms.DialogResult.No) { return; } EmpleadoEN oRegistroEN = InformacionDelRegistro(); EmpleadoLN oRegistroLN = new EmpleadoLN(); if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexioEN, "ELIMINAR")) { MessageBox.Show("Buscar Error"); this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, this.OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (oRegistroLN.Eliminar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdEmpleado.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdEmpleado; EvaluarErrorParaMensageEnPantalla(oRegistroLN.Error, "Eliminar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Eliminar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }