public void ModificarTest() { RepositorioBase <Productos> db = new RepositorioBase <Productos>(); Productos entity = new Productos() { IdProducto = 1, IdCategoria = 1, IdImagen = 1, IdMarca = 1, IdModelo = 1, IdUnidadMedida = 1, Descripcion = "Prueba2", CostoCompra = 1, FechaFabricacion = DateTime.Now, Nombre = "Prueba2", Stock = 1 }; Assert.IsTrue(db.Modificar(entity)); }
protected void guardarButton_Click(object sender, EventArgs e) { Pagos pagos = new Pagos(); RepositorioBase <Pagos> Repositorio = new RepositorioBase <Pagos>(); bool paso = false; pagos = LlenaClase(); if (Utils.ToInt(PagosIdTextBox.Text) == 0) { paso = Repositorio.Guardar(pagos); Limpiar(); } else { if (!ExisteEnLaBaseDeDatos()) { Utils.ShowToastr(this, "No se pudo guardar", "Error", "error"); return; } paso = Repositorio.Modificar(pagos); Limpiar(); } if (paso) { Utils.ShowToastr(this, "Guardado", "Exito", "success"); return; } else { Utils.ShowToastr(this, "No se pudo guardar", "Error", "error"); } Limpiar(); }
protected void GuardarButton_Click(object sender, EventArgs e) { RepositorioReserva repositorio = new RepositorioReserva(); Reserva reserva = repositorio.Buscar(Utils.ToInt(IDTexBox.Text)); if (reserva == null) { if (repositorio.Guardar(LlenaClase())) { int cantidad; RepositorioBase <Mesa> re = new RepositorioBase <Mesa>(); Mesa M = new RepositorioBase <Mesa>().Buscar(Utils.ToInt(NumeroMesaDropdownList.SelectedItem.Value)); cantidad = M.Cantidad - Utils.ToInt(CntTextBox.Text); M.Cantidad = cantidad; re.Modificar(M); Utils.ShowToastr(this, "Guardado", "Exito", "success"); Limpiar(); } else { Utils.ShowToastr(this, "No existe", "Error", "error"); Limpiar(); } } else { if (repositorio.Modificar(LlenaClase())) { Utils.ShowToastr(this.Page, "Modificado con exito!!", "Guardado", "success"); Limpiar(); } else { Utils.ShowToastr(this.Page, "No se puede modificar", "Error", "error"); Limpiar(); } } }
protected void Guardar_Click(object sender, EventArgs e) { RepositorioBase <Clientes> repositorio = new RepositorioBase <Clientes>(new Contexto()); Clientes clientes = new Clientes(); bool paso = false; if (Validar()) { return; } clientes = LLenaClase(); if (Utils.ToInt(ClienteIdTextBox.Text) == 0) { paso = repositorio.Guardar(clientes); } else { RepositorioBase <Clientes> repositorio1 = new RepositorioBase <Clientes>(new Contexto()); var buscar = repositorio1.Buscar(Utils.ToInt(ClienteIdTextBox.Text)); if (buscar != null) { paso = repositorio.Modificar(LLenaClase()); Utils.ShowToastr(this, "Modificacion Exitosa!!", "Exito", "success"); } else { Utils.ShowToastr(this, "Modificacion Erronea!!", "Error", "error"); } } if (paso) { Limpiar(); Utils.ShowToastr(this, "Guardado Exitosa!!", "Exito", "success"); } else { Utils.ShowToastr(this, "Error as Guardar!!", "Error", "error"); } }
private void GuardarButton_Click_1(object sender, EventArgs e) { bool paso = false; Asignatura asignatura = new Asignatura(); if (!validar()) { return; } RepositorioBase <Asignatura> repositorio = new RepositorioBase <Asignatura>(); asignatura = LlenarClase(); if (IDnumericUpDown.Value == 0) { paso = repositorio.Guardar(asignatura); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No esta registrada", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(asignatura); } if (paso) { MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); LimpiarAsignatura(); } else { MessageBox.Show("No fue posible guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guadarbutton_Click(object sender, EventArgs e) { RepositorioBase <Estudiantes> db = new RepositorioBase <Estudiantes>(); Estudiantes estudiante; bool paso = false; if (!validar()) { return; } estudiante = LlenarClase(); if (IdnumericUpDown.Value == 0) { paso = db.Guardar(estudiante); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un Estudiante que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Modificado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); paso = db.Modificar(estudiante); } if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }
protected void BtnGuardar_Click(object sender, EventArgs e) { RepositorioBase <Usuario> repositorio = new RepositorioBase <Usuario>(); Usuario usuario = new Usuario(); bool paso = false; usuario = LlenaClase(); if (usuario.UsuarioId == 0) { paso = repositorio.Guardar(usuario); Response.Write("<script>alert('Guardado Exitosamente!!');</script>"); LimpiarCampos(); } else { int id = ToInt(usuarioidTextBox.Text); usuario = repositorio.Buscar(id); if (usuario != null) { paso = repositorio.Modificar(usuario); Response.Write("<script>alert('Modificado Exitosamente');</script>"); } else { Response.Write("<script>alert('No se ha encontrado el Id');</script>"); } } if (paso) { LimpiarCampos(); } else { Response.Write("<script>alert('Fallo!! No ha Podido Guardar');</script>"); } }
private void GuardarButton_Click(object sender, EventArgs e) { bool paso = false; RepositorioBase <Facturas> repof = new RepositorioBase <Facturas>(); RepositorioBase <Clientes> repo = new RepositorioBase <Clientes>(); Clientes cliente = new Clientes(); if (!Validar()) { return; } cliente = LlenarClase(); if (IDNumericUpDown.Value == 0) { paso = repo.Guardar(cliente); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar", "Cliente no registrado", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repo.Modificar(cliente); } if (paso) { MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("No fue posible guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Usuarios> repositorio = new RepositorioBase <Usuarios>(); bool paso = false; if (!Validar()) { return; } Usuarios usuario = LlenaClase(); if (UsuarioIdNumericUpDown.Value == 0) { paso = repositorio.Guardar(usuario); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se encuentra el usuario en la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(usuario); } if (paso) { Limpiar(); MessageBox.Show("Guardado exitosamente", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar el usuario", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Usuarios> db = new RepositorioBase <Usuarios>(); Usuarios cliente; bool paso = false; if (!ValidarCampos()) { return; } cliente = LlenaClase(); if (UsuarioIdTextBox.Text == Convert.ToString(0)) { paso = db.Guardar(cliente); } else { if (!ExisteEnLaBaseDeDatos()) { Utilitarios.Utils.ShowToastr(this.Page, "No se puede modicicar un Usuario que no existe", "Error", "error"); return; } paso = db.Modificar(cliente); } if (paso) { Utilitarios.Utils.ShowToastr(this.Page, "Se ha Guardado correctamente", "Exito", "success"); } else { Utilitarios.Utils.ShowToastr(this.Page, "Se profujo un error al guardar", "Error", "error"); } Limpiar(); }
protected void GuardarButton_Click(object sender, EventArgs e) { int id = Convert.ToInt32(usuarioIdTextBox.Text); if (!(String.IsNullOrEmpty(nombreTextbox.Text) || String.IsNullOrEmpty(claveTextbox.Text))) { RepositorioBase <Usuario> repositorio = new RepositorioBase <Usuario>(); if (id == 0) { repositorio.Guardar(LlenaClase()); ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Guardado con Exito')", true); } else { if (repositorio.Buscar(id) != null) { Usuario usuario = repositorio.Buscar(int.Parse(usuarioIdTextBox.Text)); usuario.Nombre = nombreTextbox.Text; usuario.Clave = claveTextbox.Text; usuario.Email = emailTextBox.Text; usuario.Telefono = telefonoTextBox.Text; usuario.Celular = celularTextBox.Text; repositorio.Modificar(usuario); ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Modificado con Exito')", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('No existe una categoria con ese ID, no puede modificarse')", true); } } } else if (id == 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Rellene todos los campos')", true); } Limpiar(); }
protected void Guardar_Click(object sender, EventArgs e) { RepositorioBase <Productos> repositorio = new RepositorioBase <Productos>(new Contexto()); Productos productos = new Productos(); bool paso = false; if (!Validar()) { return; } productos = LLenaClase(); if (Utils.ToInt(ProductoIdTextBox.Text) == 0) { paso = repositorio.Guardar(productos); } else { RepositorioBase <Productos> repositorio1 = new RepositorioBase <Productos>(new Contexto()); var buscar = repositorio1.Buscar(Utils.ToInt(ProductoIdTextBox.Text)); if (buscar != null) { paso = repositorio.Modificar(productos); Utils.ShowToastr(this, "Modificacion Exitosa!!", "Exito", "success"); } else { Utils.ShowToastr(this, "Modificacion Erronea!!", "Error", "error"); } } if (paso) { Limpia(); Utils.ShowToastr(this, "Guardo Exitosamente!!", "Exito", "success"); } else { Utils.ShowToastr(this, "Error al guardar", "Error", "error"); } }
private void Guardar_button_Click(object sender, EventArgs e) { RepositorioBase <Estudiantes> repositorio = new RepositorioBase <Estudiantes>(); Estudiantes estudiantes; bool paso = false; if (!Validar()) { return; } estudiantes = LlenarClase(); if (EstudianteId_numericUpDown.Value == 0) { paso = repositorio.Guardar(estudiantes); } else { if (!ExiteEnLaBaseDeDatos()) { MessageBox.Show("No se puede Modificar un estudiante que no existe", "Fallo!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(estudiantes); MessageBox.Show("Se modifico con Exito!!", "Exito!", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (paso) { Limpiar(); MessageBox.Show("Guardado!!", "Exito!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Categorias> db = new RepositorioBase <Categorias>(); Categorias categoria; bool paso = false; if (!ValidarCampos()) { return; } categoria = LlenaClase(); if (CategoriaIdTextBox.Text == Convert.ToString(0)) { paso = db.Guardar(categoria); } else { if (!ExisteEnLaBaseDeDatos()) { Utilitarios.Utils.ShowToastr(this.Page, "Este registro no existe", "Error", "error"); return; } paso = db.Modificar(categoria); } if (paso) { Utilitarios.Utils.ShowToastr(this.Page, "Ha guardado Correctamente", "Exito", "success"); } else { Utilitarios.Utils.ShowToastr(this.Page, "Se profujo un error al guardar", "Error", "error"); } Limpiar(); }
private void Guardarbutton_Click(object sender, EventArgs e) { Estudent = new RepositorioBase <Estudiante>(new Contexto()); Estudiante estudiante; bool paso = false; if (!validar()) { MessageBox.Show("Debe Llenar los Campos Indicados", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { estudiante = LlenaClase(); if (IDnumericUpDown.Value == 0) { paso = Estudent.Guardar(estudiante); MyerrorProvider.Clear(); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un estudiante no existente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } paso = Estudent.Modificar(estudiante); } if (paso) { MessageBox.Show("Guardado Correctamente", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("Error al guardar", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <TipoVacante> repositorio = new RepositorioBase <TipoVacante>(); bool paso = false; if (!Validar()) { return; } TipoVacante tipoVacante = LlenarClase(); if (IdnumericUpDown.Value == 0) { if (!NoRepetidos()) { return; } paso = repositorio.Guardar(tipoVacante); } else if (IdnumericUpDown.Value != controla) { MessageBox.Show("Se ha cambiado el id"); return; } else { paso = repositorio.Modificar(tipoVacante); } if (paso) { MessageBox.Show("Guardado", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }
private void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Asignaciones> repositorioAsignacion = new RepositorioBase <Asignaciones>(); bool paso = false; if (!Validar()) { return; } Asignaciones asignacion = LlenaClase(); if (AsignacionIdNumericUpDown.Value == 0) { paso = repositorioAsignacion.Guardar(asignacion); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se encuentra la asignacion en la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorioAsignacion.Modificar(asignacion); } if (paso) { Limpiar(); MessageBox.Show("Guardada exitosamente", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar la asignacion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Pacientes> db = new RepositorioBase <Pacientes>(); Pacientes paciente; bool paso = false; if (!ValidarCampos()) { return; } paciente = LlenaClase(); if (PacienteIdTextBox.Text == Convert.ToString(0)) { paso = db.Guardar(paciente); } else { if (!ExisteEnLaBaseDeDatos()) { Utilitarios.Utils.ShowToastr(this.Page, "El campo descripcion no puede estar vacio", "Error", "error"); return; } paso = db.Modificar(paciente); } if (paso) { Utilitarios.Utils.ShowToastr(this.Page, "El campo descripcion no puede estar vacio", "Exito", "success"); } else { Utilitarios.Utils.ShowToastr(this.Page, "Se profujo un error al guardar", "Error", "error"); } Limpiar(); }
protected void GuadarButton_Click(object sender, EventArgs e) { if (!Validar()) { return; } RepositorioBase <Categorias> repositorio = new RepositorioBase <Categorias>(); Categorias categorias = LlenarClase(); bool paso = false; TipoTitulo tipoTitulo = TipoTitulo.OperacionFallida; TiposMensajes tiposMensajes = TiposMensajes.RegistroNoGuardado; IconType iconType = IconType.error; if (categorias.CategoriaId == 0) { paso = repositorio.Guardar(categorias); } else { if (!ExisteEnLaBaseDeDatos()) { Utils.ToastSweet(this, IconType.info, TiposMensajes.RegistroNoEncontrado); } else { paso = repositorio.Modificar(categorias); } } if (paso) { Limpiar(); tipoTitulo = TipoTitulo.OperacionExitosa; tiposMensajes = TiposMensajes.RegistroGuardado; iconType = IconType.success; } Utils.Alerta(this, tipoTitulo, tiposMensajes, iconType); repositorio.Dispose(); }
protected void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Departamento> db = new RepositorioBase <Departamento>(); Departamento departamento; bool paso = false; departamento = LlenaClase(); if (validar()) { return; } else if (IdTextBox.Text == Convert.ToString(0)) { paso = db.Guardar(departamento); } else { if (!ExisteEnLaBaseDeDatos()) { Utils.ShowToastr(this.Page, "LLenar este campo ID", "Error", "error"); return; } paso = db.Modificar(departamento); Utils.ShowToastr(this.Page, "Modificado ", "Exito", "success"); return; } if (paso) { Utils.ShowToastr(this.Page, "Guardado ", "Exito", "success"); } else { Utils.ShowToastr(this.Page, "Error No Guardado", "Error", "error"); } Limpiar(); }
private void GuardarButton_Click(object sender, EventArgs e) { RepositorioBase <Asignaturas> repositorio = new RepositorioBase <Asignaturas>(); bool paso = false; Asignaturas asignatura; if (!Validar()) { return; } asignatura = LlenaClase(); if (AsignaturaIdNumericUpDown.Value == 0) { paso = repositorio.Guardar(asignatura); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se encunetra en la base de datos", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(asignatura); } if (paso) { Limpiar(); MessageBox.Show("!Guardado!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se puede modificar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardarbutton_Click(object sender, EventArgs e) { Servicios categorias = new Servicios(); bool paso = false; if (!Validar()) { return; } categorias = LlenaClase(); if (IdnumericUpDown1.Value == 0) { paso = GenericCategorias.Guardar(categorias); } else { if (!ExisteEnBaseDeDatos()) { MessageBox.Show("No se puede modificar un registro que no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = GenericCategorias.Modificar(categorias); } if (paso) { Limpiar(); MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No Guardado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } factura.LlenaCombobox(); }
private void Guardarbutton_Click(object sender, EventArgs e) { RepositorioBase <Asignaturas> repositorio = new RepositorioBase <Asignaturas>(); Asignaturas asignatura; bool paso = false; if (!Validar()) { return; } asignatura = LlenaClase(); if (IdnumericUpDown.Value == 0) { paso = repositorio.Guardar(asignatura); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un Asignatura que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(asignatura); } if (paso) { MessageBox.Show("Asignatura Guardado!!", "Exito!!!!!", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("No Se Pudo Guardar!!", "Fallo!!!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardarbutton_Click(object sender, EventArgs e) { RepositorioBase <Usuarios> db = new RepositorioBase <Usuarios>(); Usuarios usuario; bool paso = false; if (!Validar()) { return; } usuario = LlenaClase(); if (UsuarioIdnumericUpDown.Value == 0) { paso = db.Guardar(usuario); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar una Usuario que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = db.Modificar(usuario); } if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }
private void Guardarbutton_Click(object sender, EventArgs e) { bool paso = false; Asignaturas asignatura; RepositorioBase <Asignaturas> repositorio = new RepositorioBase <Asignaturas>(); if (!Validar()) { return; } asignatura = LlenaClase(); if (AsignaturaIdnumericUpDown.Value == 0) { paso = repositorio.Guardar(asignatura); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un registro que no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(asignatura); } if (paso) { Limpiar(); MessageBox.Show("¡Guardado exitosamente!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("¡No fue posible guardar!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void GuardarButton_Click1(object sender, EventArgs e) { RepositorioBase <Estudiantes> db = new RepositorioBase <Estudiantes>(); Estudiantes estudiante; bool paso = false; if (!Validar()) { return; } estudiante = LlenaClase(); if (EstudianteIdTextBox.Text == Convert.ToString(0)) { paso = db.Guardar(estudiante); } else { if (!ExisteEnLaBaseDeDatos()) { Utilitarios.Utils.ShowToastr(this.Page, "No existe", "Error", "error"); return; } paso = db.Modificar(estudiante); } if (paso) { Utilitarios.Utils.ShowToastr(this.Page, "Guardado con exito ", "Exito", "success"); } else { Utilitarios.Utils.ShowToastr(this.Page, "Error al guardar", "Error", "error"); } Limpiar(); }
private void Guardarbutton_Click(object sender, EventArgs e) { RepositorioBase <Asignaturas> db = new RepositorioBase <Asignaturas>(new DAL.Contexto()); Asignaturas asignatura; bool paso = false; if (!Validar()) { return; } asignatura = LlenaClase(); if (AsignaturaIdnumericUpDown.Value == 0) { paso = db.Guardar(asignatura); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar una Asignatura que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = db.Modificar(asignatura); } if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }
private void GuardarButton_Click(object sender, EventArgs e) { Citas cita; bool paso = false; RepositorioBase <Citas> repositorio = new RepositorioBase <Citas>(); if (!Validar()) { return; } cita = LlenarClase(); if (CitaIdNumericUpDown.Value == 0) { paso = repositorio.Guardar(cita); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un registro que no existe"); return; } paso = repositorio.Modificar(cita); } if (paso) { Limpiar(); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardarbutton_Click(object sender, EventArgs e) { bool paso; repositorio = new RepositorioBase <Estudiante>(); Estudiante estudiante = new Estudiante(); if (!Validar()) { return; } estudiante = LlenaClase(); if (IDnumericUpDown.Value == 0) { paso = repositorio.Guardar(estudiante); } else { if (!Existe()) { MessageBox.Show("No existe este estudiante en la base de datos", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(estudiante); } if (paso) { MessageBox.Show("Estudiante Guardar", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("No se pudo guardar", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardarbutton_Click(object sender, EventArgs e) { bool paso = false; Empleados empleado; RepositorioBase <Empleados> repositorio = new RepositorioBase <Empleados>(); if (!Validar()) { return; } empleado = LlenaClase(); if (IDnumericUpDown.Value == 0) { paso = repositorio.Guardar(empleado); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un registro que no existe en la base de datos", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = repositorio.Modificar(empleado); } if (paso) { Limpiar(); MessageBox.Show("¡Guardado correctamente!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("¡No fue posible guardar!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }