Пример #1
0
        public List <CGestion_camarote> listarCamarotes(int idCabina)
        {
            List <CGestion_camarote> listaCamarote = new List <CGestion_camarote>();
            CGestion_camarote        camarote;

            try
            {
                Conectar();
                using (comando = new SqlCommand(RecursosCruceros.ListarCamarote, conexion))
                {
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.Parameters.AddWithValue("@idCabina", idCabina);
                    conexion.Open();
                    //comando.ExecuteNonQuery();
                    SqlDataReader reader = comando.ExecuteReader();

                    while (reader.Read())
                    {
                        camarote               = new CGestion_camarote();
                        camarote._idCamarote   = int.Parse(reader["id"].ToString());
                        camarote._cantidadCama = int.Parse(reader["cantidadCama"].ToString());
                        camarote._tipoCama     = reader["tipoCama"].ToString();
                        camarote._estatus      = reader["estatus"].ToString();
                        listaCamarote.Add(camarote);
                    }
                    reader.Close();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(listaCamarote);
        }
Пример #2
0
        public Boolean insertarCamarote(CGestion_camarote camarote)
        {
            try
            {
                Conectar();
                using (comando = new SqlCommand(RecursosCruceros.AgregarCamarote, conexion))
                {
                    comando.CommandType = CommandType.StoredProcedure;

                    comando.Parameters.AddWithValue("@cantidad_camas", camarote._cantidadCama);
                    comando.Parameters.AddWithValue("@tipo_cama", camarote._tipoCama);
                    comando.Parameters.AddWithValue("@fk_id_cabina", camarote._fkCabina);
                    conexion.Open();
                    comando.ExecuteNonQuery();
                    conexion.Close();
                    return(true);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Пример #3
0
        public void AgregarCamarote(CGestion_camarote camarote)
        {
            ConexionBD cbd = new ConexionBD();

            cbd.insertarCamarote(camarote);
        }