private void button1_Click(object sender, EventArgs e) { int offertaNum = 0; Giocatore selezionato = null; foreach (Giocatore g in lega.ListaSvincolati.Giocatori) { if (textBox3.Text.Equals(g.Nome)) { selezionato = g; break; } } try { offertaNum = Int32.Parse(textBox1.Text); } catch (Exception exc) { MessageBox.Show("Hai sbagliato a scrivere l'offerta, deve essere un intero!"); return; } if ((ValidaOfferta(offertaNum, selezionato))) { ServerLega.ServerLegaSoapClient myGestioneAsta = new ServerLegaSoapClient(); Lega legaPass = myGestioneAsta.Offri(offertaNum, squadra, lega); lega = legaPass; this.Hide(); new HomeMercatoAdmin(lega, squadra).Show(); } else { MessageBox.Show("Offerta non valida, reinserire i dati!"); } }
private void buttonCreaMercato_Click(object sender, EventArgs e) { if (lega.ListaSvincolati == null) { MessageBox.Show("Caricare prima la lista svincolati"); } else { if (lega.MercatoAttivo == null) { ServerLegaSoapClient myGestioneAdminController = new ServerLegaSoapClient(); lega = myGestioneAdminController.creaMercato(lega); //List<Squadra> squadre = mercato.Squadre; if (lega.MercatoAttivo != null) { MessageBox.Show("Hai creato un mercato per la lega. Unisciti!"); } else { MessageBox.Show("Errore nella creazione del mercato! Riprova!"); } } else { MessageBox.Show("E' già presente un mercato attivo in questa lega. Unisciti!"); } } }
private void buttonOffri_Click(object sender, EventArgs e) { int offertaNum = 0; try { offertaNum = Int32.Parse(textBoxOfferta.Text); } catch (Exception) { MessageBox.Show("Hai sbagliato a scrivere l'offerta, deve essere un intero!"); return; } Giocatore selezionato = TrovaGiocatore(comboBoxSvincolati.SelectedItem.ToString()); if ((ValidaOfferta(offertaNum, selezionato)) && (comboBoxSvincolati.SelectedItem != null) && selezionato != null) { ServerLega.ServerLegaSoapClient myGestioneAsta = new ServerLegaSoapClient(); Lega legaPass = myGestioneAsta.CreaAsta(selezionato, offertaNum, squadra, lega); lega = legaPass; this.Hide(); new HomeMercatoAdmin(lega, squadra).Show(); } else { MessageBox.Show("Offerta non valida o giocatore selezionato non valido, reinserire i dati!"); } }
public HomeMercatoAdmin(Lega legaPass, Squadra squadra) { InitializeComponent(); this.lega = legaPass; this.squadra = squadra; this.mercato = lega.MercatoAttivo; textBoxCrediti.Text = "" + lega.SquadraAdmin.CreditiResidui; buttonCrea.Enabled = false; buttonPartecipa.Enabled = false; textBoxGiocatore.Enabled = false; textBoxCrediti.Enabled = false; textBoxOfferta.Enabled = false; if (lega.SquadraAdmin.Giocatori.Count != 0) { foreach (Giocatore g in lega.SquadraAdmin.Giocatori) { listBoxAcquisti.Items.Add(g.Nome.ToString()); } } if (lega.MercatoAttivo.AstaAttiva != null) { textBoxGiocatore.Text = lega.MercatoAttivo.AstaAttiva.Giocatore.Nome; textBoxOfferta.Text = "" + lega.MercatoAttivo.AstaAttiva.UltimaOfferta; } ServerLegaSoapClient myGestioneAdminController = new ServerLegaSoapClient(); Turno result = new Turno(); result = myGestioneAdminController.GestisciAsta(lega, squadra); if (result == null) { MessageBox.Show("Errore durante la gestione dell'asta."); } if (result.Ruolo == "FINITO") { MessageBox.Show("Il mercato è stato completato."); new HomeLegaAdmin(lega).Show(); } if (result.Ruolo == "ALTRI") { MessageBox.Show("Altri utenti devono finire di fare l'asta."); Thread.Sleep(3000); result = myGestioneAdminController.GestisciAsta(lega, squadra); } if (result.Tipo == true) { labelAttesa.Visible = false; MessageBox.Show("E' il tuo turno devi creare una asta."); buttonCrea.Enabled = true; } else { labelAttesa.Visible = false; MessageBox.Show("E' il tuo turno devi partecipare ad una asta."); buttonPartecipa.Enabled = true; } }
private void button2_Click(object sender, EventArgs e) { ServerLega.ServerLegaSoapClient myGestioneAsta = new ServerLegaSoapClient(); Lega legaPass = myGestioneAsta.Rialza(squadra, lega); lega = legaPass; this.Hide(); new HomeMercatoAdmin(lega, squadra).Show(); }
public void SetUp() { Utente _utente = new Utente(); _utente.Email = "*****@*****.**"; _utente.IsAdmin = true; //INVOCAZIONE DEL METODO REMOTO ServerLegaSoapClient myGestioneUtenteController = new ServerLegaSoapClient(); _lega = myGestioneUtenteController.CreaLega("TestCreaLega", 4, "SquareFC", _utente); myGestioneUtenteController.Close(); }
private void buttonChiudiMercato_Click(object sender, EventArgs e) { /*Boolean benFormate = true; * for (int i = 0; i < mercato.Squadre.Count(); i++) * { * if (!mercato.Squadre.ElementAt(i).VerificaCompletezza()) * { * benFormate = false; * break; * } * } * if (!benFormate) * { * if (MessageBox.Show("Sei sicuro di chiudere un mercato non concluso?", "Mercato", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) * { * ServerLegaSoapClient myGestioneAdminController = new ServerLegaSoapClient(); * Boolean result; * result = myGestioneAdminController.ChiudiMercato(mercato); * if (result == true) * { * MessageBox.Show("Mercato chiuso anche se non completo"); * new HomeLegaAdmin(mercato.Lega).Show(); * } * else * { * MessageBox.Show("Errore nella chiusura del mercato"); * } * } * else * { * MessageBox.Show("Mercato ancora attivo"); * } * } * else * {*/ ServerLegaSoapClient myGestioneAdminController = new ServerLegaSoapClient(); Lega result; result = myGestioneAdminController.ChiudiMercato(mercato, lega); if (result != null) { MessageBox.Show("Mercato chiuso correttamente"); lega = result; this.Hide(); new HomeLegaAdmin(lega).Show(); } else { MessageBox.Show("Errore nella chiusura del mercato"); } /*}*/ }
public void SetUp() { Utente _utente = new Utente(); _utente.Email = "mailtestLega.com"; _utente.IsAdmin = true; _lega = new Lega(); _lega.NumeroSquadreTotali = 10; _lega.NomeLega = "LigaCspt"; _lega.Squadre = new List <Squadra>(); Squadra _squadraAdmin = new Squadra(); _squadraAdmin.Utente = _utente; _squadraAdmin.Nome = "SquareFC"; _lega.Squadre.Add(_squadraAdmin); _lega.SquadraAdmin = _squadraAdmin; ServerLegaSoapClient myGestioneAdminController = new ServerLegaSoapClient(); _lega = myGestioneAdminController.SetImpostazioni(8, 100, 2, 6, 6, 4, _lega); myGestioneAdminController.Close(); }
private void buttonRegistrati_Click(object sender, EventArgs e) { //richiesta di registrazione al ServerLogin mediante il proxy Client Client.ServerLogin1.RegistrazioneControllerSoapClient myRegistrazioneController = new Client.ServerLogin1.RegistrazioneControllerSoapClient(); String emailEsito = myRegistrazioneController.RegistraUtente(textBoxUsername.Text, textBoxPassword.Text, textBoxEmail.Text.ToLower().Trim(), textBoxDomanda.Text, textBoxRisposta.Text); if (emailEsito == null) { MessageBox.Show("Username già occupato. Prova con un altro"); } else { MessageBox.Show("Registrazione avvenuta con successo. Utente con email: " + emailEsito); ServerLegaSoapClient myServerLega = new ServerLegaSoapClient(); myServerLega.InsertUtente(textBoxUsername.Text, emailEsito); Utente utenteNav = new Utente(); utenteNav.Email = emailEsito; this.Hide(); WelcomeHome welcomeHome = new WelcomeHome(utenteNav); welcomeHome.BringToFront(); welcomeHome.Show(); } }