示例#1
0
        private async void btnCreatePlayer(object sender, EventArgs e)
        {
            player player = new player()
            {
                playerName     = pName.Text,
                playerNumber   = int.Parse(pNumber.Text),
                playerAge      = pAge.Text,
                playerPosition = pPosition.Text
            };

            var   picker      = dropDownSport;
            sport typeOfSport = (sport)picker.SelectedItem;

            sportId = typeOfSport.id;

            bool status = await manager.managerCreatePlayer(player, clubId, sportId);

            if (status == true)
            {
                pName.Text     = "";
                pNumber.Text   = "";
                pAge.Text      = "";
                pPosition.Text = "";

                eMessage.Text      = "Spiller tilføjet!";
                eMessage.TextColor = Color.Green;
            }
            else
            {
                eMessage.Text = "Ups! Noget gik galt, prøv igen";
            }
        }
示例#2
0
 public AzurirajSport(sport sport)
 {
     InitializeComponent();
     this.Selektiranisport = sport;
     txtDisciplina.Text    = Selektiranisport.disciplina;
     txtNaziv.Text         = Selektiranisport.naziv;
 }
示例#3
0
        public void DodjeliSportUceniku()
        {
            try
            {
                if (dgvUcenik.CurrentRow != null)
                {
                    ucenik   ucenik  = dgvUcenik.CurrentRow.DataBoundItem as ucenik;
                    sport    sport   = cboSport.SelectedItem as sport;
                    DateTime datum   = dateVjezbanja.Value;
                    int      ocijena = int.Parse(cboOcijena.Text);
                    string   opis    = txtOpis.Text;

                    var rezultat = sport_ucenik.DohvatiSportIOcijenuUcenika(ucenik, sport);
                    if (rezultat != null)
                    {
                        MessageBox.Show(PorukaPogreska.UcenikImaOcijenu, PorukaPogreska.Zaglavlje);
                        return;
                    }
                    sport_ucenik.DodajOcijenuUceniku(sport.id_sporta, ucenik.id_ucenika, datum, ocijena, opis);

                    MessageBox.Show(@"Uspjesno dodana ocijena: " + ocijena + "\nUceniku: " +
                                    dgvUcenik.SelectedRows[0].Cells[0].Value + @" " +
                                    dgvUcenik.SelectedRows[0].Cells[1].Value +
                                    "\nGodina: " + dgvUcenik.SelectedRows[0].Cells[3].Value, PorukaUspjesno.Zaglavlje);
                    DohvatiSveOcijeneUcenika();
                }
            }
            catch
            {
                MessageBox.Show(PorukaPogreska.ProvjeritePopunjenostForme, PorukaPogreska.Zaglavlje);
            }
        }
        public void DodjeliSportUceniku()
        {
            try
            {
                if (dgvUcenik.CurrentRow != null)
                {
                    ucenik   ucenik  = dgvUcenik.CurrentRow.DataBoundItem as ucenik;
                    sport    sport   = cboSport.SelectedItem as sport;
                    DateTime datum   = dateVjezbanja.Value;
                    int      ocijena = int.Parse(cboOcijena.Text);
                    string   opis    = txtOpis.Text;

                    var rezultat = sport_ucenik.DohvatiSportIOcijenuUcenika(ucenik, sport);
                    if (rezultat != null)
                    {
                        MessageBox.Show(@"Uceniku ste vec dodali ocijenu, mozete ju samo azurirati!", @"Greska");
                        return;
                    }
                    sport_ucenik.DodajOcijenuUceniku(sport.id_sporta, ucenik.id_ucenika, datum, ocijena, opis);

                    MessageBox.Show(@"Uspjesno dodana ocijena: " + ocijena + "\nUceniku: " +
                                    dgvUcenik.SelectedRows[0].Cells[0].Value + @" " +
                                    dgvUcenik.SelectedRows[0].Cells[1].Value +
                                    "\nGodina: " + dgvUcenik.SelectedRows[0].Cells[3].Value, @"Dodano");
                    DohvatiSveOcijeneUcenika();
                }
            }
            catch
            {
                MessageBox.Show(@"Provjerite popunjenost forme!", @"Greska");
            }
        }
示例#5
0
        //gets sports for filter
        public List <sport> GetAllSports()
        {
            var cs     = Services.ContentService;
            var sports = cs.GetChildren(1136);

            List <sport> allSports = new List <sport>();

            foreach (var sport in sports)
            {
                var s = new sport();

                s.id        = sport.Id;
                s.sportName = sport.Name;
                try
                {
                    s.sportImage = this.GetImg(sport.Properties["sportImage"].Value.ToString());
                }
                catch
                {
                    s.sportImage = "";
                };

                allSports.Add(s);
            }

            return(allSports);
        }
 public AzurirajOcijenuUcenika(ucenik ucenik, sport sport)
 {
     InitializeComponent();
     this.Ucenik = ucenik;
     this.Sport  = sport;
     Postavi();
     DohvatiOcijene();
     DohvatiOcijenuSporta();
 }
        public IHttpActionResult GetSport(int id)
        {
            sport sport = db.sports.Single(x => x.id == id);

            if (sport == null)
            {
                return(NotFound());
            }

            return(Ok(sport));
        }
示例#8
0
        private sport GetSport(string sportId)
        {
            var cs = Services.ContentService;

            var sport = cs.GetById(Guid.Parse(sportId.Substring(15)));
            var s     = new sport();

            s.id        = sport.Id;
            s.sportName = sport.Properties["sportName"].Value.ToString();

            return(s);
        }
示例#9
0
        private void btnObrisi_Click(object sender, EventArgs e)
        {
            sport selektiraniSport = sportBindingSource.Current as sport;

            if (selektiraniSport != null)
            {
                if (MessageBox.Show("Da li ste sigurni?", "Upozorenje!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    sport.BrisanjeSporta(selektiraniSport);
                    PrikaziSportove();
                }
            }
        }
示例#10
0
        private async void btnCreateTeam(object sender, EventArgs e)
        {
            var     picker      = listOfSports;
            sport   typeOfSport = (sport)picker.SelectedItem;
            int     sId         = typeOfSport.id;
            newTeam team        = new newTeam()
            {
                teamName     = teamName.Text,
                managerName  = coachName.Text,
                managerPass  = coachPassword.Text,
                managerEmail = managerEmail.Text,
                sportId      = sId
            };

            if (coachPassword.Text == coachPassword2.Text && coachPassword.Text.Length > 9)
            {
                teamId = await manager.managerCreateTeam(team, clubId);

                if (teamId != 0)
                {
                    string username = coachName.Text.Replace(" ", "").ToLower();
                    teamName.Text       = "";
                    coachName.Text      = "";
                    coachPassword.Text  = "";
                    coachPassword2.Text = "";
                    managerEmail.Text   = "";

                    eMessage.Text = "Hold Tilføjet" +
                                    "";
                    eMessage.TextColor  = Color.Green;
                    eMessage2.Text      = "Hold leder login: "******" SKRIV DETTE NED ";
                    eMessage2.TextColor = Color.Green;
                }
                else
                {
                    eMessage.Text = "Ups! Noget gik galt, prøv igen";
                }
            }
            else
            {
                wrongPassword.Text = "Passwords skal være ens eller indeholde over 10 tegn";
            }

            playersAddBtn.IsVisible = true;
        }
示例#11
0
		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello World!");
			//portStream ps=new portStream("/dev/pts/2");
			//socketPort sp=new socketPort("atom2",3333);
#if use_net
			tcpclientserver tcp=new tcpclientserver("atom2", 3333);
#else
			sport myPort=new sport();
#endif
			bool bExit=false;
			string sSend="";
			do{
				ConsoleKeyInfo ki = Console.ReadKey();
				if(ki.KeyChar.ToString().ToUpper()=="Q")
					bExit=true;
				else{
					if(ki.Key==ConsoleKey.Enter)
					{
						//sSend+="\n"; sendData uses writeline
#if use_net
						tcp.sendData(sSend);
#else
						myPort.writeCOMM(sSend+"\n");
#endif
						sSend="";
					}
					else
						sSend+=ki.KeyChar.ToString();
					//sp.sendData(ki.KeyChar.ToString());
				}
			}while(!bExit);
			//myPort.Dispose();
			//ps.Dispose();
			//sp.Dispose();
#if use_net
			tcp.Dispose();
#else
			myPort.Dispose();
#endif
		}
示例#12
0
        static void Main(string[] args)
        {
            /*fashion fashion;          // Menggunakan Abstract Class
             *
             * Console.WriteLine();
             * fashion = new sneakers();
             * fashion.sepatu();
             * Console.WriteLine();
             * fashion = new boots();
             * fashion.sepatu();
             * Console.WriteLine();
             * fashion = new pantofel();
             * fashion.sepatu();
             * Console.WriteLine();
             * fashion = new sport();
             * fashion.sepatu();
             * Console.WriteLine();*/

            Ifashion fashion;       // Menggunakan Interface

            Console.WriteLine();
            fashion = new sneakers();
            fashion.sepatu();
            Console.WriteLine();

            fashion = new pantofel();
            fashion.sepatu();
            Console.WriteLine();

            fashion = new boots();
            fashion.sepatu();
            Console.WriteLine();

            fashion = new sport();
            fashion.sepatu();
            Console.WriteLine();

            Console.ReadKey();
        }