Exemplo n.º 1
0
        //Điền tên người thắng
        public string FillWinname(NumericUpDown nmrNumberMatch)
        {
            string matchId = nmrNumberMatch.Value.ToString();
            string name = "";
            string figWinId = "";

            try
            {
                var match = new Match();
                match = TextDataUltil.GetMatchFromMatchId(matchId);
                if (match != null)
                {
                    figWinId = match.FigIdWin;
                }

                if (figWinId != "")
                {
                    try
                    {
                        var fighter = new Fighter();
                        fighter = TextDataUltil.GetFighterFormFigId(figWinId);
                        if (fighter != null)
                        {
                            name = fighter.FigName;
                        }
                    }
                    catch (Exception) { }
                }
            }
            catch (Exception) { }

            return name;
        }
Exemplo n.º 2
0
        private void setValuesTextboxRed(string figIdRed)
        {
            try
            {
                string sex = "";
                string weight = "";

                string name = "";
                string id = "";
                string classs = "";

                var fighter = new Fighter();
                fighter = TextDataUltil.GetFighterFormFigId(figIdRed);
                if (fighter != null)
                {
                    sex = fighter.FigSex;
                    weight = fighter.FigWeight;
                    name = fighter.FigName;
                    id = fighter.FigId;
                    classs = fighter.FigClass;
                }
                cbbSex.Text = sex;
                cbbWeight.Text = weight;

                txtNameRed.Text = name;
                txtIdRed.Text = id;
                txtClassRed.Text = classs;
            }
            catch (Exception fail)
            {
                String error = "The following error has occurred:\n\n";
                error += fail.Message.ToString() + "\n\n";
                MessageBox.Show(error);
            }
        }
Exemplo n.º 3
0
 public static List<Fighter> ReadFighterText()
 {
     try
     {
         Fighter fighter;
         var fighters = new List<Fighter>();
         string[] lines = File.ReadAllLines(pathFighterText);
         foreach (string line in lines)
         {
             string[] cols = line.Split('\t');
             fighter = new Fighter
                 {
                     FigId = cols[1],
                     FigName = cols[2],
                     FigClass = cols[3],
                     FigSex = cols[4],
                     FigWeight = cols[5]
                 };
             fighters.Add(fighter);
         }
         return fighters;
     }
     catch (Exception)
     {
         MessageBox.Show("Có vấn đề với file " + pathFighterText + ". Kiểm tra xem file đã tồn tại hoặc có dữ liệu hay chưa?");
         return null;
     }
 }