protected void btnGuardar_Click(object sender, EventArgs e) { objHotel objHotel = new objHotel() { strCiudad = txtCiudad.Text, strDireccion = txtDireccion.Text, strEstrellas = TxtEstrellas.Text, strNombreHotel = txtNombreHotel.Text, strPrecio = txtPrecio.Text, strTelefono = txtTelefono.Text, strTiempoReserva = ddlTiempoReserva.SelectedValue, }; ctrlHotel ctrlHotel = new ctrlHotel(); if (!ctrlHotel.insertarHotel(objHotel)) { dvError.Visible = true; dvCorrecto.Visible = false; lblError.Text = ctrlHotel.strMensaje; } else { dvCorrecto.Visible = true; dvError.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { //try //{ // if (Session["usuario"].ToString() == "") // { // Response.Redirect("Login.aspx"); // } //} //catch //{ // Response.Redirect("Login.aspx"); //} if (!IsPostBack) { ctrlHotel objHotel = new ctrlHotel(); dtUsuario = objHotel.consultarUsuarioRol(); ddlUsuario.DataSource = dtUsuario; ddlUsuario.DataTextField = "username"; ddlUsuario.DataValueField = "id"; ddlUsuario.DataBind(); dtRol = objHotel.consultarRol(); ddlRol.DataSource = dtRol; ddlRol.DataTextField = "authority"; ddlRol.DataValueField = "id"; ddlRol.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ctrlHotel objHotel = new ctrlHotel(); gvReserva.DataSource = objHotel.consultarHabitacion(); gvReserva.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ctrlHotel objHotel = new ctrlHotel(); ddlTiempoReserva.DataSource = objHotel.consultarTiempoReserva(); ddlTiempoReserva.DataTextField = "unidad"; ddlTiempoReserva.DataValueField = "id"; ddlTiempoReserva.DataBind(); } }
protected void btnGuardar_Click(object sender, EventArgs e) { if (txtNombreBebida.Text != "" && txtMarca.Text != "" && TxtPrecio.Text != "" && txtFechaCaducidad.Text != "") { objNuevoUsuario objBebidas = new objNuevaBebida() { strBebida = txtNombreBebida.Text, strMarca = txtMarca.Text, strPrecio = TxtPrecio.Text, strFecha = txtFechaCaducidad.Text, int64Dni = Convert.ToInt64(txtFechaCaducidad.Text), }; ctrlHotel objHotel = new ctrlHotel(); if (objHotel.insertarBebida(objBebidas)) { dvCorrecto.Visible = true; dvError.Visible = false; } else { dvCorrecto.Visible = false; dvError.Visible = true; lblError.Text = objHotel.strMensaje; } } else { if (txtNombreBebida.Text == "") { lblError1.Visible = true; } if (txtMarca.Text == "") { lblError2.Visible = true; } if (TxtPrecio.Text == "") { lblError2.Visible = true; } if (txtFechaCaducidad.Text == "") { lblError2.Visible = true; } dvCorrecto.Visible = false; dvError.Visible = true; lblError.Text = "Debe ingresar los campos obligatorios!"; } }
protected void btnGuardar_Click(object sender, EventArgs e) { objUsuarioRol objRol = new objUsuarioRol() { strUser = ddlUsuario.SelectedValue, strRol = ddlRol.SelectedValue, }; ctrlHotel objHotel = new ctrlHotel(); bool resultado = objHotel.insertarRol(objRol); if (resultado != true) { dvError.Visible = true; dvCorrecto.Visible = false; lblError.Text = objHotel.strMensaje; } else { dvCorrecto.Visible = true; dvError.Visible = false; } }
protected void btnLogin_Click(object sender, EventArgs e) { code_data.objetos.objUsuario objUsuario = new code_data.objetos.objUsuario() { strUser = txtUser.Text, strPass = txtPass.Text, }; ctrlHotel objHotel = new ctrlHotel(); bool resultado = objHotel.ConsultarUsuario(objUsuario); if (resultado == true) { Session["usuario"] = txtUser.Text; Response.Redirect("frmHabitacion.aspx"); } else { lblError.Text = objHotel.strMensaje; dvError.Visible = true; } }