private void btnGuardar_Click(object sender, EventArgs e) { try { ValidateForm(); if (_editObject == null || _editObject.Id == 0) { _editObject = new Model.Estadia(0, _reserva, _session.User, Tools.GetDate(), null, null); _clientes.Add(_reserva.Cliente); } else { _editObject.UsuarioSalida = _session.User; _editObject.Reserva = _reserva; _editObject.FechaSalida = dtFin.Value; } _editObject.Huespedes = _clientes; DAO.DAOFactory.EstadiaDAO.RegistrarEstadia(_editObject); Close(); } catch (Exception ex) { string message = ex.Message; string caption = "Error:"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
private void BindReserva() { txtCodigo.Text = _reserva.Id.ToString(); txtCliente.Text = _reserva.Cliente.Persona.Nombre + " " + _reserva.Cliente.Persona.Apellido; txtCodigo.ReadOnly = true; txtCliente.ReadOnly = true; _editObject = GetEstadiaxReserva(); if (_editObject != null) { _clientes = _editObject.Huespedes; dtFin.Visible = true; lblCheckout.Visible = true; btnAddClientes.Enabled = false; } BindClientes(); }