示例#1
0
        private void ReturnMediabutton_Click(object sender, RoutedEventArgs e)
        {
            if (testdatagrid.SelectedItem != null && memebrs.SelectedItem != null)
            {
                if (!((Media)testdatagrid.SelectedItem).Availability)
                {
                    if (((LibraryMember)(memebrs.SelectedItem)).Name == ((Media)testdatagrid.SelectedItem).libraryMembers)
                    {
                        ((Media)testdatagrid.SelectedItem).libraryMembers = ((LibraryMember)memebrs.SelectedItem).Name;
                        LibraryMember libraryMember = (LibraryMember)memebrs.SelectedItem;
                        Media         media         = (Media)testdatagrid.SelectedItem;
                        ((Media)testdatagrid.SelectedItem).Availability = true;

                        ((Media)testdatagrid.SelectedItem).libraryMembers = "";
                        UpdateTestDataGrid();
                        MessageBox.Show(libraryMember.Name + " has returned the " + media.Mediatype, "Pop Up");
                    }
                    else
                    {
                        MessageBox.Show(((LibraryMember)memebrs.SelectedItem).Name + " haven't lent this media");
                    }
                }
                else
                {
                    MessageBox.Show("Media is Available");
                }
            }
            else
            {
                MessageBox.Show("Invalid Action");
            }
        }
示例#2
0
        private void LendMediaButton_Click(object sender, RoutedEventArgs e)
        {
            if (testdatagrid.SelectedItem != null && memebrs.SelectedItem != null)
            {
                if (((Media)testdatagrid.SelectedItem).Availability)
                {
                    ((Media)testdatagrid.SelectedItem).libraryMembers = ((LibraryMember)memebrs.SelectedItem).Name;
                    LibraryMember libraryMember = (LibraryMember)memebrs.SelectedItem;
                    Media         media         = (Media)testdatagrid.SelectedItem;
                    ((Media)testdatagrid.SelectedItem).Availability = false;

                    LibraryMember.CurrentlyBorrowed.Add(media);
                    UpdateTestDataGrid();
                    MessageBox.Show(libraryMember.Name + " has lent the " + media.Mediatype, "Pop Up");
                }
                else
                {
                    MessageBox.Show("Sorry! Media is Unavailable");
                }
            }
            else
            {
                MessageBox.Show("Please select the Name first and then Media");
            }
        }
 private void lendMedia_Click(object sender, RoutedEventArgs e)
 {
     if (libraryList.SelectedItem != null && membersName.SelectedItem != null)
     {
         media = (Media)libraryList.SelectedItem;
         if (media.isAvailable)
         {
             LibraryMember member = (LibraryMember)membersName.SelectedItem;
             media.isAvailable            = false;
             media.currentBorrowingMember = member.name;
             RefreshListings();
             MessageBox.Show(member.name + " is borrowing the media");
             media = null;
             libraryList.SelectedItem = null;
             membersName.SelectedItem = null;
         }
         else
         {
             MessageBox.Show("Selected media is not available");
         }
     }
     else
     {
         MessageBox.Show("Please select both member and a media to borrow");
     }
 }
示例#4
0
 public ModifyMember(object previousContent, LibraryMember memberName)
 {
     InitializeComponent();
     this.previousContent = previousContent;
     this.memberName      = memberName;
     name.Text            = memberName.name;
 }
        private void modifyMember_Click(object sender, RoutedEventArgs e)
        {
            object        currentContent = this.Content;
            LibraryMember memberName     = (LibraryMember)membersName.SelectedItem;

            if (memberName != null)
            {
                ModifyMember modifiedMember = new ModifyMember(currentContent, memberName);
                this.Content             = modifiedMember;
                membersName.SelectedItem = null;
            }
            else
            {
                MessageBox.Show("Please select member to modify");
            }
        }