private void btnEliminar_Click(object sender, EventArgs e) { Profesion prof = new Profesion(); prof.nombreProfesion = txtProfesion.Text.Trim(); prof.id = int.Parse(grdProfesiones.CurrentRow.Cells["id_Profesiones"].Value.ToString()); string msjAlert = "Desea eliminar la Profesion: \n " + prof.nombreProfesion; MessageBoxButtons buttons = MessageBoxButtons.YesNo; MessageBox.Show(msjAlert, "Error", buttons); bool resultado = AD_Profesiones.EliminarProfesion(prof); if (resultado) { MessageBox.Show("Cliente Eliminado exitosamente"); LimpiarCampos(); CargarGrilla(); btnGuardar.Enabled = true; btnEliminar.Enabled = false; btnActualizar.Enabled = false; } else { MessageBox.Show("Error al actualizar Cliente"); } }
public async Task <IActionResult> PutProfesion(string id, Profesion profesion) { if (id != profesion.ProfCodigo) { return(BadRequest()); } _context.Entry(profesion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfesionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public bool Delete(Profesion profesion) { bool respuesta = false; try { var connection = new SqlConnection(connection_string); connection.Open(); var query = new SqlCommand("DELETE FROM profesiones WHERE id = @p0", connection); query.Parameters.AddWithValue("@p0", profesion.id); query.ExecuteNonQuery(); connection.Close(); connection.Dispose(); respuesta = true; } catch { throw; } return(respuesta); }
// // GET: /Profesion/Edit/5 public ActionResult Edit(int id) { Profesion profesion = db.Profesion.Find(id); profesion.Nombre = utils.ToTitle(profesion.Nombre); return(View(profesion)); }
protected async override Task OnAppearingAnimationEnd() { var translateLength = 400u; await Task.WhenAll( Nombre.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), Apellido.FadeTo(1)); await Task.WhenAll( UsernameEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), UsernameEntry.FadeTo(1), Profesion.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), Profesion.FadeTo(1), (new Func <Task>(async() => { await Task.Delay(200); await Task.WhenAll( PasswordEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), PasswordEntry.FadeTo(1)); }))()); await Task.WhenAll( LoginButton.ScaleTo(1), LoginButton.FadeTo(1)); }
private void ListadoProfesiones() { cbProfesion.DataSource = Profesion.ListarProfesiones(); cbProfesion.DisplayMember = "NOMBRE_PROFESION"; cbProfesion.ValueMember = "ID_PROFESION"; cbProfesion.SelectedIndex = -1; }
static void Main(string[] args) { Usuario user = new Usuario(); user.Nombre = "Alexis Aravena"; Profesion prof = new Profesion(); prof.NombreProfesion = "Ingenieria en Informatica"; Colegio col = new Colegio(); col.Nombre = "Duoc UC"; col.AnnoInicio = 1950; prof.Colegio = col; user.MiProfesion = prof; Console.WriteLine("Avance del codigo version 1.2.3"); Console.WriteLine("Nombre:{0} Profesión{1} Colegio:{2}", user.Nombre, user.MiProfesion.NombreProfesion, user.MiProfesion.Colegio.Nombre); Console.ReadKey(); }
//public string List() //{ // string todos = ""; // foreach (Vendedor vendedor in ListaVendedor) // { // todos += vendedor.ToString(); // } // return todos; //} /// <summary> /// Muestra los datos de un vendedor /// </summary> public void Show() { Console.WriteLine(Cedula.ToString().PadRight(12) + Nombre.PadRight(35) + FechaNacimiento.ToShortDateString().PadLeft(12) + Sexo.ToString().PadRight(12).PadLeft(15) + Telefono.ToString().PadLeft(12).PadRight(15) + Correo.PadRight(40) + Direccion.PadRight(40) + EstadoCivil.ToString().PadRight(12) + IdVendedor.ToString().PadLeft(5) + FechaIngreso.ToShortDateString().PadLeft(12) + Salario.ToString().PadLeft(10) + Profesion.PadLeft(20).PadRight(17) + Calificacion.ToString().PadLeft(5)); }
public ActionResult Create(Profesion a) { if (!ModelState.IsValid) { return(View()); } try { using (var db = new ReservacionesEntities()) { //Auditoria(Cedula, "Usuario", "AGREGO UN USUARIO"); db.Profesions.Add(a); var K = db.Usuarios.Single(u => u.Estado == "1"); if (K != null) { Auditoria(K.Cedula, "Profesion", "CREO UNA PROFESION"); } db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("Error al agregar una Escuela", ex); return(View()); } }
public ActionResult Edit(Profesion a) { if (!ModelState.IsValid) { return(View()); } try { using (var db = new ReservacionesEntities()) { Escuela al = db.Escuelas.Find(a.Id); al.Nombre = a.Nombre; var K = db.Usuarios.Single(u => u.Estado == "1"); if (K != null) { Auditoria(K.Cedula, "Escuela", "EDITO UNA PROFESION"); } db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("Error al Editar al Usuario", ex); return(View()); } }
public Profesion Get(int id) { Profesion profesion = null; try { var connection = new SqlConnection(connection_string); connection.Open(); var query = new SqlCommand("SELECT * FROM profesiones WHERE id = @id", connection); query.Parameters.AddWithValue("@id", id); var dr = query.ExecuteReader(); dr.Read(); if (dr.HasRows) { profesion = new Profesion(); profesion.id = Convert.ToInt32(dr["id"]); profesion.nombre = dr["nombre"].ToString(); } dr.Close(); connection.Close(); connection.Dispose(); } catch { throw; } return(profesion); }
public bool Add(Profesion profesion) { bool respuesta = false; try { var connection = new SqlConnection(connection_string); connection.Open(); var query = new SqlCommand("INSERT INTO profesiones(nombre) VALUES (@p0)", connection); query.Parameters.AddWithValue("@p0", profesion.nombre); query.ExecuteNonQuery(); connection.Close(); connection.Dispose(); respuesta = true; } catch { throw; } return(respuesta); }
protected void btnEditar_Click(object sender, EventArgs e) { if (txtNombre.Text != "") { int id = Convert.ToInt32(hfID.Value); string nombre = txtNombre.Text; Profesion profesion = new Profesion(); profesion.id = id; profesion.nombre = nombre; if (profesionDatos.Update(profesion)) { Application["mensaje"] = funcion.mensaje("Registro editado"); Response.Redirect("~/Forms/Profesiones/Index.aspx"); } else { Application["mensaje"] = funcion.mensaje("Error"); Response.Redirect("~/Forms/Profesiones/Editar.aspx?id=" + id); } } else { Application["mensaje"] = funcion.mensaje("Faltan datos"); Response.Redirect("~/Forms/Profesiones/Editar.aspx?id=" + Request.QueryString["id"]); } }
protected void btnAgregar_Click(object sender, EventArgs e) { if (txtNombre.Text != "") { string nombre = txtNombre.Text; Profesion profesion = new Profesion(); profesion.nombre = nombre; if (profesionDatos.Add(profesion)) { Application["mensaje"] = funcion.mensaje("Registro agregado"); Response.Redirect("~/Forms/Profesiones/Index.aspx"); } else { Application["mensaje"] = funcion.mensaje("Error"); Response.Redirect("~/Forms/Profesiones/Agregar.aspx"); } } else { Application["mensaje"] = funcion.mensaje("Faltan datos"); Response.Redirect("~/Forms/Profesiones/Agregar.aspx"); } }
public IHttpActionResult PutProfesion(int id, Profesion profesion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != profesion.Id) { return(BadRequest()); } db.Entry(profesion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProfesionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void ListadoProfesiones() { dgvProfesiones.AutoGenerateColumns = false; dgvProfesiones.DataSource = Profesion.ListarProfesiones(); dgvProfesiones.Columns[0].DataPropertyName = "ID_PROFESION"; dgvProfesiones.Columns[1].DataPropertyName = "NOMBRE_PROFESION"; }
public static bool ActualizarProfesion(Profesion prof) { string cadenaConexion = System.Configuration.ConfigurationManager.AppSettings["cadenaTP1"]; SqlConnection cn = new SqlConnection(cadenaConexion); bool resultado = false; try { SqlCommand cmd = new SqlCommand(); string consulta = "UPDATE profesiones SET nombre_profesion = @nombre_profesion WHERE id_profesion = @id_profesion"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@nombre_profesion", prof.nombreProfesion); cmd.Parameters.AddWithValue("@id_profesion", prof.id.ToString()); cmd.CommandType = CommandType.Text; cmd.CommandText = consulta; cn.Open(); cmd.Connection = cn; cmd.ExecuteNonQuery(); resultado = true; } catch (Exception) { throw; } finally { cn.Close(); } return(resultado); }
public static bool AgregaProfesionABD(Profesion prof) { string cadenaConexion = System.Configuration.ConfigurationManager.AppSettings["cadenaTP1"]; SqlConnection cn = new SqlConnection(cadenaConexion); bool resultado = false; try { SqlCommand cmd = new SqlCommand(); string consulta = "INSERT INTO profesiones (nombre_profesion) VALUES (@nombreProfesion)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@nombreProfesion", prof.nombreProfesion); cmd.CommandType = CommandType.Text; cmd.CommandText = consulta; cn.Open(); cmd.Connection = cn; cmd.ExecuteNonQuery(); resultado = true; } catch (Exception) { throw; } finally { cn.Close(); } return(resultado); }
private void ChangeProfessions(Profesion profesion, MaterialLabel proffesionLabel, Button proffesionButton) { ResourceManager rm = Properties.Resources.ResourceManager; Image proffesionImg = (Image)rm.GetObject(profesion.img); proffesionLabel.Text = profesion.name; proffesionButton.BackgroundImage = proffesionImg; }
public void ActualizarProfesion(string strID, string strDescripcion) { Profesion uProfesion = new Profesion(); uProfesion.ID = strID; uProfesion.Descripcion = strDescripcion; ProfesionBusiness.Actualizar(uProfesion); }
public ActionResult DeleteConfirmed(int id) { Profesion profesion = db.Profesion.Find(id); db.Profesion.Remove(profesion); db.SaveChanges(); return(RedirectToAction("Index")); }
private void Preselec_SelectionChanged(object sender, SelectionChangedEventArgs e) { p = (Profesion)preselec.SelectedItem; MessageBox.Show($"Profesion id: {p.id}"); nombreTextBox.Text = p.nombre; diminTextBox.Text = p.dimin; DescripTextBox.Text = p.descipcion; save_btn.IsEnabled = true; }
public Profesion GetProfesion(int idProfesion) { using (DBEntities_TP db = new DBEntities_TP()) { Profesion profesion = new Profesion(); profesion = db.Profesions.Find(idProfesion); return(profesion); } }
public ActionResult Edit([Bind(Include = "Id,nombreProfesion,Experiencia,conocimientos")] Profesion profesion) { if (ModelState.IsValid) { db.Entry(profesion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profesion)); }
public ActionResult Edit([Bind(Include = "idProfesion,descripcion")] Profesion profesion) { if (ModelState.IsValid) { db.Entry(profesion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profesion)); }
public ActionResult ConfirmarBorrar(int id) { Profesion profesion = profesionDatos.Get(id); if (profesion == null) { return(HttpNotFound()); } return(View("Borrar", profesion)); }
public ActionResult Edit(Profesion profesion) { if (ModelState.IsValid) { db.Entry(profesion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Create")); } return(View(profesion)); }
public IHttpActionResult GetProfesion(int id) { Profesion profesion = db.Profesions.Find(id); if (profesion == null) { return(NotFound()); } return(Ok(profesion)); }
public ActionResult Create([Bind(Include = "idProfesion,descripcion")] Profesion profesion) { if (ModelState.IsValid) { db.Profesion.Add(profesion); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profesion)); }
public ActionResult Edit([Bind(Include = "ProfesionId,CompanyClientId,Descripcion")] Profesion profesion) { if (ModelState.IsValid) { db.Entry(profesion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CompanyClientId = new SelectList(db.CompanyClient, "CompanyClientId", "RazonSocial", profesion.CompanyClientId); return(View(profesion)); }