Esempio n. 1
0
        private async void txtRemoveSearch_Click(object sender, EventArgs e)
        {
            MongoRead      read    = new MongoRead();
            FighterProfile fighter = null;

            try
            {
                fighter = await read.getFighter(txtremoveFirstName.Text, txtremoveLastName.Text);

                delete_id = fighter._id;
            }
            catch (Exception ex)
            {
                //No Error Message Needed
            }


            if (delete_id != null)
            {
                txtRemoveName.Text        = fighter.Name.ToString();
                txtRemoveNickName.Text    = fighter.Nickname.ToString();
                txtRemoveheight.Text      = fighter.Height.ToString();
                txtRemoveFightStyle.Text  = fighter.FightStyle.Style.ToString();
                txtRemoveWeightClass.Text = fighter.WeightClass.ToString();
                txtRemoveAge.Text         = fighter.Age.ToString();
                txtRemoveDraws.Text       = fighter.WinLossRecord.Draws.ToString();
                txtRemoveWins.Text        = fighter.WinLossRecord.Wins.ToString();
                txtRemoveLosses.Text      = fighter.WinLossRecord.Losses.ToString();
                txtRemoveWeightClass.Text = fighter.WeightClass.ToString();
                txtUpdateWeight.Text      = fighter.Weight.ToString();
            }
        }
Esempio n. 2
0
    private static MongoRead RegisterMongoDb()
    {
        var readServer = MongoServer.Create(connectionString);
        var read       = new MongoRead(readServer);

        var myConventions = new ConventionProfile();

        myConventions.SetIdMemberConvention(new NoDefaultPropertyIdConvention());
        BsonClassMap.RegisterConventions(myConventions, t => true);

        return(read);
    }
Esempio n. 3
0
        private async void btnSearchFighter_Click(object sender, EventArgs e)
        {
            MongoRead read = new MongoRead();



            var fighter = await read.getFighter(txtSearchFirstName.Text, txtSearchLastName.Text);


            if (fighter != null)
            {
                txtSearchName.Text        = fighter.Name.ToString();
                txtSearchNickName.Text    = fighter.Nickname.ToString();
                txtSearchHeight.Text      = fighter.Height.ToString();
                txtSearchFightStyle.Text  = fighter.FightStyle.Style.ToString();
                txtUpdateWeightClass.Text = fighter.WeightClass.ToString();
                txtSearchAge.Text         = fighter.Age.ToString();
                txtSearchDraws.Text       = fighter.WinLossRecord.Draws.ToString();
                txtSearchWins.Text        = fighter.WinLossRecord.Wins.ToString();
                txtSearchlosses.Text      = fighter.WinLossRecord.Losses.ToString();
                txtSearchWeightClass.Text = fighter.WeightClass.ToString();
                txtSearchWeight.Text      = fighter.Weight.ToString();
            }
        }