예제 #1
0
        private void reserveButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (mediaLogic.ListBorrow(media.MediaId).Count <= 0)
                {
                    try
                    {
                        if (mediaLogic.ListReserve(media.MediaId).Count <= 0)
                        {
                            int affectedRows = mediaLogic.InsertReserve(CurrentUser.UserID, media.MediaId, DateTime.Today.ToString("dd/MM/yyyy"));                          //change this according to the computers date layout either dd/MM/yyyy or MM/dd/yyyy
                            MessageBox.Show("A reservation has been made");
                        }
                        else
                        {
                            MessageBox.Show(media.MediaName + " this media is already reserved");
                        }

                        RefreshUserList();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Please select a media");
                    }
                }
                else
                {
                    MessageBox.Show(media.MediaName + " is not available for reservation");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please select a media");
            }
        }
예제 #2
0
        //NEW RESERVE 24/05/2017


        //RESERVE BUTTON CLICK
        private void reserveButton_Click(object sender, EventArgs e)
        {
            if (mediaLogic.ListReserve(media.MediaId) == null)
            {
                int affectedRows = mediaLogic.InsertReserve(CurrentUser.UserID, media.MediaId, DateTime.Today.ToString("MM/dd/yyyy"));
                MessageBox.Show(media.MediaName + " this was succesfully reserved!");
            }

            else
            {
                MessageBox.Show(media.MediaName + " sorry but you have already reserved this media!");
            }

            RefreshUserList();
        }