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

            return instance;
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 5
0
 public FrmPrisonerManager(IController con, PrisonerRepository repo)
 {
     controller = con;
     prisonerRepo = repo;
     InitializeComponent();
 }