private void buttonRent_Click(object sender, EventArgs e) { FormListDisk formListDisk = new FormListDisk(Program.catalog); formListDisk.person = person; formListDisk.count = Program.list_person.GetPerson(textBoxName.Text, textBoxSurname.Text).Count; if (formListDisk.ShowDialog() == DialogResult.OK) { Program.list_person.ChangeInf(textBoxName.Text, textBoxSurname.Text, formListDisk.person); Program.list_person.GetPerson(textBoxName.Text, textBoxSurname.Text).Count = formListDisk.count; foreach (RentalDisk Rental in Program.list_person.GetPerson(textBoxName.Text, textBoxSurname.Text).disks) { List_Rental.Add_Disk(Rental); } foreach (Disk Rental in Program.list_person.GetPerson(textBoxName.Text, textBoxSurname.Text).diskWish) { wish.Add(Rental); } } SetTableData(); }
public bool Load1() { FileStream fs = new FileStream("Rental_list", FileMode.Open); BinaryFormatter formatter = new BinaryFormatter(); try { List_Rental listRental = (List_Rental)formatter.Deserialize(fs); list_rental = listRental.list_rental; } catch (SerializationException) { throw; } finally { fs.Close(); } return(true); }