void najboljiIgrac(double[] ekipa, string[] indeksSkill, bool domacin) { int najbolji = 0; double max = 0; int indeks = -1; // max = ekipa[0]; for (int i = 0; i < ekipa.Length; i++) { if (max <= ekipa[i]) { max = ekipa[i]; indeks = i; } } najbolji = indeks; string[] splitedIndeksSkill = indeksSkill[najbolji].Split(':'); int indeksIgraca = Convert.ToInt32(splitedIndeksSkill[0]); string idIgraca = ""; string[] separators = new string[] { "<&>" }; if (domacin) { //string[] splitedIdImePos = idsNamePosDomaci[indeksIgraca].Split(); string[] splitedIdImePos = idsNamePosDomaci[indeksIgraca].Split(separators, StringSplitOptions.None); idIgraca = splitedIdImePos[0]; } else { string[] splitedIdImePos = idsNamePosGosti[indeksIgraca].Split(separators, StringSplitOptions.None); idIgraca = splitedIdImePos[0]; } try { var _client = new MongoClient(); var _database = _client.GetDatabase("test"); var collection = _database.GetCollection <Igrac>("igraci"); var filter = new BsonDocument(); var query = new QueryDocument("_id", new ObjectId(idIgraca)); var result = collection.Find(query).FirstOrDefault(); FDodavanjeIgraca fdi = new FDodavanjeIgraca(result); fdi.ShowDialog(); } catch (Exception ec) { MessageBox.Show(ec.ToString()); } }
private void igraciToolStripMenuItem_Click(object sender, EventArgs e) { FDodavanjeIgraca forma = new FDodavanjeIgraca(); forma.ShowDialog(); }
void najboljiIgrac(double[] ekipa, string[] indeksSkill, bool domacin) { int najbolji = 0; double max = 0; int indeks = -1; // max = ekipa[0]; for (int i = 0; i < ekipa.Length; i++) { if (max <= ekipa[i]) { max = ekipa[i]; indeks = i; } } najbolji = indeks; string[] splitedIndeksSkill = indeksSkill[najbolji].Split(':'); int indeksIgraca = Convert.ToInt32(splitedIndeksSkill[0]); string idIgraca = ""; string[] separators = new string[] { "<&>" }; if (domacin) { //string[] splitedIdImePos = idsNamePosDomaci[indeksIgraca].Split(); string[] splitedIdImePos = idsNamePosDomaci[indeksIgraca].Split(separators, StringSplitOptions.None); idIgraca = splitedIdImePos[0]; } else { string[] splitedIdImePos = idsNamePosGosti[indeksIgraca].Split(separators, StringSplitOptions.None); idIgraca = splitedIdImePos[0]; } try { var _client = new MongoClient(); var _database = _client.GetDatabase("test"); var collection = _database.GetCollection<Igrac>("igraci"); var filter = new BsonDocument(); var query = new QueryDocument("_id", new ObjectId(idIgraca)); var result = collection.Find(query).FirstOrDefault(); FDodavanjeIgraca fdi = new FDodavanjeIgraca(result); fdi.ShowDialog(); } catch (Exception ec) { MessageBox.Show(ec.ToString()); } }
private void PbIgrac_Click(object sender, EventArgs e) { FDodavanjeIgraca fdi = new FDodavanjeIgraca(); fdi.ShowDialog(); }