Esempio n. 1
0
        // Metodo limpiar
        // Limpia los campos de formulario
        private void Limpiar()
        {
            // BBDD
            NSCmbBBDD.Items.Clear();
            NSCmbBBDD.Items.Add("");

            ArrayList bbdds = Program.bbdd.ConsultaObtenerBDS();

            for (int i = 0; i < bbdds.Count; i++)
            {
                NSCmbBBDD.Items.Add(bbdds[i]);
            }

            NSCmbBBDD.SelectedIndex = 0;

            // Consulta
            NSLvItems.RemoveItems(NSLvItems.Items);

            // Jugador
            NSCmbJugador.SelectedItem = 0;

            // Elo
            NSCmbElo.SelectedItem = 0;

            // Fecha inicial/final
            NSTxbFechaIni.Text = "1800/01/01";
            NSTxbFechaFin.Text = DateTime.Now.ToString("yyyy/MM/dd");

            // Tablero
            PbxCasilla00.Image     = UAChess.Properties.Resources.PzTorreB;
            PbxCasilla00.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla10.Image     = UAChess.Properties.Resources.PzCaballoB;
            PbxCasilla10.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla20.Image     = UAChess.Properties.Resources.PzAlfilB;
            PbxCasilla20.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla30.Image     = UAChess.Properties.Resources.PzDamaB;
            PbxCasilla30.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla40.Image     = UAChess.Properties.Resources.PzReyB;
            PbxCasilla40.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla50.Image     = UAChess.Properties.Resources.PzAlfilB;
            PbxCasilla50.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla60.Image     = UAChess.Properties.Resources.PzCaballoB;
            PbxCasilla60.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla70.Image     = UAChess.Properties.Resources.PzTorreB;
            PbxCasilla70.BackColor = Color.FromArgb(100, 100, 100);

            PbxCasilla01.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla01.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla11.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla11.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla21.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla21.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla31.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla31.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla41.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla41.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla51.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla51.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla61.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla61.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla71.Image     = UAChess.Properties.Resources.PzPeonB;
            PbxCasilla71.BackColor = Color.FromArgb(25, 25, 25);

            PbxCasilla02.Image     = null;
            PbxCasilla02.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla12.Image     = null;
            PbxCasilla12.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla22.Image     = null;
            PbxCasilla22.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla32.Image     = null;
            PbxCasilla32.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla42.Image     = null;
            PbxCasilla42.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla52.Image     = null;
            PbxCasilla52.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla62.Image     = null;
            PbxCasilla62.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla72.Image     = null;
            PbxCasilla72.BackColor = Color.FromArgb(100, 100, 100);

            PbxCasilla03.Image     = null;
            PbxCasilla03.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla13.Image     = null;
            PbxCasilla13.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla23.Image     = null;
            PbxCasilla23.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla33.Image     = null;
            PbxCasilla33.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla43.Image     = null;
            PbxCasilla43.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla53.Image     = null;
            PbxCasilla53.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla63.Image     = null;
            PbxCasilla63.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla73.Image     = null;
            PbxCasilla73.BackColor = Color.FromArgb(25, 25, 25);

            PbxCasilla04.Image     = null;
            PbxCasilla04.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla14.Image     = null;
            PbxCasilla14.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla24.Image     = null;
            PbxCasilla24.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla34.Image     = null;
            PbxCasilla34.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla44.Image     = null;
            PbxCasilla44.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla54.Image     = null;
            PbxCasilla54.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla64.Image     = null;
            PbxCasilla64.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla74.Image     = null;
            PbxCasilla74.BackColor = Color.FromArgb(100, 100, 100);

            PbxCasilla05.Image     = null;
            PbxCasilla05.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla15.Image     = null;
            PbxCasilla15.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla25.Image     = null;
            PbxCasilla25.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla35.Image     = null;
            PbxCasilla35.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla45.Image     = null;
            PbxCasilla45.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla55.Image     = null;
            PbxCasilla55.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla65.Image     = null;
            PbxCasilla65.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla75.Image     = null;
            PbxCasilla75.BackColor = Color.FromArgb(25, 25, 25);

            PbxCasilla06.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla06.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla16.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla16.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla26.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla26.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla36.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla36.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla46.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla46.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla56.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla56.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla66.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla66.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla76.Image     = UAChess.Properties.Resources.PzPeonN;
            PbxCasilla76.BackColor = Color.FromArgb(100, 100, 100);

            PbxCasilla07.Image     = UAChess.Properties.Resources.PzTorreN;
            PbxCasilla07.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla17.Image     = UAChess.Properties.Resources.PzCaballoN;
            PbxCasilla17.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla27.Image     = UAChess.Properties.Resources.PzAlfilN;
            PbxCasilla27.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla37.Image     = UAChess.Properties.Resources.PzDamaN;
            PbxCasilla37.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla47.Image     = UAChess.Properties.Resources.PzReyN;
            PbxCasilla47.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla57.Image     = UAChess.Properties.Resources.PzAlfilN;
            PbxCasilla57.BackColor = Color.FromArgb(25, 25, 25);
            PbxCasilla67.Image     = UAChess.Properties.Resources.PzCaballoN;
            PbxCasilla67.BackColor = Color.FromArgb(100, 100, 100);
            PbxCasilla77.Image     = UAChess.Properties.Resources.PzTorreN;
            PbxCasilla77.BackColor = Color.FromArgb(25, 25, 25);

            // Detalles
            LblDEvento.Text    = "";
            LblDLugar.Text     = "";
            LblDBlancas.Text   = "";
            LblDNegras.Text    = "";
            LblDResultado.Text = "";
        }
Esempio n. 2
0
        // Metodo BuscarMovimientos
        // Busca movimientos en bbdd dada
        private bool BuscarMovimientos()
        {
            // Obtener elo minimo y maximo
            int eloMin, eloMax;

            eloMin = 0;
            eloMax = 10000;

            switch (NSCmbElo.SelectedIndex)
            {
            // 1000-1399: Principiante
            case 1:
                eloMin = 1000;
                eloMax = 1399;
                break;

            // 1400-1599: Aficionado
            case 2:
                eloMin = 1400;
                eloMax = 1599;
                break;

            // 1600-1799: Club Medio
            case 3:
                eloMin = 1600;
                eloMax = 1799;
                break;

            // 1800-1999: Club Fuerte
            case 4:
                eloMin = 1800;
                eloMax = 1999;
                break;

            // 2000-2199: Exp. Nacional
            case 5:
                eloMin = 2000;
                eloMax = 2199;
                break;

            // 2200-2299: Ca. Maestro
            case 6:
                eloMin = 2200;
                eloMax = 2299;
                break;

            // 2300-2399: Maestro Fide
            case 7:
                eloMin = 2300;
                eloMax = 2399;
                break;

            // 2400-2499: Maestro Inter
            case 8:
                eloMin = 2400;
                eloMax = 2499;
                break;

            // 2500-2599: Gran Maestro
            case 9:
                eloMin = 2500;
                eloMax = 2599;
                break;

            // 2600-2699: Sup. Maestro
            case 10:
                eloMin = 2600;
                eloMax = 2699;
                break;

            // 2700-2799: Ca. Campeón
            case 11:
                eloMin = 2700;
                eloMax = 2799;
                break;

            // 2800+: Campeón Mundo
            case 12:
                eloMin = 2800;
                eloMax = 10000;
                break;
            }

            NSLvItems.RemoveItems(NSLvItems.Items);

            // Mostrar movimientos
            ArrayList movimientos = Program.bbdd.ConsultaObtenerMovimientos(NSCmbBBDD.Text, NSTxbFechaIni.Text.Replace('/', '-'),
                                                                            NSTxbFechaFin.Text.Replace('/', '-'), NSCmbJugador.Text, eloMin + "", eloMax + "");

            if (movimientos != null)
            {
                for (int i = 0; i < movimientos.Count; i += 8)
                {
                    string[] movS = movimientos[i + 7].ToString().Split(',');

                    string mov = Chess.NotacionAlgebraicaL(Convert.ToInt32(movS[0]), Convert.ToInt32(movS[1]), Convert.ToInt32(movS[2]),
                                                           Convert.ToInt32(movS[3]), Convert.ToInt32(movS[4]), Convert.ToInt32(movS[5]),
                                                           Convert.ToInt32(movS[6]), Convert.ToInt32(movS[7]), 0, 0);

                    NSLvItems.AddItem(movimientos[i + 3].ToString().Split(' ')[0], movimientos[i + 4].ToString(), movimientos[i + 5].ToString(), mov, movimientos[i + 7].ToString(), movimientos[i].ToString(), movimientos[i + 1].ToString(), movimientos[i + 6].ToString());
                }

                return(true);
            }

            return(false);
        }