示例#1
0
 //fill all combobox sources
 private void FillCombo(int homeID, int awayID)
 {
     NumberOfPeriods = new List <string>()
     {
         "1", "2", "3"
     };
     //0,15 minute period lenght (9 seconds) for testing purposes
     PeriodLenghts = new List <string>()
     {
         "0,15", "10", "15", "20"
     };
     SpecialTeams = new List <string>()
     {
         "YV", "AV", "RL", "TM"
     };
     cmbNumberOfPeriods.ItemsSource      = NumberOfPeriods;
     cmbPeriodLenght.ItemsSource         = PeriodLenghts;
     cmbErikoistilanneKoti.ItemsSource   = SpecialTeams;
     cmbErikoistilanneVieras.ItemsSource = SpecialTeams;
     HomePlayers = DBSalibandytournament.GetTeamPlayersFromDB(homeID);
     AwayPlayers = DBSalibandytournament.GetTeamPlayersFromDB(awayID);
     cmbTekijaKoti.ItemsSource     = HomePlayers;
     cmbSyottajaKoti.ItemsSource   = HomePlayers;
     cmbKarsijaKoti.ItemsSource    = HomePlayers;
     cmbKarsijaVieras.ItemsSource  = AwayPlayers;
     cmbTekijaVieras.ItemsSource   = AwayPlayers;
     cmbSyottajaVieras.ItemsSource = AwayPlayers;
 }
示例#2
0
        private string FillOK()
        {
            if (txtLastname.Text == "" || txtFirstname.Text == "" || txtPlayernumber.Text == "" || cmbTeams.SelectedValue == null)
            {
                return("Täytä kaikki tähdellä merkityt kohdat ennen tallentamista.");
            }
            bool          parseok = Int32.TryParse(cmbTeams.SelectedValue.ToString(), out int TeamID);
            List <Player> players = DBSalibandytournament.GetTeamPlayersFromDB(TeamID);

            foreach (Player p in players)
            {
                if (txtPlayernumber.Text == p.Pelinumero && txtID.Text != p.HenkiloId.ToString())
                {
                    return($"Pelinumero on jo käytössä joukkueessa {cmbTeams.Text}.");
                }
            }
            return("ok");
        }