示例#1
0
        private void btnGuardarConexion_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ConexionesSucursales modif = new ConexionesSucursales();
            Crypto encryp = new Crypto();

            modif.SucursalesId = Convert.ToInt32(cboSucursales.EditValue);
            modif.ServerID     = encryp.Encriptar(txtServer.Text);
            modif.UserID       = encryp.Encriptar(txtLogin.Text);
            modif.PassID       = encryp.Encriptar(txtPassword.Text);
            modif.DataBaseID   = encryp.Encriptar(txtDB.Text);
            using (SqlConnection conn = new SqlConnection(String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServer.Text, txtDB.Text, txtLogin.Text, txtPassword.Text)))
            {
                try
                {
                    conn.Open();
                    modif.MtdModificarConexion();
                    if (modif.Exito)
                    {
                        CargarConexionesSucursales();
                        XtraMessageBox.Show("Se ha guardado la configuración con Exito");
                    }
                }
                catch
                {
                    XtraMessageBox.Show("No se ha Establecido Conexion con el Servidor");
                }
            }
        }
示例#2
0
        private void CargarSucursales(int?Valor)
        {
            ConexionesSucursales conSucursales = new ConexionesSucursales();

            conSucursales.MtdSeleccionarSucursales();
            if (conSucursales.Exito)
            {
                cboSucursales.Properties.DisplayMember = "SucursalesNombre";
                cboSucursales.Properties.ValueMember   = "SucursalesId";
                cboSucursales.EditValue             = Valor;
                cboSucursales.Properties.DataSource = conSucursales.Datos;
            }
        }
示例#3
0
        private void cboSucursales_EditValueChanged(object sender, EventArgs e)
        {
            ConexionesSucursales consult = new ConexionesSucursales();

            consult.SucursalesId = Convert.ToInt32(cboSucursales.EditValue);
            consult.MtdSeleccionarSucursalesId();
            if (consult.Exito)
            {
                if (consult.Datos.Rows.Count > 0)
                {
                    Crypto encryp = new Crypto();
                    txtServer.Text   = encryp.Desencriptar(consult.Datos.Rows[0][2].ToString());
                    txtDB.Text       = encryp.Desencriptar(consult.Datos.Rows[0][3].ToString());
                    txtLogin.Text    = encryp.Desencriptar(consult.Datos.Rows[0][4].ToString());
                    txtPassword.Text = encryp.Desencriptar(consult.Datos.Rows[0][5].ToString());
                }
            }
        }
示例#4
0
        private void CargarConexionesSucursales()
        {
            ConexionesSucursales conexion = new ConexionesSucursales();
            Crypto desencriptar           = new Crypto();

            conexion.MtdSeleccionarConexionesSucursales();
            if (conexion.Exito)
            {
                if (conexion.Datos.Rows.Count > 0)
                {
                    for (int x = 0; x < conexion.Datos.Rows.Count; x++)
                    {
                        if (conexion.Datos.Rows[x][2].ToString() != string.Empty)
                        {
                            conexion.Datos.Rows[x][2] = desencriptar.Desencriptar(conexion.Datos.Rows[x][2].ToString());
                        }
                        else
                        {
                            conexion.Datos.Rows[x][2] = string.Empty;
                        }
                        if (conexion.Datos.Rows[x][3].ToString() != string.Empty)
                        {
                            conexion.Datos.Rows[x][3] = desencriptar.Desencriptar(conexion.Datos.Rows[x][3].ToString());
                        }
                        else
                        {
                            conexion.Datos.Rows[x][3] = string.Empty;
                        }
                        if (conexion.Datos.Rows[x][4].ToString() != string.Empty)
                        {
                            conexion.Datos.Rows[x][4] = desencriptar.Desencriptar(conexion.Datos.Rows[x][4].ToString());
                        }
                        else
                        {
                            conexion.Datos.Rows[x][4] = string.Empty;
                        }
                    }
                    dtgConexiones.DataSource = conexion.Datos;
                }
            }
        }