private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IFormatter     loader = new BinaryFormatter();
            OpenFileDialog dialog = new OpenFileDialog()
            {
                FileName = "DB.bin",
                Filter   = "База данных (*.bin)|*.bin|Все файлы (*.*)|*.*"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Stream stream = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read, FileShare.None);
                jailed = (Prison)loader.Deserialize(stream);
                stream.Close();
                Search();
            }
        }
Example #2
0
        //констркутор формы для добавления заключенного
        public Add_Form(int index, Prison jailed)
        {
            InitializeComponent();
            this.jailed  = jailed;
            this.forEdit = true;
            this.index   = index;
            Prisoner prisoner = jailed[index];

            First_Name.Text  = prisoner.First_Name;
            Second_Name.Text = prisoner.Second_Name;
            Room.Text        = Convert.ToString(prisoner.Room);
            Criminality.Text = prisoner.Criminality;
            Day.Text         = Convert.ToString(prisoner.DateOfJailed.Day);
            Month.Text       = Convert.ToString(prisoner.DateOfJailed.Month);
            Year.Text        = Convert.ToString(prisoner.DateOfJailed.Year);
            PITPH.Text       = prisoner.PITPH;
            Relatives.Text   = prisoner.Relatives;
            Temper.Text      = prisoner.Temper;
        }
Example #3
0
 //конструктор формы для добавления заключенных
 public Add_Form(Prison jailed)
 {
     InitializeComponent();
     this.jailed  = jailed;
     this.forEdit = false;
 }