예제 #1
0
        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());
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: nemanjaMet/MongoDB
 private void igraciToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FDodavanjeIgraca forma = new FDodavanjeIgraca();
     forma.ShowDialog();
 }
예제 #3
0
        private void igraciToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FDodavanjeIgraca forma = new FDodavanjeIgraca();

            forma.ShowDialog();
        }
예제 #4
0
        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());
            }
        }
예제 #5
0
        private void PbIgrac_Click(object sender, EventArgs e)
        {
            FDodavanjeIgraca fdi = new FDodavanjeIgraca();

            fdi.ShowDialog();
        }
예제 #6
0
 private void PbIgrac_Click(object sender, EventArgs e)
 {
     FDodavanjeIgraca fdi = new FDodavanjeIgraca();
     fdi.ShowDialog();
 }