//Đ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; }
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); } }
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; } }