Exemple #1
0
 public FrmAddPrisoner(IController con, AssignmentRepository repo1, PrisonerRepository repo2)
 {
     controller = con;
     assignRepo = repo1;
     prisonerRepo = repo2;
     InitializeComponent();
 }
 public FrmChangeAssignment(IController con, PrisonerRepository repo1, AssignmentRepository repo2, int idPris)
 {
     idPrisoner = idPris;
     controller = con;
     prisonerRepo = repo1;
     assignmentRepo = repo2;
     InitializeComponent();
 }
        public static PrisonerRepository GetInstance()
        {
            if (instance == null)
            {
                instance = new PrisonerRepository();
            }

            return instance;
        }
Exemple #4
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            if (comboBoxAvaCells.SelectedItem == null)
            {
                MessageBox.Show("You didn't select a cell.");
            } else
            {
                PrisonerRepository prisonerRepo = new PrisonerRepository();
                Prisoner prisoner = prisonerRepo.GetPrisonerByIndex(idPrisoner);
                prisoner.PrisonerCell = cell;

                cellRepo.UpdateCellPop(cell.Id, 1);
                try
                {
                    prisonerRepo.Update(idPrisoner, prisoner);
                    MessageBox.Show("Prisoner successfully added.");
                }
                catch
                {
                    MessageBox.Show("Error while adding prisoner to database.");
                }
                this.Close();
            }
        }
 public FrmPrisonerManager(IController con, PrisonerRepository repo)
 {
     controller = con;
     prisonerRepo = repo;
     InitializeComponent();
 }