Example #1
0
 public conexion(string nombre, string servidor, string baseDatos, TipoSeguridad seguridad)
 {
     this.nombre    = nombre;
     this.servidor  = servidor;
     this.baseDatos = baseDatos;
     this.seguridad = seguridad;
 }
Example #2
0
        public Acceso(string servidor, string baseDatos, TipoSeguridad seguridad, short modulo, Image iconoModulo)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.servidor  = servidor;
            this.baseDatos = baseDatos;
            this.seguridad = seguridad;
            this.modulo    = modulo;
            try
            {
                this.picModulo.Image = iconoModulo;
            }
            catch (Exception ex)
            {
                throw(ex);
            }
            lblMensaje.Text = "Conectarse a " + servidor.ToString() + "." + baseDatos + " usando seguridad " + seguridad.ToString();
            this.Text       = Application.ProductName + " v." + Application.ProductVersion;
        }
Example #3
0
 private void lblMensaje_Click(object sender, System.EventArgs e)
 {
     if (permitirCambioBase && listaConexiones.Count > 1)
     {
         frmSeleccionConexion seleccionConexion = new frmSeleccionConexion(listaConexiones);
         conexion             mConn;
         if (seleccionConexion.ShowDialog() == DialogResult.OK)
         {
             mConn           = seleccionConexion.ConexionSeleccionada;
             this.servidor   = mConn.Servidor;
             this.baseDatos  = mConn.BaseDatos;
             this.seguridad  = mConn.Seguridad;
             lblMensaje.Text = "Conectarse a " + mConn.Nombre + " usando seguridad " + seguridad.ToString();
         }
     }
 }
Example #4
0
        private void CargaConexiones(string archivoConfiguracion)
        {
            XmlDocument   xDoc = new XmlDocument();
            string        nombre, servidor, baseDatos;
            TipoSeguridad seguridad;

            try
            {
                xDoc.Load(archivoConfiguracion);
                foreach (XmlNode node in xDoc.DocumentElement.SelectSingleNode(@"/configuration/appSetings/Conexiones"))
                {
                    nombre   = node.Name;
                    servidor = xDoc.DocumentElement.SelectSingleNode(@"/configuration/appSetings/Conexiones/" + nombre
                                                                     + @"/add[@key=""Servidor""]").Attributes.GetNamedItem("value").Value;
                    baseDatos = xDoc.DocumentElement.SelectSingleNode(@"/configuration/appSetings/Conexiones/" + nombre
                                                                      + @"/add[@key=""Base""]").Attributes.GetNamedItem("value").Value;
                    if (xDoc.DocumentElement.SelectSingleNode(@"/configuration/appSetings/Conexiones/" + nombre
                                                              + @"/add[@key=""Seguridad""]").Attributes.GetNamedItem("value").Value == "NT")
                    {
                        seguridad = TipoSeguridad.NT;
                    }
                    else
                    {
                        seguridad = TipoSeguridad.SQL;
                    }
                    listaConexiones.Add(new conexion(nombre, servidor, baseDatos, seguridad));
                }
            }
            catch (Exception ex)
            {
                listaConexiones.Add(new conexion("", "", "", TipoSeguridad.NT));
                MessageBox.Show("Ha ocurrido el siguiente error:" + (char)13 + ex.Message, Application.ProductName + " v." + Application.ProductVersion,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                //Application.ExitThread();
            }

            //listaConexiones.Add(new conexion("Reportes", "Galgo", "Reportes", TipoSeguridad.NT));
        }