public IHttpActionResult PutHABITACION(decimal id, HABITACION hABITACION) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hABITACION.HABITACION_NRO) { return(BadRequest()); } db.Entry(hABITACION).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HABITACIONExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteHospedaje(int?idH) { if (idH == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HOSPEDAJE hospedajeDta = Modelo_Generate.HOSPEDAJE.Find(idH); if (hospedajeDta == null) { return(HttpNotFound()); } else { try { HABITACION HabitacionSelect = Modelo_Generate.HABITACION.Find(hospedajeDta.Habitacion_id); HabitacionSelect.Disponibilidad = true; Modelo_Generate.Entry(HabitacionSelect).State = EntityState.Modified; Modelo_Generate.HOSPEDAJE.Remove(hospedajeDta); Modelo_Generate.SaveChanges(); } catch (Exception) { } return(RedirectToAction("ListadoHospedaje", "Hospe")); } }
public IHttpActionResult PostHABITACION(HABITACION hABITACION) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.HABITACIONs.Add(hABITACION); try { db.SaveChanges(); } catch (DbUpdateException) { if (HABITACIONExists(hABITACION.HABITACION_NRO)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = hABITACION.HABITACION_NRO }, hABITACION)); }
public void Agregar(HABITACION habitacion) { using (DBClinicaEntities db = new DBClinicaEntities()) { db.HABITACION.Add(habitacion); db.SaveChanges(); } }
public IHttpActionResult GetHABITACION(decimal id) { HABITACION hABITACION = db.HABITACIONs.Find(id); if (hABITACION == null) { return(NotFound()); } return(Ok(hABITACION)); }
public void EliminarHabitacion(int id) { ServiceHabitacion sh = new ServiceHabitacion(); HABITACION h = sh.getEntity(id); if (MessageBox.Show("Esta seguro de que desea eliminar la habitacion: " + h.NUMERO + "?", "Eliminar Habitacion", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes) { sh.delEntity(h.IDHABITACION); MessageBox.Show("Habitacion Eliminada", "Eliminar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public void Editar(HABITACION habitacion) { using (DBClinicaEntities db = new DBClinicaEntities()) { var p = db.HABITACION.Find(habitacion.ID_HABITACION); p.NOMBRE_HABITACION = habitacion.NOMBRE_HABITACION; p.DESCRIPCION = habitacion.DESCRIPCION; p.CAPACIDAD = habitacion.CAPACIDAD; p.ESTADO = habitacion.ESTADO; db.SaveChanges(); } }
public bool AgregarHabitacion(int numero, string tipoCama, string accesorios, int precio) { ServiceHabitacion sh = new ServiceHabitacion(); try { // Habitacion HABITACION h = new HABITACION(); h.IDHABITACION = sh.id(); h.NUMERO = numero; h.TIPO_CAMA = tipoCama; h.ACCESORIOS = accesorios; h.PRECIO = precio; h.IDADMINISTRADOR = 1; h.ESTADOHABITACION = 1; if (this.BuscarHabitacion((int)h.NUMERO) == false) { if ((int)h.NUMERO >= 0) { if (h.PRECIO >= 0) { sh.addEntity(h); MessageBox.Show("Habitacion Agregada.", "Agregar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Agregar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { MessageBox.Show("La habitacion: " + h.NUMERO + " debe ser mayor o igual a 0.", "Agregar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { MessageBox.Show("La habitacion: " + h.NUMERO + " ya existe.", "Agregar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } catch (Exception ex) { MessageBox.Show("No se pudo crear la habitacion.", "Crear Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public IHttpActionResult DeleteHABITACION(decimal id) { HABITACION hABITACION = db.HABITACIONs.Find(id); if (hABITACION == null) { return(NotFound()); } db.HABITACIONs.Remove(hABITACION); db.SaveChanges(); return(Ok(hABITACION)); }
public ActionResult DeleteConfirmed(string id) { HABITACION hABITACION = db.HABITACIONs.Find(id); USUARIO usuarioSesion = (USUARIO)Session["Usuario"]; hABITACION.NOMBRE = Util.Cypher.Decrypt(hABITACION.NOMBRE); hABITACION.DESCRIPCION = Util.Cypher.Decrypt(hABITACION.DESCRIPCION); String logDetalle = "IDHabitacion:" + hABITACION.ID_HABITACION + "Numero:" + hABITACION.NUMERO + "/Nombre:" + hABITACION.NOMBRE + "/Descripcion:" + hABITACION.DESCRIPCION + "/Foto:" + hABITACION.FOTO + "/Tipo Habitacion:" + hABITACION.TIPO_HABITACION + "/Precio:" + hABITACION.PRECIO; logDetalle = Util.Cypher.Encrypt(logDetalle); db.InsertBitacora(usuarioSesion.ID_USUARIO, 03, "Eliminar Habitacion", logDetalle, hABITACION.ID_HABITACION); db.HABITACIONs.Remove(hABITACION); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Habitacion/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HABITACION hABITACION = db.HABITACIONs.Find(id); hABITACION.NOMBRE = Util.Cypher.Decrypt(hABITACION.NOMBRE); hABITACION.DESCRIPCION = Util.Cypher.Decrypt(hABITACION.DESCRIPCION); if (hABITACION == null) { return(HttpNotFound()); } return(View(hABITACION)); }
public void LlenarCampos(int idHabitacion, TextBox numeroHabitacion, TextBox tipoCama, TextBox precio, ComboBox estadoHabitacion, TextBox accesorios, Label id) { ServiceHabitacion sh = new ServiceHabitacion(); ServiceEstadoHabitacion seh = new ServiceEstadoHabitacion(); this.LlenarComboEstado(estadoHabitacion); HABITACION h = sh.getEntity(idHabitacion); numeroHabitacion.Text = h.NUMERO.ToString(); tipoCama.Text = h.TIPO_CAMA; precio.Text = h.PRECIO.ToString(); accesorios.Text = h.ACCESORIOS; id.Text = h.IDHABITACION.ToString(); estadoHabitacion.SelectedIndex = (int)h.ESTADOHABITACION1.IDESTADO - 1; }
public ActionResult Edit([Bind(Include = "ID_HABITACION,NUMERO,NOMBRE,DESCRIPCION,FOTO,TIPO_HABITACION,ID_PRECIO,DISPONIBLE")] HABITACION hABITACION) { if (ModelState.IsValid) { USUARIO usuarioSesion = (USUARIO)Session["Usuario"]; String logDetalle = "IDHabitacion:" + hABITACION.ID_HABITACION + "Numero:" + hABITACION.NUMERO + "/Nombre:" + hABITACION.NOMBRE + "/Descripcion:" + hABITACION.DESCRIPCION + "/Foto:" + hABITACION.FOTO + "/Tipo Habitacion:" + hABITACION.TIPO_HABITACION + "/Precio:" + hABITACION.ID_PRECIO; logDetalle = Util.Cypher.Encrypt(logDetalle); hABITACION.NOMBRE = Util.Cypher.Encrypt(hABITACION.NOMBRE); hABITACION.DESCRIPCION = Util.Cypher.Encrypt(hABITACION.DESCRIPCION); db.InsertBitacora(usuarioSesion.ID_USUARIO, 02, "Modificar Habitacion", logDetalle, hABITACION.ID_HABITACION); db.Entry(hABITACION).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_PRECIO = new SelectList(db.PRECIOs, "ID_PRECIO", "TIPO_PRECIO", hABITACION.ID_PRECIO); ViewBag.TIPO_HABITACION = new SelectList(db.TIPO_HABITACION, "ID_TIPO_HABITACION", "NOMBRE", hABITACION.TIPO_HABITACION); return(View(hABITACION)); }
public bool ModificarHabitacion(int id, int numero, string tipoCama, int precio, string estado, string accesorios) { ServiceHabitacion sh = new ServiceHabitacion(); ServiceEstadoHabitacion seh = new ServiceEstadoHabitacion(); ESTADOHABITACION eh = seh.getEntityDesc(estado); HABITACION h = new HABITACION(); h.IDHABITACION = id; h.NUMERO = numero; h.TIPO_CAMA = tipoCama; h.PRECIO = precio; h.ESTADOHABITACION = eh.IDESTADO; h.ACCESORIOS = accesorios; if (this.BuscarHabitacion((int)h.NUMERO) == false) { if (h.NUMERO >= 0) { if (h.PRECIO >= 0) { sh.updEntity(h); MessageBox.Show("Habitacion Modificada.", "Modificar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Modificar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { MessageBox.Show("La habitacion: " + h.NUMERO + " debe ser mayor o igual a 0.", "Modificar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { MessageBox.Show("La habitacion: " + h.NUMERO + " ya existe.", "Modificar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public ActionResult Create([Bind(Include = "ID_HABITACION,NUMERO,NOMBRE,DESCRIPCION,FOTO,TIPO_HABITACION,ID_PRECIO,DISPONIBLE")] HABITACION hABITACION) { if (ModelState.IsValid) { USUARIO usuarioSesion = (USUARIO)Session["Usuario"]; String logDetalle = "Numero:" + hABITACION.NUMERO + "/Nombre:" + hABITACION.NOMBRE + "/Descripcion:" + hABITACION.DESCRIPCION + "/Disponible: " + hABITACION.DISPONIBLE + "/Foto:" + hABITACION.FOTO + "/Tipo Habitacion:" + hABITACION.TIPO_HABITACION + "/Precio:" + hABITACION.ID_PRECIO; hABITACION.NOMBRE = Util.Cypher.Encrypt(hABITACION.NOMBRE); hABITACION.DESCRIPCION = Util.Cypher.Encrypt(hABITACION.DESCRIPCION); logDetalle = Util.Cypher.Encrypt(logDetalle); db.InsertHabitacion(hABITACION.NUMERO, hABITACION.NOMBRE, hABITACION.TIPO_HABITACION, hABITACION.ID_PRECIO, hABITACION.DESCRIPCION, hABITACION.FOTO, hABITACION.DISPONIBLE, usuarioSesion.ID_USUARIO, 1, "Crear Habitacion", logDetalle); //db.HABITACIONs.Add(hABITACION); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_PRECIO = new SelectList(db.PRECIOs, "ID_PRECIO", "TIPO_PRECIO", hABITACION.ID_PRECIO); ViewBag.TIPO_HABITACION = new SelectList(db.TIPO_HABITACION, "ID_TIPO_HABITACION", "NOMBRE", hABITACION.TIPO_HABITACION); return(View(hABITACION)); }
// GET: Habitacion/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HABITACION hABITACION = db.HABITACIONs.Find(id); hABITACION.NOMBRE = Util.Cypher.Decrypt(hABITACION.NOMBRE); hABITACION.DESCRIPCION = Util.Cypher.Decrypt(hABITACION.DESCRIPCION); if (hABITACION == null) { return(HttpNotFound()); } var PreciosNuevo = new List <SelectListItem>(); List <PRECIO> precios = db.PRECIOs.ToList(); foreach (PRECIO i in precios) { var nuevo = new SelectListItem(); nuevo.Value = i.ID_PRECIO; nuevo.Text = Util.Cypher.Decrypt(i.TIPO_PRECIO); PreciosNuevo.Add(nuevo); } var TipoHabitacionNuevo = new List <SelectListItem>(); List <TIPO_HABITACION> Tipos = db.TIPO_HABITACION.ToList(); foreach (TIPO_HABITACION i in Tipos) { var nuevo = new SelectListItem(); nuevo.Value = (i.ID_TIPO_HABITACION).ToString(); nuevo.Text = Util.Cypher.Decrypt(i.NOMBRE); TipoHabitacionNuevo.Add(nuevo); } ViewBag.TIPO_HABITACION = TipoHabitacionNuevo; ViewBag.ID_PRECIO = PreciosNuevo; return(View(hABITACION)); }
static void Main(string[] args) { CLIENTE datoscliente = new CLIENTE(9999999, " ", new List <RESERVA>()); RESERVA reservacion1 = new RESERVA(23, "18noviembre2019", datoscliente, new List <HABITACIONPORRESERVA>()); //datoscliente.Reserva.Add(1, "fecha", " cliente", ); datoscliente.Reserva.Add(reservacion1); HABITACION habitacion1 = new HABITACION(30); habitacion1.Habitacion.Add(habitacion1); HABITACION habitacion2 = new HABITACION(304); habitacion2.Habitacion.Add(habitacion2); SERVICIOSEXTRA servicio1 = new SERVICIOSEXTRA("TV Cable"); ERVICIOSEXTRA servicio2 = new SERVICIOSEXTRA("TV Cable"); servicios.Nombre.Add(servicio1 -); servicios.Nombre.Add(servicio2); Console.WriteLine("Cliente 10%", " ", "Reservas20%", " ", "Habitaciones30% ", " ", " Servicios40%"); }
public ActionResult Hospedaje(HOSPEDAJE hospedaje) { if (ModelState.IsValid) { try { HABITACION HabitacionSelect = Modelo_Generate.HABITACION.Find(hospedaje.Habitacion_id); HabitacionSelect.Disponibilidad = false; Modelo_Generate.Entry(HabitacionSelect).State = EntityState.Modified; Modelo_Generate.HOSPEDAJE.Add(hospedaje); Modelo_Generate.SaveChanges(); return(RedirectToAction("ListadoHospedaje", "Hospe")); } catch (Exception) { } } else { ViewBag.error = "Existen Campos invalidos, revisar"; } return(RedirectToAction("Hospedaje")); }
public static void Editar(HABITACION habitacion) { obj.Editar(habitacion); }
public static void Agregar(HABITACION habitacion) { obj.Agregar(habitacion); }
public ApiResultModel <HABITACION> Update([FromBody] HABITACION aux) => GetApiResultModel(() => _roomService.Update(aux));
public ActionResult Create(HABITACION habitacion) { HabitacionBLL.Agregar(habitacion); return(View("~/Views/Habitacion/Habitacion.cshtml", habitacion)); }
public ActionResult Editar(HABITACION habitacion) { return(View(habitacion)); }
public ApiResultModel <bool> Delete([FromBody] HABITACION aux) => GetApiResultModel(() => _roomService.Delete(aux));