Exemple #1
0
        /*Constructor del diálogo del FIND
         * */
        public FindDialog(string destination, string db_name,
                          BodyRespuesta002MongoDB schema)
        {
            this.Build();

            this._destination = destination;
            this._db_name     = db_name;
            this._schema      = schema;
            this._typeOutPut  = "Cancel";

            DeshabilitarInicio();

            RellenarComboBox(CargarComboBoxCollections(), null, null, null);
            this._activeProyections = new Dictionary <string, bool>();
        }
Exemple #2
0
        /*
         * Método para realizar consulta SELECT
         */
        protected void OnButtonSelectClicked(object sender, EventArgs e)
        {
            string msg, response;

            this.Hide();
            if (this._db_type == Constants.MYSQL)
            {
                BodyRespuesta002MySQL schema = new BodyRespuesta002MySQL(this._schema.MessageResponse.Body.InnerXml);

                this.Hide();
                this._selectDialog = new SelectDialog(this._destination, this._db_name, schema);
                this._selectDialog.Run();

                switch (this._selectDialog.TypeOutPut)
                {
                case Constants.CANCEL:

                    break;

                case Constants.MENSAJE_CONSULTA:
                    XmlNode bodyMessage = (XmlNode)this._selectDialog.Body;
                    PostBox post        = new PostBox(this._source, this._destination, Constants.MENSAJE_CONSULTA, this._db_name, this._db_type, bodyMessage, this._connection.SymmetricKey, this._keyPair);
                    msg = post.ProcesarEnvio();

                    //Creo el cliente y le envio el mensaje
                    Client c        = new Client();
                    bool   conexion = c.comprobarConexion(Constants.GATEKEEPER);
                    if (conexion)
                    {
                        response = c.StartClient(msg, Constants.GATEKEEPER);

                        //Proceso la respuesta

                        post.ProcesarRespuesta(response);

                        this._select.MessageRequest  = post.MessageRequest;
                        this._select.MessageResponse = post.MessageResponse;

                        this._typeOutPut = Constants.MENSAJE_CONSULTA;
                    }
                    else
                    {
                        this._typeOutPut = Constants.ERROR_CONNECTION;
                    }

                    break;

                case Constants.ERROR_CONNECTION:

                    this._typeOutPut = Constants.ERROR_CONNECTION;

                    break;
                }
            }   //Caso MongoDB
            else if (this._db_type == Constants.MONGODB)
            {
                BodyRespuesta002MongoDB schema = new BodyRespuesta002MongoDB(this._schema.MessageResponse.Body.InnerXml);
                this.Hide();
                this._findDialog = new FindDialog(this._destination, this._db_name, schema);
                this._findDialog.Run();

                switch (this._findDialog.TypeOutPut)
                {
                case Constants.CANCEL:

                    break;

                case Constants.MENSAJE_CONSULTA:
                    XmlNode bodyMessage = (XmlNode)this._findDialog.Body;
                    PostBox post        = new PostBox(this._source, this._destination, Constants.MENSAJE_CONSULTA, this._db_name, this._db_type, bodyMessage, this._connection.SymmetricKey, this._keyPair);
                    msg = post.ProcesarEnvio();

                    //Creo el cliente y le envio el mensaje
                    Client c        = new Client();
                    bool   conexion = c.comprobarConexion(Constants.GATEKEEPER);
                    if (conexion)
                    {
                        response = c.StartClient(msg, Constants.GATEKEEPER);

                        //Proceso la respuesta

                        post.ProcesarRespuesta(response);

                        this._select.MessageRequest  = post.MessageRequest;
                        this._select.MessageResponse = post.MessageResponse;

                        this._typeOutPut = Constants.MENSAJE_CONSULTA;
                    }
                    else
                    {
                        this._typeOutPut = Constants.ERROR_CONNECTION;
                    }
                    break;

                case Constants.ERROR_CONNECTION:

                    this._typeOutPut = Constants.ERROR_CONNECTION;

                    break;
                }
            }

            this.Destroy();
        }