Exemplo n.º 1
0
        private void UpdateGrids()
        {
            if (_context != null)
            {
                _context = new DumaContext(Resources.ConnectionString);
            }
            var unitOfWork        = new UnitOfWork(_context);
            var commissionService = new CommissionService(unitOfWork, unitOfWork);
            var membershipService = new MembershipService(unitOfWork, unitOfWork);
            var meetingService    = new MeetingService(unitOfWork, unitOfWork);

            dgvCommissions.DataSource = null;
            dgvMembers.DataSource     = null;
            dgvMeetings.DataSource    = null;

            var members     = membershipService.GetAllMembers();
            var commissions = commissionService.GetAllCommissions();
            var meetings    = meetingService.GetAllMeetings();

            dgvCommissions.DataSource = commissions;
            dgvMembers.DataSource     = members;
            dgvMeetings.DataSource    = meetings;

            unitOfWork.Commit();
        }
Exemplo n.º 2
0
        public Repository(DumaContext context)
            : base(context)
        {
            Guard.AgainstNullReference(context, "context");

            _entities = context.Set <TEntity>();
        }
Exemplo n.º 3
0
        public void ShouldCreateContext()
        {
            var context = new DumaContext("DumaTestConnection");
            var members = context.Members.ToList();

            context.Should().NotBeNull();
            context.Dispose();
        }
Exemplo n.º 4
0
        private void btnViewCommissions_ButtonClick(object sender, EventArgs e)
        {
            if (_context != null)
            {
                _context = new DumaContext(Resources.ConnectionString);
            }

            var unitOfWork        = new UnitOfWork(_context);
            var commissionService = new CommissionService(unitOfWork, unitOfWork);

            var commissions = commissionService.GetAllCommissions();

            dgvCommissions.DataSource = commissions;

            dgvMembers.Visible     = false;
            dgvCommissions.Visible = true;
            dgvMeetings.Visible    = false;

            unitOfWork.Commit();
        }
Exemplo n.º 5
0
        private void ViewAllEmployees(object sender, EventArgs e)
        {
            if (_context != null)
            {
                _context = new DumaContext(Resources.ConnectionString);
            }

            var unitOfWork    = new UnitOfWork(_context);
            var memberService = new MembershipService(unitOfWork, unitOfWork);

            var members = memberService.GetAllMembers();

            dgvMembers.DataSource = members;

            dgvMembers.Visible     = true;
            dgvCommissions.Visible = false;
            dgvMeetings.Visible    = false;

            unitOfWork.Commit();
        }
Exemplo n.º 6
0
        public void Do()
        {
            var context = new DumaContext("DumaTestConnection");

            context.Commissions.Add(new Commission {
                Name = "fw", PresidentId = 1, ProfileCommissionId = 1
            });

            try
            {
                context.SaveChanges();
            }
            catch (Exception)
            {
            }
            finally
            {
                context.Dispose();
            }
        }
Exemplo n.º 7
0
 public Repository(DumaContext context)
 {
     Context = context;
 }
Exemplo n.º 8
0
 public UnitOfWork(DumaContext context)
 {
     _context             = context;
     _transaction         = _context.Database.BeginTransaction();
     _isTransactionActive = true;
 }
Exemplo n.º 9
0
 protected Repository(DumaContext context)
 {
     Context = context;
 }