Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CtrAuction ctrAuction = new CtrAuction();

            DateTime dateCreated = dtpDate.Value;

            string description = txtDecs.Text;
            List<Art> artList = lbxSelectedArt.Items.OfType<Art>().ToList();
            if (dateCreated < DateTime.Now) {
                MessageBox.Show("Vælg en kommende dato", "Fejl", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } else if (artList.Count == 0) {
                MessageBox.Show("Der skal vælges kunstgenstande", "Fejl", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } else {
                if (auction == null) {
                    ctrAuction.CreateAuction(dateCreated, description, artList);
                    MessageBox.Show("Auktionen er oprettet", "Succes", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
                else {
                    auction.Date = dtpDate.Value;
                    auction.Description = txtDecs.Text;
                    auction.Arts = artList;
                    ctrAuction.UpdateAuction(auction);
                    MessageBox.Show("Auktionen er nu redigeret", "Succes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                btnCancel_Click(null,null);
            }
        }
Ejemplo n.º 2
0
        public Budgivning(Auction au)
        {
            InitializeComponent();

            lblHeader.Text = "Auktion den " + au.Date;

            currentAuction = au;

            ctrArt = new CtrArt();
            ctrAuc = new CtrAuction();

            dgvArts.DataSource = ctrArt.RetrieveAll(au.Id);
        }
Ejemplo n.º 3
0
 private void lbxUpcoming_KeyDown(object sender, KeyEventArgs e)
 {
     if (auction == null)
         return;
     if (e.KeyCode == Keys.Delete) {
         DialogResult result = MessageBox.Show("Er du sikker på at du vel slette auktionen",
             "Slet auktion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (result == DialogResult.Yes) {
             CtrAuction ctrAuction = new CtrAuction();
             ctrAuction.DeleteAuction(auction);
             MessageBox.Show("Auktionen er slettet",
             "Slet auktion", MessageBoxButtons.OK, MessageBoxIcon.Information);
             btnCancel_Click(null, null);
         }
     }
 }
Ejemplo n.º 4
0
 private void getUpcomingAuctions()
 {
     CtrAuction ctrAuction = new CtrAuction();
     lbxUpcoming.DataSource = ctrAuction.GetAll(false);
     lbxUpcoming.SelectedIndex = -1;
 }
Ejemplo n.º 5
0
 private void getEndedAuction()
 {
     CtrAuction ctrAuction = new CtrAuction();
     lbxEnded.DataSource = ctrAuction.GetAll(true);
     lbxEnded.SelectedIndex = -1;
 }
 public void CtrArtTestInitialize()
 {
     Console.Out.WriteLine("CtrArtTestInitialize called");
     ctrAuction = new CtrAuction();
     artCtr = new CtrArt();
 }
 public void CtrArtTestCleanup()
 {
     Console.Out.WriteLine("CtrArtTestCleanup called");
     ctrAuction = null;
     artCtr = null;
 }
        public void TestUpdateAuctionArt()
        {
            Console.WriteLine("TestUpdateAuctionArt called");

            Auction au = new CtrAuction().RetriveById(22);

            Assert.IsNotNull(au, "is found");

            Art aTemp = ctrArt.RetrieveByNo(1020);

            aTemp = ctrArt.UpdateToAuction(aTemp.Id, au);

            Assert.IsNotNull(aTemp.Auction, "Auction is set");
        }