示例#1
0
 public void LoadFromDB()
 {
     LOADING = true;
     comboDa.Enabled = false;
     try
     {
         if (RELOADDATA)
         {
             comboDa.Items.Clear();
             comboDa.Items.AddRange(Internal.DB.GetDates());
             if (comboDa.Items.Count>0) comboDa.SelectedIndex = 0;
         }
         if (comboDa.SelectedIndex < 0) return;
         string data = comboDa.Items[comboDa.SelectedIndex].ToString();
         DataTable DT_NEW = Internal.DB.GetPlayers(data);
         Players = new RMO.Class.Player[DT_NEW.Rows.Count];
         int i = 0;
         foreach (DataRow dr in DT_NEW.Rows)
         {
             Class.Player p = new RMO.Class.Player();
             p.LoadData(dr, data);
             Players[i] = p; i++;
         }
         FillCombo(c1, Players); FillCombo(c2, Players); FillCombo(c3, Players);
         FillCombo(c4, Players); FillCombo(c5, Players); FillCombo(c6, Players);
         FillCombo(c7, Players); FillCombo(c8, Players); FillCombo(c9, Players);
         FillCombo(c10, Players); FillCombo(c11, Players); FillCombo(c12, Players);
         FillCombo(c13, Players); FillCombo(c14, Players); FillCombo(c15, Players);
     }
     catch (Exception ex) { My.Box.Info(ex.Message); }
     //BestTeam();
     comboDa.Enabled = true;
     LOADING = false;
 }
示例#2
0
 public void LoadFromDB()
 {
     LOADING         = true;
     comboDa.Enabled = false;
     try
     {
         if (RELOADDATA)
         {
             comboDa.Items.Clear();
             comboDa.Items.AddRange(Internal.DB.GetDates());
             if (comboDa.Items.Count > 0)
             {
                 comboDa.SelectedIndex = 0;
             }
         }
         if (comboDa.SelectedIndex < 0)
         {
             return;
         }
         string    data   = comboDa.Items[comboDa.SelectedIndex].ToString();
         DataTable DT_NEW = Internal.DB.GetPlayers(data);
         Players = new RMO.Class.Player[DT_NEW.Rows.Count];
         int i = 0;
         foreach (DataRow dr in DT_NEW.Rows)
         {
             Class.Player p = new RMO.Class.Player();
             p.LoadData(dr, data);
             Players[i] = p; i++;
         }
         FillCombo(c1, Players); FillCombo(c2, Players); FillCombo(c3, Players);
         FillCombo(c4, Players); FillCombo(c5, Players); FillCombo(c6, Players);
         FillCombo(c7, Players); FillCombo(c8, Players); FillCombo(c9, Players);
         FillCombo(c10, Players); FillCombo(c11, Players); FillCombo(c12, Players);
         FillCombo(c13, Players); FillCombo(c14, Players); FillCombo(c15, Players);
     }
     catch (Exception ex) { My.Box.Info(ex.Message); }
     //BestTeam();
     comboDa.Enabled = true;
     LOADING         = false;
 }
示例#3
0
        private void SetBest(int num)
        {
            Class.Player empty = new RMO.Class.Player();
            Class.Player max   = empty;
            switch (num)
            {
            case 10:
                ComboPlayer_DropDown(c10, EventArgs.Empty);
                foreach (Class.Player p in c10.Items)
                {
                    if (p.MEDIANODIAPERTURA > max.MEDIANODIAPERTURA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c10.SelectedItem = max;
                }
                max = empty;
                break;

            case 9:
                ComboPlayer_DropDown(c9, EventArgs.Empty);
                foreach (Class.Player p in c9.Items)
                {
                    if (p.MEDIANODIMISCHIA > max.MEDIANODIMISCHIA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c9.SelectedItem = max;
                }
                max = empty;
                break;

            case 8:
                ComboPlayer_DropDown(c8, EventArgs.Empty);
                foreach (Class.Player p in c8.Items)
                {
                    if (p.TERZALINEACENTRO > max.TERZALINEACENTRO)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c8.SelectedItem = max;
                }
                max = empty;
                break;

            case 2:
                ComboPlayer_DropDown(c2, EventArgs.Empty);
                foreach (Class.Player p in c2.Items)
                {
                    if (p.TALLONATORE > max.TALLONATORE)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c2.SelectedItem = max;
                }
                max = empty;
                break;

            case 15:
                ComboPlayer_DropDown(c15, EventArgs.Empty);
                foreach (Class.Player p in c15.Items)
                {
                    if (p.ESTREMO > max.ESTREMO)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c15.SelectedItem = max;
                }
                max = empty;
                break;

            case 4:
                ComboPlayer_DropDown(c4, EventArgs.Empty);
                foreach (Class.Player p in c4.Items)
                {
                    if (p.SECONDALINEA > max.SECONDALINEA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c4.SelectedItem = max;
                }
                max = empty;
                break;

            case 5:
                ComboPlayer_DropDown(c5, EventArgs.Empty);
                foreach (Class.Player p in c5.Items)
                {
                    if (p.SECONDALINEA > max.SECONDALINEA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c5.SelectedItem = max;
                }
                max = empty;
                break;

            case 6:
                ComboPlayer_DropDown(c6, EventArgs.Empty);
                foreach (Class.Player p in c6.Items)
                {
                    if (p.TERZALINEAALA > max.TERZALINEAALA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c6.SelectedItem = max;
                }
                max = empty;
                break;

            case 7:
                ComboPlayer_DropDown(c7, EventArgs.Empty);
                foreach (Class.Player p in c7.Items)
                {
                    if (p.TERZALINEAALA > max.TERZALINEAALA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c7.SelectedItem = max;
                }
                max = empty;
                break;

            case 1:
                ComboPlayer_DropDown(c1, EventArgs.Empty);
                foreach (Class.Player p in c1.Items)
                {
                    if (p.PILONE > max.PILONE)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c1.SelectedItem = max;
                }
                max = empty;
                break;

            case 3:
                ComboPlayer_DropDown(c3, EventArgs.Empty);
                foreach (Class.Player p in c3.Items)
                {
                    if (p.PILONE > max.PILONE)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c3.SelectedItem = max;
                }
                max = empty;
                break;

            case 12:
                ComboPlayer_DropDown(c12, EventArgs.Empty);
                foreach (Class.Player p in c12.Items)
                {
                    if (p.CENTRO > max.CENTRO)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c12.SelectedItem = max;
                }
                max = empty;
                break;

            case 13:
                ComboPlayer_DropDown(c13, EventArgs.Empty);
                foreach (Class.Player p in c13.Items)
                {
                    if (p.CENTRO > max.CENTRO)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c13.SelectedItem = max;
                }
                max = empty;
                break;

            case 11:
                ComboPlayer_DropDown(c11, EventArgs.Empty);
                foreach (Class.Player p in c11.Items)
                {
                    if (p.ALA > max.ALA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c11.SelectedItem = max;
                }
                max = empty;
                break;

            case 14:
                ComboPlayer_DropDown(c14, EventArgs.Empty);
                foreach (Class.Player p in c14.Items)
                {
                    if (p.ALA > max.ALA)
                    {
                        max = p;
                    }
                }
                if (max != empty)
                {
                    c14.SelectedItem = max;
                }
                max = empty;
                break;
            }
        }
示例#4
0
 public void LoadFromWWW()
 {
     try
     {
         string content = "";
         LOADING = true;
         try
         {
             string today_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "{0}.nteam", RMHTML.GetDate());
             string last_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "last.nteam", RMHTML.GetDate());
             content = Internal.Main.DownloadNazionale(!System.IO.File.Exists(last_file));
             content = RMHTML.GetBody(content);
             if (content == "") if (System.IO.File.Exists(last_file))
                     content = System.IO.File.ReadAllText(last_file);
             if (content != "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     string last = System.IO.File.ReadAllText(last_file);
                     if (content != last)
                     {
                         System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                         System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                     }
                 }
                 else
                 {
                     System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                     System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                 }
                 string[] players = content.Split(new string[1] { @"href='player.php?" }, StringSplitOptions.RemoveEmptyEntries);
                 System.Collections.ArrayList Giocatori = new System.Collections.ArrayList();
                 int totale_eta = 0;
                 foreach (string g in players)
                 {
                     if (g.Contains("id_player=") && g.Contains("class='squadskill'"))
                     {
                         RMO.Class.Player p = new RMO.Class.Player();
                         p.ID = (int)RMO.RMHTML.GetNumero(g, @"id_player=", @"'>");
                         string nome = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_player=" + p.ID.ToString() + "'>", @"</a>"));
                         string[] nome1 = nome.Split(' ');
                         p.NOME = nome1[0];
                         p.COGNOME = nome.Replace(nome1[0] + " ", "");
                         p.STATO = "Nazionale";
                         //p.club_id = (int)RMO.RMHTML.GetNumero(g, @"club.php?id_club=", "'>");
                         //p.club_name = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_club=" + p.club_id + "'>", @"</a>"));
                         p.ALTEZZA = (int)RMO.RMHTML.GetNumero(g, @"altezza :", @"<br>");
                         p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a>)&nbsp;&nbsp;", @"anni");
                         if (p.ETA == 0) p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a></b><br>", @"anni");
                         p.SALARIO = 0;
                         p.PESO = RMO.RMHTML.GetNumero(g, @"peso :", @"<");
                         p.ESPERIENZA = (int)RMO.RMHTML.GetNumero(g, @"esperienza : <img src = '" + skillurl, @".gif");
                         p.RESISTENZA = (int)RMO.RMHTML.GetNumero(g, @"resistenza : <img src = '" + skillurl, @".gif");
                         p.FORZA = (int)RMO.RMHTML.GetNumero(g, @"forza : <img src = '" + skillurl, @".gif");
                         p.PLACCAGGI = (int)RMO.RMHTML.GetNumero(g, @"placcaggi : <img src = '" + skillurl, @".gif");
                         p.VELOCITA = (int)RMO.RMHTML.GetNumero(g, @"velocità : <img src = '" + skillurl, @".gif");
                         p.PASSAGGI = (int)RMO.RMHTML.GetNumero(g, @"passaggi : <img src = '" + skillurl, @".gif");
                         p.RICEZIONE = (int)RMO.RMHTML.GetNumero(g, @"ricezione : <img src = '" + skillurl, @".gif");
                         p.CALCI = (int)RMO.RMHTML.GetNumero(g, @"calci : <img src = '" + skillurl, @".gif");
                         Giocatori.Add(p);
                         totale_eta += p.ETA;
                     }
                 }
                 Internal.Main.StatusBar.Value = 0;
                 Internal.Main.StatusBar.Maximum = Giocatori.Count;
                 Control.Player.MAXRESET();
                 panelPlayers.SuspendLayout();
                 panelPlayers.Controls.Clear();
                 int y = 0; int k = 0;
                 foreach (RMO.Class.Player pl in Giocatori)
                 {
                     Control.Player c = new RMO.Control.Player();
                     c.LoadData(pl);
                     c.ShowFACVT();
                     panelPlayers.Controls.Add(c);
                     if (Properties.Settings.Default.GrayLines)
                     {
                         if ((k++ % 2) == 0) c.BackColor = Properties.Settings.Default.LinesColor1;
                         else c.BackColor = Properties.Settings.Default.LinesColor2;
                     }
                     Internal.Main.StatusBar.Value++;
                 }
                 foreach (Control.Player p in panelPlayers.Controls)
                 {
                     p.SetSize();
                     p.Location = new Point(0, y);
                     y += p.Height;
                 }
                 InitHeader();
                 panelPlayers.ResumeLayout();
                 decimal media = Math.Truncate((decimal)(totale_eta * 10 / Giocatori.Count)) / 10;
                 lEta.Text = string.Format(T("Età media {0} anni"), media.ToString());
                 lTOTALE.Text = string.Format(T("{0} Giocatori"), Giocatori.Count.ToString());
             }
             else { labelLoading.Text = T("Sei sicuro di essere manager di una nazionale?"); }
         }
         catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
         Internal.Main.StatusBar.Value = 0;
         LOADING = (content == "");
     }
     catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n"+ex.Message); }
 }
示例#5
0
 public void LoadFromWWW()
 {
     try
     {
         string content = "";
         LOADING = true;
         try
         {
             string today_file = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "{0}.nteam", RMHTML.GetDate());
             string last_file  = string.Format(Internal.WORKPATH + Internal.BAR + "xml" + Internal.BAR + "last.nteam", RMHTML.GetDate());
             content = Internal.Main.DownloadNazionale(!System.IO.File.Exists(last_file));
             content = RMHTML.GetBody(content);
             if (content == "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     content = System.IO.File.ReadAllText(last_file);
                 }
             }
             if (content != "")
             {
                 if (System.IO.File.Exists(last_file))
                 {
                     string last = System.IO.File.ReadAllText(last_file);
                     if (content != last)
                     {
                         System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                         System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                     }
                 }
                 else
                 {
                     System.IO.File.WriteAllText(today_file, content, Encoding.UTF8);
                     System.IO.File.WriteAllText(last_file, content, Encoding.UTF8);
                 }
                 string[] players = content.Split(new string[1] {
                     @"href='player.php?"
                 }, StringSplitOptions.RemoveEmptyEntries);
                 System.Collections.ArrayList Giocatori = new System.Collections.ArrayList();
                 int totale_eta = 0;
                 foreach (string g in players)
                 {
                     if (g.Contains("id_player=") && g.Contains("class='squadskill'"))
                     {
                         RMO.Class.Player p = new RMO.Class.Player();
                         p.ID = (int)RMO.RMHTML.GetNumero(g, @"id_player=", @"'>");
                         string   nome  = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_player=" + p.ID.ToString() + "'>", @"</a>"));
                         string[] nome1 = nome.Split(' ');
                         p.NOME    = nome1[0];
                         p.COGNOME = nome.Replace(nome1[0] + " ", "");
                         p.STATO   = "Nazionale";
                         //p.club_id = (int)RMO.RMHTML.GetNumero(g, @"club.php?id_club=", "'>");
                         //p.club_name = RMO.RMHTML.U(RMO.RMHTML.GetStringa(g, @"id_club=" + p.club_id + "'>", @"</a>"));
                         p.ALTEZZA = (int)RMO.RMHTML.GetNumero(g, @"altezza :", @"<br>");
                         p.ETA     = (int)RMO.RMHTML.GetNumero(g, @"</a>)&nbsp;&nbsp;", @"anni");
                         if (p.ETA == 0)
                         {
                             p.ETA = (int)RMO.RMHTML.GetNumero(g, @"</a></b><br>", @"anni");
                         }
                         p.SALARIO    = 0;
                         p.PESO       = RMO.RMHTML.GetNumero(g, @"peso :", @"<");
                         p.ESPERIENZA = (int)RMO.RMHTML.GetNumero(g, @"esperienza : <img src = '" + skillurl, @".gif");
                         p.RESISTENZA = (int)RMO.RMHTML.GetNumero(g, @"resistenza : <img src = '" + skillurl, @".gif");
                         p.FORZA      = (int)RMO.RMHTML.GetNumero(g, @"forza : <img src = '" + skillurl, @".gif");
                         p.PLACCAGGI  = (int)RMO.RMHTML.GetNumero(g, @"placcaggi : <img src = '" + skillurl, @".gif");
                         p.VELOCITA   = (int)RMO.RMHTML.GetNumero(g, @"velocità : <img src = '" + skillurl, @".gif");
                         p.PASSAGGI   = (int)RMO.RMHTML.GetNumero(g, @"passaggi : <img src = '" + skillurl, @".gif");
                         p.RICEZIONE  = (int)RMO.RMHTML.GetNumero(g, @"ricezione : <img src = '" + skillurl, @".gif");
                         p.CALCI      = (int)RMO.RMHTML.GetNumero(g, @"calci : <img src = '" + skillurl, @".gif");
                         Giocatori.Add(p);
                         totale_eta += p.ETA;
                     }
                 }
                 Internal.Main.StatusBar.Value   = 0;
                 Internal.Main.StatusBar.Maximum = Giocatori.Count;
                 Control.Player.MAXRESET();
                 panelPlayers.SuspendLayout();
                 panelPlayers.Controls.Clear();
                 int y = 0; int k = 0;
                 foreach (RMO.Class.Player pl in Giocatori)
                 {
                     Control.Player c = new RMO.Control.Player();
                     c.LoadData(pl);
                     c.ShowFACVT();
                     panelPlayers.Controls.Add(c);
                     if (Properties.Settings.Default.GrayLines)
                     {
                         if ((k++ % 2) == 0)
                         {
                             c.BackColor = Properties.Settings.Default.LinesColor1;
                         }
                         else
                         {
                             c.BackColor = Properties.Settings.Default.LinesColor2;
                         }
                     }
                     Internal.Main.StatusBar.Value++;
                 }
                 foreach (Control.Player p in panelPlayers.Controls)
                 {
                     p.SetSize();
                     p.Location = new Point(0, y);
                     y         += p.Height;
                 }
                 InitHeader();
                 panelPlayers.ResumeLayout();
                 decimal media = Math.Truncate((decimal)(totale_eta * 10 / Giocatori.Count)) / 10;
                 lEta.Text    = string.Format(T("Età media {0} anni"), media.ToString());
                 lTOTALE.Text = string.Format(T("{0} Giocatori"), Giocatori.Count.ToString());
             }
             else
             {
                 labelLoading.Text = T("Sei sicuro di essere manager di una nazionale?");
             }
         }
         catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
         Internal.Main.StatusBar.Value = 0;
         LOADING = (content == "");
     }
     catch (Exception ex) { My.Box.Errore("TabTeam::LoadFromDB()\r\n" + ex.Message); }
 }
示例#6
0
        private void SetBest(int num)
        {
            Class.Player empty = new RMO.Class.Player();
            Class.Player max = empty;
            switch (num)
            {
                case 10:
                    ComboPlayer_DropDown(c10, EventArgs.Empty);
                    foreach (Class.Player p in c10.Items) if (p.MEDIANODIAPERTURA > max.MEDIANODIAPERTURA) max = p;
                    if (max != empty) c10.SelectedItem = max; max = empty;
                    break;

                case 9:
                    ComboPlayer_DropDown(c9, EventArgs.Empty);
                    foreach (Class.Player p in c9.Items) if (p.MEDIANODIMISCHIA > max.MEDIANODIMISCHIA) max = p;
                    if (max != empty) c9.SelectedItem = max; max = empty;
                    break;

                case 8:
                    ComboPlayer_DropDown(c8, EventArgs.Empty);
                    foreach (Class.Player p in c8.Items) if (p.TERZALINEACENTRO > max.TERZALINEACENTRO) max = p;
                    if (max != empty) c8.SelectedItem = max; max = empty;
                    break;

                case 2:
                    ComboPlayer_DropDown(c2, EventArgs.Empty);
                    foreach (Class.Player p in c2.Items) if (p.TALLONATORE > max.TALLONATORE) max = p;
                    if (max != empty) c2.SelectedItem = max; max = empty;
                    break;

                case 15:
                    ComboPlayer_DropDown(c15, EventArgs.Empty);
                    foreach (Class.Player p in c15.Items) if (p.ESTREMO > max.ESTREMO) max = p;
                    if (max != empty) c15.SelectedItem = max; max = empty;
                    break;

                case 4:
                    ComboPlayer_DropDown(c4, EventArgs.Empty);
                    foreach (Class.Player p in c4.Items) if (p.SECONDALINEA > max.SECONDALINEA) max = p;
                    if (max != empty) c4.SelectedItem = max; max = empty;
                    break;

                case 5:
                    ComboPlayer_DropDown(c5, EventArgs.Empty);
                    foreach (Class.Player p in c5.Items) if (p.SECONDALINEA > max.SECONDALINEA) max = p;
                    if (max != empty) c5.SelectedItem = max; max = empty;
                    break;

                case 6:
                    ComboPlayer_DropDown(c6, EventArgs.Empty);
                    foreach (Class.Player p in c6.Items) if (p.TERZALINEAALA > max.TERZALINEAALA) max = p;
                    if (max != empty) c6.SelectedItem = max; max = empty;
                    break;

                case 7:
                    ComboPlayer_DropDown(c7, EventArgs.Empty);
                    foreach (Class.Player p in c7.Items) if (p.TERZALINEAALA > max.TERZALINEAALA) max = p;
                    if (max != empty) c7.SelectedItem = max; max = empty;
                    break;

                case 1:
                    ComboPlayer_DropDown(c1, EventArgs.Empty);
                    foreach (Class.Player p in c1.Items) if (p.PILONE > max.PILONE) max = p;
                    if (max != empty) c1.SelectedItem = max; max = empty;
                    break;

                case 3:
                    ComboPlayer_DropDown(c3, EventArgs.Empty);
                    foreach (Class.Player p in c3.Items) if (p.PILONE > max.PILONE) max = p;
                    if (max != empty) c3.SelectedItem = max; max = empty;
                    break;

                case 12:
                    ComboPlayer_DropDown(c12, EventArgs.Empty);
                    foreach (Class.Player p in c12.Items) if (p.CENTRO > max.CENTRO) max = p;
                    if (max != empty) c12.SelectedItem = max; max = empty;
                    break;

                case 13:
                    ComboPlayer_DropDown(c13, EventArgs.Empty);
                    foreach (Class.Player p in c13.Items) if (p.CENTRO > max.CENTRO) max = p;
                    if (max != empty) c13.SelectedItem = max; max = empty;
                    break;

                case 11:
                    ComboPlayer_DropDown(c11, EventArgs.Empty);
                    foreach (Class.Player p in c11.Items) if (p.ALA > max.ALA) max = p;
                    if (max != empty) c11.SelectedItem = max; max = empty;
                    break;

                case 14:
                    ComboPlayer_DropDown(c14, EventArgs.Empty);
                    foreach (Class.Player p in c14.Items) if (p.ALA > max.ALA) max = p;
                    if (max != empty) c14.SelectedItem = max; max = empty;
                    break;
            }
        }