Beispiel #1
0
        private void RegistrarAdmin()
        {
            try
            {
                if (!ValidarCampos())
                {
                    return;
                }
                clsPersona objPersona = new clsPersona(strNombreApp);
                objPersona.Identificacion = this.txtIDAdmin.Text.Trim();
                if (objPersona.ValidarIdentificacion())
                {
                    this.lblMensaje.Text   = "Los sentimos, ya hay un administrador registrado con esa identificación";
                    this.pnlAlerta.Visible = true;
                    objPersona             = null;
                    return;
                }

                clsUsuario objUsu = new clsUsuario(strNombreApp);
                objUsu.NickUsuario = this.txtNickAdmin.Text;
                objUsu.Clave       = this.txtClaveAdmin.Text;
                objUsu.Cedula      = this.txtIDAdmin.Text;
                objUsu.Rol         = "A";


                if (!objUsu.CrearUsuario())
                {
                    this.lblMensaje.Text   = objUsu.Error;
                    this.pnlAlerta.Visible = true;
                    objUsu = null;
                    return;
                }

                if (objUsu.Respuesta == 0)
                {
                    this.lblMensaje.Text   = "Nombre de usuario no disponible";
                    this.pnlAlerta.Visible = true;
                    objUsu = null;
                    return;
                }
                else
                {
                    if (!obtenerIdUsuario())
                    {
                        return;
                    }
                    objPersona.Nombre     = this.txtNombreAdmin.Text.Trim();
                    objPersona.Nick       = this.txtNickAdmin.Text.Trim();
                    objPersona.Ciudad     = this.txtCiudadAdmin.Text.Trim();
                    objPersona.CodUsuario = intCodUsuario;
                    objPersona.CrearPersona();
                    objPersona             = null;
                    this.lblMensaje.Text   = "Nuevo administrador registrado con exito";
                    this.pnlAlerta.Visible = true;
                    objUsu = null;
                    return;
                }
            }
            catch (Exception ex)
            {
                this.lblMensaje.Text   = ex.Message;
                this.pnlAlerta.Visible = true;
                return;
            }
        }
        private void RegistrarAeropuerto()
        {
            try
            {
                if (!ValidarCampos())
                {
                    return;
                }
                clsAeropuerto objAeropuerto = new clsAeropuerto(strNombreApp);
                objAeropuerto.CodigoAeropuerto = this.txtCodAeropuerto.Text.Trim();
                if (objAeropuerto.ConsultarAeropuerto())
                {
                    this.lblMensaje.Text   = "El Aeropuerto ya se encuentra registrado";
                    this.pnlAlerta.Visible = true;
                    objAeropuerto          = null;
                    return;
                }
                clsPersona objValPersona = new clsPersona(strNombreApp);
                objValPersona.Identificacion = this.txtCodResponsable.Text.Trim();
                if (!objValPersona.ValidarIdentificacion())
                {
                    this.lblMensaje.Text   = "No existe un usuario con la identificación " + objValPersona.Identificacion;
                    this.pnlAlerta.Visible = true;
                    objValPersona          = null;
                    return;
                }
                objValPersona = null;

                objAeropuerto.Nombre            = this.txtNombreAeropuerto.Text.Trim();
                objAeropuerto.Pais              = this.txtPaisAeropuerto.Text.Trim();
                objAeropuerto.Ciudad            = this.txtPaisAeropuerto.Text.Trim();
                objAeropuerto.CodigoResponsable = this.txtCodResponsable.Text.Trim();
                objAeropuerto.Estado            = this.txtEstado.Text.Trim();


                if (!objAeropuerto.CrearAeropuerto())
                {
                    this.lblMensaje.Text   = objAeropuerto.Error;
                    this.pnlAlerta.Visible = true;
                    objAeropuerto          = null;
                    return;
                }

                if (objAeropuerto.Respuesta == 0)
                {
                    this.lblMensaje.Text   = objAeropuerto.Error;
                    this.pnlAlerta.Visible = true;
                    objAeropuerto          = null;
                    return;
                }
                else
                {
                    this.lblMensaje.Text   = "Registro de Aeropuerto con exito";
                    this.pnlAlerta.Visible = true;
                    objAeropuerto          = null;
                    return;
                }
            }
            catch (Exception ex)
            {
                this.lblMensaje.Text   = ex.Message;
                this.pnlAlerta.Visible = true;
                return;
            }
        }