protected void EliminarButton_Click(object sender, EventArgs e) { int id = textboxId.Text.ToInt(); if (id < 0) { Utilidades.ShowToastr(this, "Id invalido", "Advertencia", "warning"); return; } BLL.RepositorioBase <Empleado> repositorio = new BLL.RepositorioBase <Empleado>(); if (repositorio.Buscar(id) == null) { Utilidades.ShowToastr(this, "Registro no encontrado", "Advertencia", "warning"); return; } bool paso = repositorio.Eliminar(id); if (!paso) { Utilidades.ShowToastr(this, "Error al intentar eliminar el registro", "Error", "error"); return; } Utilidades.ShowToastr(this, "Registro eliminado correctamente!", "exito", "success"); return; }
protected void EliminarButtom_Click(object sender, EventArgs e) { int id = 0; if (Id_DropDownList.SelectedValue != condicion) { id = Convert.ToInt32(Id_DropDownList.SelectedValue); } else { return; } if (!Id_DropDownList.Text.Equals(condicion)) { if (repositorio.Eliminar(id)) { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('Eliminado');", addScriptTags: true); NuevoButton_Click(sender, e); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['danger']('No se pudo Eliminar');", addScriptTags: true); } } }
protected void EliminarButton_Click(object sender, EventArgs e) { int id = 0; if (Id_DropDownList.SelectedValue != condicion) { id = Convert.ToInt32(Id_DropDownList.SelectedValue); } else { return; } if (!Id_DropDownList.Text.Equals(condicion)) { //Si tiene algun prestamo o deposito enlazado no elimina BLL.RepositorioBase <Deposito> repositorios = new BLL.RepositorioBase <Deposito>(); BLL.RepositorioBase <Prestamo> repositorioPrestamo = new BLL.RepositorioBase <Prestamo>(); if (repositorios.GetList(x => x.CuentaId == id).Count() > 0 || repositorioPrestamo.GetList(x => x.IdCuenta == id).Count() > 0) { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('No Eliminado tiene depositos o Prestamos Enlazados');", addScriptTags: true); } else { if (repositorio.Eliminar(id)) { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['success']('Eliminado');", addScriptTags: true); NuevoButton_Click(sender, e); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "toastr_message", script: "toastr['danger']('No se pudo Eliminar');", addScriptTags: true); } } } }
protected void EliminarButton_Click(object sender, EventArgs e) { BLL.RepositorioBase <Categorias> repositorio = new BLL.RepositorioBase <Categorias>(); int id = Utils.ToInt(IdTextBox.Text); var categoria = repositorio.Buscar(id); if (categoria == null) { MostrarMensaje(TiposMensaje.Error, "Registro no encontrado"); } else { repositorio.Eliminar(id); } }
private void Eliminar_Click(object sender, EventArgs e) { if (!SiExiste()) { MessageBox.Show("No se puede eliminar una asignatura que no existe", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { var res = MessageBox.Show("Realmente Decea eliminar la asignatura", "Infromation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (res == DialogResult.OK) { Parcial2_WaldeReyes.BLL.RepositorioBase <Asignaturas> AsiganturaBLL = new BLL.RepositorioBase <Asignaturas>(new Contexto()); AsiganturaBLL.Eliminar((int)AsignaturaId.Value); } } }
protected void EliminarButton_Click(object sender, EventArgs e) { BLL.RepositorioBase <Destinatarios> repositorio = new BLL.RepositorioBase <Destinatarios>(); int id = Util.ToInt(DestinatarioIdTextBox.Text); var destinatarios = repositorio.Buscar(id); if (destinatarios == null) { Util.ShowToastr(this, "No se puede elliminar Error ", "Error", "error"); } else { repositorio.Eliminar(id); } Util.ShowToastr(this, " Eliminado ", "Success", "success"); Limpiar(); }
private void Eliminar_Click(object sender, EventArgs e) { if (!Existe()) { MessageBox.Show("No puese eliminar un usiario que no existe", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Parcial2_WaldeReyes.BLL.RepositorioBase <Estudiantes> BLL = new BLL.RepositorioBase <Estudiantes>(new Contexto()); var re = MessageBox.Show("Real mente decea modificar", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (re == DialogResult.OK) { BLL.Eliminar((int)EstudianteIdNumericUpDown.Value); Clean(); } else { MessageBox.Show("No se puedo eliminar"); Clean(); } } }