Esempio n. 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombreUsuario.Text.Trim() != "" && TxtPass.Text.Trim() != "" && txtNombre.Text.Trim() != "" &&
                txtApellidos.Text.Trim() != "" && txtId.Text.Trim() != "")
            {
                objNuevoUsuario objUsuario = new objNuevoUsuario()
                {
                    strUser      = txtNombreUsuario.Text,
                    strPass      = TxtPass.Text,
                    strCorreo    = txtEmail.Text,
                    strDireccion = txtDireccion.Text,
                    strNombre    = txtNombre.Text,
                    strApellidos = txtApellidos.Text,
                    strTelefono  = txtTelefono.Text,
                    int64Dni     = Convert.ToInt64(txtId.Text),
                };

                CtrlHotel objHotel = new CtrlHotel();

                if (objHotel.insertarUsuario(objUsuario))
                {
                    dvCorrecto.Visible = true;
                    dvError.Visible    = false;
                }
                else
                {
                    dvCorrecto.Visible = false;
                    dvError.Visible    = true;
                    lblError.Text      = objHotel.strReturnMessage;
                }
            }
            else
            {
                if (txtNombreUsuario.Text == "")
                {
                    lblError1.Visible = true;
                }
                if (TxtPass.Text == "")
                {
                    lblError2.Visible = true;
                }
                if (txtNombre.Text == "")
                {
                    lblError3.Visible = true;
                }
                if (txtApellidos.Text == "")
                {
                    lblError4.Visible = true;
                }
                if (txtId.Text == "")
                {
                    lblError5.Visible = true;
                }

                dvCorrecto.Visible = false;
                dvError.Visible    = true;
                lblError.Text      = "Debe ingresar los campos obligatorios!";
            }
        }
Esempio n. 2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombreBebida.Text != "" && txtMarca.Text != "" && TxtPrecio.Text != "" && txtFechaCaducidad.Text != "")
            {
                ObjNuevaBebida objBebidas = new ObjNuevaBebida()
                {
                    strBebida = txtNombreBebida.Text,
                    strMarca  = txtMarca.Text,
                    strPrecio = TxtPrecio.Text,
                    strFecha  = txtFechaCaducidad.Text
                };

                CtrlHotel objHotel = new CtrlHotel();

                if (objHotel.insertarBebida(objBebidas))
                {
                    dvCorrecto.Visible = true;
                    dvError.Visible    = false;
                    CargarDatos();
                }
                else
                {
                    dvCorrecto.Visible = false;
                    dvError.Visible    = true;
                    lblError.Text      = objHotel.strReturnMessage;
                }
            }
            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!";
            }
        }
Esempio n. 3
0
        private void CargarDatos()
        {
            txtFechaCaducidad.Text = "";
            txtMarca.Text          = "";
            txtNombreBebida.Text   = "";
            TxtPrecio.Text         = "";
            CtrlHotel objHotel = new CtrlHotel();

            if (objHotel.ConsultarBebida())
            {
                gvBebidas.DataSource = objHotel.dsReturn.Tables[0];
                gvBebidas.DataBind();
            }
            else
            {
                gvBebidas.DataSource = new DataTable();
                gvBebidas.DataBind();
            }
        }
Esempio n. 4
0
        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("frmMenuPrincipal.aspx");
            }
            else
            {
                dvError.Visible = true;
            }
        }