Exemplo n.º 1
0
 public List <Persona> ListarTodo()
 {
     try
     {
         List <Persona> lstHuespeds = new List <Persona>();
         Huesped        huesped     = null;
         SqlConnection  con         = db.ConectaDb();
         SqlCommand     cmd         = new SqlCommand("select IdHuesped,Nombre,Apellido,Email,Telefono,Dni,NroTarjeta from Huesped ", con);
         SqlDataReader  reader      = cmd.ExecuteReader();
         while (reader.Read())
         {
             huesped            = new Huesped();
             huesped.IdPersona  = (int)reader["IdHuesped"];
             huesped.Nombre     = (string)reader["Nombre"];
             huesped.Apellido   = (string)reader["Apellido"];
             huesped.Email      = (string)reader["Email"];
             huesped.Telefono   = (string)reader["Telefono"];
             huesped.Dni        = (string)reader["Dni"];
             huesped.NroTarjeta = (string)reader["NroTarjeta"];
             lstHuespeds.Add(huesped);
         }
         reader.Close();
         return(lstHuespeds);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
         db.DesconectaDb();
     }
 }
Exemplo n.º 2
0
 public List <Reserva> ListarReservaHuesped(Huesped o)
 {
     try
     {
         List <Reserva> lstreservas = new List <Reserva>();
         Reserva        reserva     = null;
         SqlConnection  conn        = db.ConectaDb();
         string         select      = string.Format("select r.IdReserva,r.FechaIng,r.FechaSal,r.Total, from Reserva as r, Huesped as h where r.IdHuesped=h.IdHuesped and h.Nombre like '%{0}%'", o.Nombre);
         SqlCommand     cmd         = new SqlCommand(select, conn);
         SqlDataReader  reader      = cmd.ExecuteReader();
         while (reader.Read())
         {
             reserva           = new Reserva();
             reserva.IdReserva = (int)reader["IdReserva"];
             reserva.FechaIng  = (DateTime)reader["FechaIng"];
             reserva.FechaSal  = (DateTime)reader["FechaSal"];
             reserva.Total     = (decimal)reader["Total"];
             lstreservas.Add(reserva);
         }
         reader.Close();
         return(lstreservas);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
         db.DesconectaDb();
     }
 }
Exemplo n.º 3
0
 public Persona BuscarPorId(int id)
 {
     try
     {
         Huesped       huesped = null;
         SqlConnection con     = db.ConectaDb();
         string        select  = string.Format("select IdHuesped,Nombre,Apellido,Email,Telefono,Dni,NroTarjeta from Huesped where IdHuesped='{0}' order by IdHuesped asc", id);
         SqlCommand    cmd     = new SqlCommand(select, con);
         SqlDataReader reader  = cmd.ExecuteReader();
         if (reader.Read())
         {
             huesped            = new Huesped();
             huesped.IdPersona  = (int)reader["IdHuesped"];
             huesped.Nombre     = (string)reader["Nombre"];
             huesped.Apellido   = (string)reader["Apellido"];
             huesped.Email      = (string)reader["Email"];
             huesped.Telefono   = (string)reader["Telefono"];
             huesped.Dni        = (string)reader["Dni"];
             huesped.NroTarjeta = (string)reader["NroTarjeta"];
         }
         reader.Close();
         return(huesped as Persona);
     }
     catch (Exception ex)
     {
         return(null);
     }
     finally
     {
         db.DesconectaDb();
     }
 }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("HuespedId,Nombre,NombreAereolin,HoraDeLlegada,CantAcompañantes")] Huesped huesped)
        {
            if (id != huesped.HuespedId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(huesped);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HuespedExists(huesped.HuespedId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(huesped));
        }
Exemplo n.º 5
0
        public bool Delete(int id)
        {
            Huesped h = this.FindById(id);

            //return (h != null && h.Delete());
            return(false);
        }
Exemplo n.º 6
0
        private void btnBuscarHuesped_Click(object sender, EventArgs e)
        {
            frmFiltroHuesped ofrmFiltroHuesped = new frmFiltroHuesped();
            Huesped          oHuesped          = null;

            try
            {
                ofrmFiltroHuesped.ShowDialog();

                if (ofrmFiltroHuesped.DialogResult == DialogResult.OK)
                {
                    oHuesped = ofrmFiltroHuesped._Huesped;
                    this.txtHuespedId.Text = oHuesped.ID.ToString();
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        public string Ingresar(Huesped huesped)
        {
            string        rpta = "Like";
            IDbConnection conn = Connection;

            try
            {
                DynamicParameters dp = new DynamicParameters();
                dp.Add("@nombre", huesped.nombre);
                dp.Add("@departamento", huesped.departamento);
                dp.Add("@direccion", huesped.direccion);
                dp.Add("@edad", huesped.edad);
                dp.Add("@phone", huesped.phone);
                dp.Add("@descripcion", huesped.descripcion);
                dp.Add("@fecha_i", huesped.fecha_i);
                dp.Add("@fecha_f", huesped.fecha_f);
                dp.Add("@porque", huesped.porque);
                dp.Add("@valides", huesped.valides);
                conn.Execute("AGREGAR_HUESPED", dp, commandType: CommandType.StoredProcedure);
            }
            catch (Exception e)
            {
                rpta = "Excepción encontrada: " + e.Message;
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(rpta);
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,DocIdentificacion,Nombre,Apellido")] Huesped huesped)
        {
            if (id != huesped.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    //_context.Update(huesped);
                    //await _context.SaveChangesAsync();
                    await _context.Huesped.ReplaceOneAsync(filter : g => g.Id == huesped.Id, replacement : huesped);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HuespedExists(huesped.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(huesped));
        }
Exemplo n.º 9
0
 private void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvDatos.RowCount > 0 && dgvDatos.SelectedRows.Count > 0)
         {
             if (dgvDatos.CurrentCell.Selected)
             {
                 _Huesped          = dgvDatos.SelectedRows[0].DataBoundItem as Huesped;
                 this.DialogResult = DialogResult.OK;
             }
         }
     }
     catch (Exception er)
     {
         StringBuilder msg = new StringBuilder();
         msg.AppendFormat("Message        {0}\n", er.Message);
         msg.AppendFormat("Source         {0}\n", er.Source);
         msg.AppendFormat("InnerException {0}\n", er.InnerException);
         msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
         msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
         _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
         MessageBox.Show(msg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 10
0
        private void botonBuscar_Click(object sender, EventArgs e)
        {
            limpiar();
            if (textEstadia.Text == "")
            {
                showToolTip("Ingrese un número de reserva.", textEstadia, textEstadia.Location);
                return;
            }
            reserva_seleccionada = DAOReserva.obtener(Int32.Parse(textEstadia.Text));
            if (reserva_seleccionada == null)
            {
                showToolTip("Ingrese un número de reserva válido.", textEstadia, textEstadia.Location);
                return;
            }
            //DAOReserva
            if (reserva_seleccionada.Estado > 2 && reserva_seleccionada.Estado < 6)
            {
                MessageBox.Show("La reserva seleccionada se encuentra cancelada.", "", MessageBoxButtons.OK);
                return;
            }

            datos_huesped       = DAOHuesped.obtener(reserva_seleccionada.Huesped);
            textHuesped.Text    = datos_huesped.Nombre + " " + datos_huesped.Apellido;
            textFecReserva.Text = reserva_seleccionada.Fecha_Reserva_struct.Value.ToShortDateString();
            textFecInicio.Text  = reserva_seleccionada.Fecha_Inicio_struct.Value.ToShortDateString();
            textFecFin.Text     = reserva_seleccionada.Fecha_Fin_struct.Value.ToShortDateString();
        }
Exemplo n.º 11
0
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     toolTip.Hide(this.textApellido);
     if (chequearDatos())
     {
         Huesped huesped = new Huesped();
         huesped.Nombre = textNombre.Text;
         huesped.Apellido = textApellido.Text;
         huesped.TipoDocu = Documento.string_docu[comboTipoDoc.SelectedIndex];
         huesped.NroDocu = Int32.Parse(textNumDoc.Text);
         huesped.Fecha_nacimiento = dateTimeNacimiento.Text;
         huesped.Mail = textMail.Text;
         huesped.Telefono = Int32.Parse(textTelefono.Text);
         huesped.Direccion.calle_direccion = textDirCalle.Text;
         huesped.Direccion.calle_altura = Int32.Parse(textDirAltura.Text);
         if (textDirPiso.Text != "")
             huesped.Direccion.calle_piso = Int32.Parse(textDirPiso.Text);
         if (textDirDpto.Text != "")
             huesped.Direccion.calle_dpto = textDirDpto.Text;
         huesped.Localidad = textLocalidad.Text;
         huesped.Nacionalidad = (string) textPais.SelectedItem;
         if (!DAOHuesped.insertar(huesped))
         {
             MessageBox.Show("Error al crear el cliente.", "Error al crear Nuevo Cliente",
             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("Cliente Creado Correctamente.", "Nuevo Cliente",
             MessageBoxButtons.OK, MessageBoxIcon.None);
             //((ClienteBajaMod)Globals.VentanaAnterior).updateGrid();
             this.Close();
         }
     }
 }
Exemplo n.º 12
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         string          MyConnection2 = "server=localhost; database=hostal; Uid=root; pwd=root";
         string          Query         = "update hostal.huesped set PrimerNombre='" + this.txtPrimerNombre.Text + "',SegundoNombre='" + this.txtSegundoNombre.Text + "',PrimerApellido='" + this.txtPrimerApellido.Text + "',SegundoApellido='" + this.txtSegundoApellido.Text + "' where IdHuesped='" + this.txtIdHuesped.Text + "';";
         MySqlConnection MyConn2       = new MySqlConnection(MyConnection2);
         MySqlCommand    MyCommand2    = new MySqlCommand(Query, MyConn2);
         MySqlDataReader MyReader2;
         MyConn2.Open();
         MyReader2 = MyCommand2.ExecuteReader();
         MessageBox.Show("El cliente ha sido modificado.");
         dgvHuespedess.DataSource = null;
         dgvHuespedess.DataSource = obj.VistaTabla();
         Huesped limpiar = new Huesped();
         limpiar.BorrarCampos(this, groupBox1);
         //cbxTipoIdentificacion.Items.Clear();
         //cbxTipoIdentificacion.SelectedIndex = 0;
         while (MyReader2.Read())
         {
         }
         MyConn2.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 13
0
        public List <Huesped> FindAll()
        {
            string         cadenaFindAll  = "SELECT fecha_ini, fecha_fin FROM Reserva";
            List <Huesped> listaHuespedes = new List <Huesped>();

            using (SqlConnection cn = BdSQL.Conectar())
            {
                using (SqlCommand cmd = new SqlCommand(cadenaFindAll, cn))
                {
                    cn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            Huesped unH = new Huesped();
                            unH.Load(reader);
                            if (unH.Validar())
                            {
                                listaHuespedes.Add(unH);
                            }
                        }
                    }
                }
            }
            return(listaHuespedes);
        }
Exemplo n.º 14
0
        private void BtnAñadirFinal_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text == "" || txtApellido.Text == "" || txtNumeroDocumento.Text == "" || comboBoxTipoDocumento.SelectedItem == null)
            {
                MessageBox.Show("Rellene los campos antes de continuar");
            }
            else
            {
                String   nombre;
                String   apellido;
                String   tipoDocumento;
                int      numeroDocumento;
                DateTime fechaNacimiento;

                Huesped huesped;

                nombre          = txtNombre.Text.Trim();
                apellido        = txtApellido.Text.Trim();
                tipoDocumento   = Convert.ToString(comboBoxTipoDocumento.SelectedItem);
                numeroDocumento = Convert.ToInt32(txtNumeroDocumento.Text);
                fechaNacimiento = dtFechaNac.Value;

                huesped = new Huesped(nombre, apellido, tipoDocumento, numeroDocumento, fechaNacimiento);

                ServicioLista.AdicionarNodoFinalLista(huesped);

                MessageBox.Show("Estudiante adicionado!");
                txtNombre.Text   = "";
                txtApellido.Text = "";
                tipoDocumento.Trim();
                txtNumeroDocumento.Text = "";

                txtNombre.Focus();
            }
        }
Exemplo n.º 15
0
        private void ModificarReserva_Load(object sender, EventArgs e)
        {
            textNroReserva.Text = reserva_elegida.CodigoReserva.ToString();
            Huesped huesped = DAOHuesped.obtener(reserva_elegida.Huesped);

            if (huesped == null)
            {
                MessageBox.Show("Error al obtener los datos de la Base de Datos. Se volverá a la ventana anterior.",
                                "", MessageBoxButtons.OK);
                this.Close();
                return;
            }
            textHuesped.Text = huesped.Nombre + " " + huesped.Apellido;

            lista_regimenes = DAORegimen.obtenerByHotel(hotel.CodHotel);
            regimen_elegido = DAORegimen.obtener(reserva_elegida.CodigoRegimen);

            tipos_habitacion = DAOHabitacion.obtenerTipoTodos();
            tipo_elegido     = DAOHabitacion.obtenerTipoByReserva(reserva_elegida.CodigoReserva);

            //Rellenar Tipo Habitacion
            foreach (Tipo_Habitacion tipo in tipos_habitacion)
            {
                comboTipoHab.Items.Add(tipo.Descripcion);
            }
            //Rellenar Regimenes
            foreach (Regimen reg in lista_regimenes)
            {
                comboTipoRegimen.Items.Add(reg.Descripcion);
            }
            limpiarDatos();
        }
Exemplo n.º 16
0
        public ActionResult DeleteConfirmed(int id)
        {
            Huesped huesped = db.Huesped.Find(id);

            db.Huesped.Remove(huesped);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 17
0
 public string Post([FromBody] Huesped huesped)
 {
     if (ModelState.IsValid)
     {
         return(_huespedRepo.Ingresar(huesped));
     }
     return("Error");
 }
Exemplo n.º 18
0
        public List <Huesped> GetAllHuesped()
        {
            DataSet        ds      = null;
            List <Huesped> lista   = new List <Huesped>();
            SqlCommand     command = new SqlCommand();
            IDALPais       _Pais   = new DALPais();

            string sql = @"usp_SELECT_Huesped_All";

            try
            {
                command.CommandText = sql;
                command.CommandType = CommandType.StoredProcedure;

                using (IDataBase db = FactoryDataBase.CreateDataBase(FactoryConexion.CreateConnection(_Usuario.Login, _Usuario.Password)))
                {
                    ds = db.ExecuteReader(command, "query");
                }


                // Si devolvió filas
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //// Iterar en todas las filas y Mapearlas


                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        Huesped oHuesped = new Huesped();
                        oHuesped.ID        = (int)dr["ID"];
                        oHuesped.Nombre    = dr["Nombre"].ToString();
                        oHuesped.Apellido1 = dr["Apellido1"].ToString();
                        oHuesped.Apellido2 = dr["Apellido2"].ToString();
                        oHuesped.Telefono  = dr["Telefono"].ToString();
                        oHuesped.Correo    = dr["Correo"].ToString();
                        oHuesped._Pais     = _Pais.GetPaisById(Double.Parse(dr["IDPais"].ToString()));
                        lista.Add(oHuesped);
                    }
                }

                return(lista);
            }
            catch (SqlException sqlError)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateSQLExceptionsErrorDetails(sqlError));
                msg.AppendFormat("SQL             {0}\n", command.CommandText);
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateGenericErrorExceptionDetail(er));
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
        }
Exemplo n.º 19
0
        public Huesped GetHuespedById(double pIdHuesped)
        {
            DataSet    ds       = null;
            Huesped    oHuesped = new Huesped();
            SqlCommand command  = new SqlCommand();

            IDALPais _DALPais = new DALPais();


            string sql = @"select * from [Huesped] where ID = @ID";

            try
            {
                command.Parameters.AddWithValue("@ID", pIdHuesped);
                command.CommandText = sql;
                command.CommandType = CommandType.Text;

                using (IDataBase db = FactoryDataBase.CreateDataBase(FactoryConexion.CreateConnection(_Usuario.Login, _Usuario.Password)))
                {
                    ds = db.ExecuteReader(command, "query");
                }

                // Si devolvió filas
                if (ds.Tables[0].Rows.Count > 0)
                {
                    // Iterar en todas las filas y Mapearlas
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        oHuesped.ID        = (int)dr["ID"];
                        oHuesped.Nombre    = dr["Nombre"].ToString();
                        oHuesped.Apellido1 = dr["Apellido1"].ToString();
                        oHuesped.Apellido2 = dr["Apellido2"].ToString();
                        oHuesped.Telefono  = dr["Telefono"].ToString();
                        oHuesped.Correo    = dr["Correo"].ToString();
                        oHuesped._Pais     = _DALPais.GetPaisById(Double.Parse(dr["IDPais"].ToString()));
                    }
                }

                return(oHuesped);
            }
            catch (SqlException sqlError)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateSQLExceptionsErrorDetails(sqlError));
                msg.AppendFormat("SQL             {0}\n", command.CommandText);
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateGenericErrorExceptionDetail(er));
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
        }
Exemplo n.º 20
0
        public void ConocerLaFelicidadDeWilliam405k()
        {
            var listaAmigos = new List <Personaje>();
            var dolores     = new Anfitrion(90, 0.8f, new List <Recuerdo>());

            listaAmigos.Add(dolores);
            var william = new Huesped(3600, listaAmigos);

            Assert.Equal(403200, william.Felicidad());
        }
Exemplo n.º 21
0
        public async Task <IActionResult> Create([Bind("HuespedId,Nombre,NombreAereolin,HoraDeLlegada,CantAcompañantes")] Huesped huesped)
        {
            if (ModelState.IsValid)
            {
                _context.Add(huesped);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(huesped));
        }
Exemplo n.º 22
0
 public ActionResult Edit([Bind(Include = "id_huesped,nombre,direccion,dui,telefono,correo,id_tipo_huesped")] Huesped huesped)
 {
     if (ModelState.IsValid)
     {
         db.Entry(huesped).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_tipo_huesped = new SelectList(db.Tipo_huesped, "id_tipo_huesped", "tipo", huesped.id_tipo_huesped);
     return(View(huesped));
 }
Exemplo n.º 23
0
        private void actualizar2()
        {
            Huesped a = cbHuesped.SelectedItem as Huesped;

            foreach (Reserva b in gr.ListarReservas())
            {
                if (a.IdPersona == b.huesped.IdPersona)
                {
                    dgHabitacionesAsignadas.ItemsSource = b.lineareserva;
                }
            }
        }
Exemplo n.º 24
0
 private void btnEliminarHuesped_Click(object sender, RoutedEventArgs e)
 {
     if (dgHuespedes.SelectedItems.Count == 1)
     {
         Huesped huespedseleccionado = dgHuespedes.SelectedItem as Huesped;
         gp.EliminarHuesped((huespedseleccionado).IdPersona);
     }
     else
     {
         MessageBox.Show("Debe seleccionar solo 1 huesped");
     }
 }
Exemplo n.º 25
0
 public static void EliminarInicio()
 {
     // 1><1><1>
     if (cabecera.GetSiguiente() == null)
     {
         cabecera = null;
     }
     else
     {
         cabecera.GetSiguiente().SetAnterior(null);
         cabecera = cabecera.GetSiguiente();
     }
 }
Exemplo n.º 26
0
        public void CalcularComplejidadDelEscenarioQueEs1()
        {
            var escenario  = new Escenario(" ", new Estandar());
            var dolores    = new Anfitrion(110, 1f, new List <Recuerdo>());
            var william    = new Huesped(3600, new List <Personaje>());
            var personajes = new List <Personaje>();

            personajes.Add(dolores);
            personajes.Add(william);
            var unaTrama = new Trama(personajes, escenario);

            Assert.Equal(1f, unaTrama.ComplejidadDelEscenario());
        }
Exemplo n.º 27
0
        public async Task <IActionResult> Create([Bind("id,DocIdentificacion,Nombre,Apellido")] Huesped huesped)
        {
            if (ModelState.IsValid)
            {
                //_context.Add(huesped);
                await _context.Huesped.InsertOneAsync(huesped);

                //await _context.SaveChangesAsync();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(huesped));
            //await _context.SaveChangesAsync();
        }
Exemplo n.º 28
0
        // GET: Huespeds/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Huesped huesped = db.Huesped.Find(id);

            if (huesped == null)
            {
                return(HttpNotFound());
            }
            return(View(huesped));
        }
Exemplo n.º 29
0
 public static void AdicionarNodoInicioLista(Huesped pHuespedes)
 {
     if (cabecera != null)
     {   //1><1
         cabecera.SetAnterior(pHuespedes);
         pHuespedes.SetSiguiente(cabecera);
         cabecera = pHuespedes;
     }
     //1><1>
     else
     {
         cabecera = pHuespedes;
     }
 }
Exemplo n.º 30
0
        private void btnRegistrar_Click(object sender, RoutedEventArgs e)
        {
            Huesped o = new Huesped()
            {
                Nombre     = txtNombre.Text,
                Apellido   = txtApellidos.Text,
                Dni        = txtDNI.Text,
                Email      = txtEmail.Text,
                Telefono   = txtTelefono.Text,
                NroTarjeta = txtCredito.Text
            };

            MessageBox.Show(gp.RegistrarHuesped(o));
        }
Exemplo n.º 31
0
        public Huesped UpdateHuesped(Huesped pHuesped)
        {
            Huesped    _Huesped = null;
            string     sql      = @"usp_UPDATE_Huesped";
            SqlCommand cmd      = new SqlCommand();
            double     rows     = 0;

            try
            {
                cmd.Parameters.AddWithValue("@ID", pHuesped.ID);
                cmd.Parameters.AddWithValue("@Nombre", pHuesped.Nombre);
                cmd.Parameters.AddWithValue("@Apellido1", pHuesped.Apellido1);
                cmd.Parameters.AddWithValue("@Apellido2", pHuesped.Apellido2);
                cmd.Parameters.AddWithValue("@Telefono", pHuesped.Telefono);
                cmd.Parameters.AddWithValue("@Correo", pHuesped.Correo);
                cmd.Parameters.AddWithValue("@IDPais", pHuesped._Pais.ID);
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.StoredProcedure;


                using (IDataBase db = FactoryDataBase.CreateDataBase(FactoryConexion.CreateConnection(_Usuario.Login, _Usuario.Password)))
                {
                    rows = db.ExecuteNonQuery(cmd, IsolationLevel.ReadCommitted);
                }

                // Si devuelve filas quiere decir que se salvo entonces extraerlo
                if (rows > 0)
                {
                    _Huesped = GetHuespedById(pHuesped.ID);
                }

                return(_Huesped);
            }
            catch (SqlException sqlError)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateSQLExceptionsErrorDetails(sqlError));
                msg.AppendFormat("SQL             {0}\n", cmd.CommandText);
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat(Utilitarios.CreateGenericErrorExceptionDetail(er));
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                throw;
            }
        }
Exemplo n.º 32
0
 public ClienteMod(int idHuesped)
 {
     InitializeComponent();
     huesped_seleccionado = DAOHuesped.obtener(idHuesped);
     if (huesped_seleccionado == null)
     {
         MessageBox.Show("Error al cargar el cliente.", "Error al Modificar Cliente",
             MessageBoxButtons.OK, MessageBoxIcon.Error);
         Globals.habilitarAnterior();
         this.Dispose();
     }
     foreach (string tipo in Documento.string_docu)
         comboTipoDoc.Items.Add(tipo);
     foreach (string pais in Globals.paises)
         textPais.Items.Add(pais);
 }