Beispiel #1
0
        public void TestMemberRetrieveSingleByID()
        {
            Console.Out.WriteLine("TestMemberRetrieveSingleByID called");

            Member mTemp = ctrMem.RetrieveSingleByID(1);

            Assert.IsNotNull(mTemp, "Is not null");
        }
Beispiel #2
0
        public void TestInsertBid()
        {
            CtrMember ctrMem = new CtrMember();
            CtrArt    ctrArt = new CtrArt();


            Art    a = ctrArt.RetrieveByNo(1410);
            Member m = ctrMem.RetrieveSingleByID(1);

            CtrMember.MemberBidState state = ctrAuction.InsertBid(m.Id, 9000, a.Id);

            if (state == CtrMember.MemberBidState.BidConfirmed)
            {
                Console.WriteLine(ctrMem.WithdrawAmount(m.Id, 9000));
            }

            Console.WriteLine(state);
        }
Beispiel #3
0
        private void btnBid_Click(object sender, EventArgs e)
        {
            CtrMember ctrMem = new CtrMember();

            Member m = ctrMem.RetrieveSingleByID(Convert.ToInt32(txtMember.Text));
            Art    a = ctrArt.RetrieveByNo(currentArt.Number);

            if (previosBidder != null)
            {
                if (previosBidder.Id == m.Id)
                {
                    lblBidState.Text = "Medlem har allerede højeste bud!";
                }
                else
                {
                    if (currentArt.StartingBid > Convert.ToDecimal(txtBidAmount.Text))
                    {
                        lblBidState.Text = "Buddet er mindre end startsprisen!";
                    }
                    else if (previousBid >= Convert.ToDecimal(txtBidAmount.Text))
                    {
                        lblBidState.Text = "Buddet skal være højere end det forrige!";
                    }
                    else
                    {
                        CtrMember.MemberBidState state = ctrAuc.InsertBid(m.Id, Convert.ToDecimal(txtBidAmount.Text), a.Id);

                        if (state == CtrMember.MemberBidState.BidConfirmed)
                        {
                            lblBidState.Text = "Bud accepteret!";
                            previosBidder    = m;
                            previousBid      = Convert.ToDecimal(txtBidAmount.Text);
                            populatebids(a.Number);
                        }
                        if (state == CtrMember.MemberBidState.BidError)
                        {
                            lblBidState.Text = "Bud blev ikke accepteret!";
                        }
                        if (state == CtrMember.MemberBidState.NotEnough)
                        {
                            lblBidState.Text = "Medlem har ikke nok point!";
                        }
                    }
                }
            }

            else
            {
                if (currentArt.StartingBid > Convert.ToDecimal(txtBidAmount.Text))
                {
                    lblBidState.Text = "Buddet er mindre end startsprisen!";
                }
                else if (previousBid >= Convert.ToDecimal(txtBidAmount.Text))
                {
                    lblBidState.Text = "Buddet skal være højere end det forrige!";
                }
                else
                {
                    CtrMember.MemberBidState state = ctrAuc.InsertBid(m.Id, Convert.ToDecimal(txtBidAmount.Text), a.Id);

                    if (state == CtrMember.MemberBidState.BidConfirmed)
                    {
                        lblBidState.Text = "Bud accepteret!";
                        previosBidder    = m;
                        previousBid      = Convert.ToDecimal(txtBidAmount.Text);
                        populatebids(a.Number);
                    }
                    if (state == CtrMember.MemberBidState.BidError)
                    {
                        lblBidState.Text = "Bud blev ikke accepteret!";
                    }
                    if (state == CtrMember.MemberBidState.NotEnough)
                    {
                        lblBidState.Text = "Medlem har ikke nok point!";
                    }
                }
            }
        }