Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            error.Text           = "";
            exito.Text           = "";
            alerta_exito.Visible = false;
            alerta.Visible       = false;

            //Cargando DDL Tipo Plato
            Service1      service         = new Service1();
            string        tipo_habitacion = service.ListarTipoHabitacion();
            XmlSerializer ser             = new XmlSerializer(typeof(Modelo.TipoHabitacionCollection));
            StringReader  reader          = new StringReader(tipo_habitacion);

            Modelo.TipoHabitacionCollection coleccionTipoHabitacion = (Modelo.TipoHabitacionCollection)ser.Deserialize(reader);
            reader.Close();


            if (!IsPostBack)
            {
                ddlTipo.DataSource     = coleccionTipoHabitacion;
                ddlTipo.DataTextField  = "NOMBRE_TIPO_HABITACION";
                ddlTipo.DataValueField = "ID_TIPO_HABITACION";
                ddlTipo.DataBind();

                ddlEstado.Items.Add("Disponible");
                ddlEstado.Items.Add("Ocupada");
                ddlEstado.Items.Add("Mantenimiento");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            error.Text           = "";
            exito.Text           = "";
            alerta_exito.Visible = false;
            alerta.Visible       = false;

            //Cargando DDL Tipo Plato
            Service1      service         = new Service1();
            string        tipo_habitacion = service.ListarTipoHabitacion();
            XmlSerializer ser             = new XmlSerializer(typeof(Modelo.TipoHabitacionCollection));
            StringReader  reader          = new StringReader(tipo_habitacion);

            Modelo.TipoHabitacionCollection coleccionTipoHabitacion = (Modelo.TipoHabitacionCollection)ser.Deserialize(reader);
            reader.Close();

            if (!IsPostBack)
            {
                ddlTipo.DataSource     = coleccionTipoHabitacion;
                ddlTipo.DataTextField  = "NOMBRE_TIPO_HABITACION";
                ddlTipo.DataValueField = "ID_TIPO_HABITACION";
                ddlTipo.DataBind();

                ddlEstado.Items.Add("Disponible");
                ddlEstado.Items.Add("Ocupada");
                ddlEstado.Items.Add("Mantenimiento");

                if (MiSesionH.NUMERO_HABITACION != 0)
                {
                    Modelo.Habitacion habitacion = new Modelo.Habitacion();
                    habitacion.NUMERO_HABITACION = MiSesionH.NUMERO_HABITACION;

                    Service1      s      = new Service1();
                    XmlSerializer sr     = new XmlSerializer(typeof(Modelo.Habitacion));
                    StringWriter  writer = new StringWriter();
                    sr.Serialize(writer, habitacion);

                    if (s.ObtenerHabitacion(writer.ToString()) != null)
                    {
                        habitacion = s.ObtenerHabitacion(writer.ToString());

                        txtNumero.Text          = habitacion.NUMERO_HABITACION + "";
                        txtPrecio.Text          = habitacion.PRECIO_HABITACION + "";
                        ddlEstado.SelectedValue = habitacion.ESTADO_HABITACION;
                        ddlTipo.SelectedIndex   = habitacion.ID_TIPO_HABITACION - 1;

                        txtNumero.ReadOnly = true;
                    }
                }
                else
                {
                    Response.Write("<script language='javascript'>window.alert('No puede acceder a esta página');window.location='../Hostal/WebLogin.aspx';</script>");
                }
            }
        }
Beispiel #3
0
        public string ListarTipoHabitacion()
        {
            ServicioHabitacion           servicio        = new ServicioHabitacion();
            List <Datos.TIPO_HABITACION> tipo_habitacion = servicio.ListarTipoHabitacion();

            Modelo.TipoHabitacionCollection listaTipoHabitacion = new Modelo.TipoHabitacionCollection();
            foreach (Datos.TIPO_HABITACION t in tipo_habitacion)
            {
                Modelo.TipoHabitacion tModelo = new Modelo.TipoHabitacion();
                tModelo.ID_TIPO_HABITACION     = t.ID_TIPO_HABITACION;
                tModelo.NOMBRE_TIPO_HABITACION = t.NOMBRE_TIPO_HABITACION;
                tModelo.CANTIDAD_PASAJERO      = t.CANTIDAD_PASAJERO;
                listaTipoHabitacion.Add(tModelo);
            }
            XmlSerializer ser    = new XmlSerializer(typeof(Modelo.TipoHabitacionCollection));
            StringWriter  writer = new StringWriter();

            ser.Serialize(writer, listaTipoHabitacion);
            return(writer.ToString());
        }