/// <summary>
        /// Initializes a new instance of the EmployeeRepository class.
        /// </summary>
        /// <param name="context">Context to retrieve data from</param>
        public EmployeeRepository(IEmployeeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.objectSet = context.Employees;
        }
Exemple #2
0
        /// <summary>
        /// 启动时启动输入窗体
        /// </summary>
        /// <param name="e">startup 事件的参数</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (this.useFakes)
            {
                this.context =  Generation.BuildFakeSession();
            }
            else
            {
                //注意: 如果 .\SQLEXPRESS 中没有 Microsoft SQL Server Express 实例,
                //      您将需要更新 App.config 中的“EmployeeEntities”连接字符串
                this.context = new EmployeeEntities();
            }

            IDepartmentRepository departmentRepository = new DepartmentRepository(this.context);
            IEmployeeRepository employeeRepository = new EmployeeRepository(this.context);
            IUnitOfWork unit = new UnitOfWork(this.context);

            MainViewModel main = new MainViewModel(unit, departmentRepository, employeeRepository);
            MainView window = new View.MainView { DataContext = main };
            window.Show();
        }
Exemple #3
0
        /// <summary>
        /// Lauches the entry form on startup
        /// </summary>
        /// <param name="e">Arguments of the startup event</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (this.useFakes)
            {
                this.context =  Generation.BuildFakeSession();
            }
            else
            {
                //NOTE: If there is not a Microsoft SQL Server Express instance available at .\SQLEXPRESS
                //      you will need to update the "EmployeeEntities" connection string in App.config
                this.context = new EmployeeEntities();
            }

            IDepartmentRepository departmentRepository = new DepartmentRepository(this.context);
            IEmployeeRepository employeeRepository = new EmployeeRepository(this.context);
            IUnitOfWork unit = new UnitOfWork(this.context);

            MainViewModel main = new MainViewModel(unit, departmentRepository, employeeRepository);
            MainView window = new View.MainView { DataContext = main };
            window.Show();
        }
 public CompensationRepository(ILogger <ICompensationRepository> logger, IEmployeeContext compensationContext)
 {
     _compensationContext = compensationContext;
     _logger = logger;
 }
Exemple #5
0
 public TaskRepository(IEmployeeContext employeeContext)
 {
     _employeeContext = employeeContext;
 }
Exemple #6
0
 public PositionRepository(IEmployeeContext context, IMapper mapper)
 {
     this._context = context as EmployeeContext;
     this._mapper  = mapper;
 }
        public void CreateContext()
        {
            IEmployeeContext context = InitialTest.SeedDatabaseFourEmployees();

            _iRepo = repo;
        }
Exemple #8
0
 public EmployeeService(IEmployeeContext cntx, IMapper mapper)
 {
     _cntx   = cntx ?? throw new ArgumentNullException(nameof(cntx));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Exemple #9
0
 public PersonRepository(IEmployeeContext context)
     : base(context)
 {
 }
        //public Repository()
        //{
        //    this.context = new EmployeeContext();
        //}

        public Repository(IEmployeeContext context)
        {
            this.context = context;
        }
 public EmployeeLogic(IEmployeeContext Context)
 {
     this.EmployeeContext = Context;
 }
Exemple #12
0
 public IndexModel(IEmployeeContext employeeContext)
 {
     _employeeContext = employeeContext;
 }
Exemple #13
0
 public DepartmentController(IEmployeeContext context)
 {
     this.db = context;
 }
Exemple #14
0
 public DepartmentController()
 {
     this.db = new EmployeeContext();
 }
 public EmployeeLogic(IEmployeeContext context)
 {
     Repository = new EmployeeRepository(context);
 }
Exemple #16
0
 public EmployeeRepository(IEmployeeContext employeeContext)
 {
     this.context = employeeContext;
 }
 public EmployeeRepository(IEmployeeContext context)
 {
     this.context = context;
 }
 public EmployeeRepository(IEmployeeContext context)
 {
     _context = context;
 }
Exemple #19
0
 public EmployeeService(IEmployeeContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
 public TeamRespository(IEmployeeContext context)
 {
     this.context = context;
 }
 public EmployeesController(IEmployeeContext context)
 {
     this.context = context;
 }
 public DepartmentRepository(IEmployeeContext context)
     : base(context)
 {
 }
 /// <summary>
 /// this is for testing purpose, we can remove this when we implement IOC framework like Unit framework
 /// </summary>
 internal EmployeeRepository(IEmployeeContext context)
 {
     _context = context;
 }
 public EmployeesController()
 {
     this.context = new EmployeeContext();
 }
Exemple #25
0
 public EmployeeService(IEmployeeContext context)
 {
     this.context = context;
 }
 public IocIndexModel(IEmployeeContext employeeContext, IHttpContextAccessor httpContextAccessor)
 {
     _employeeContext = employeeContext;
     //必须引用Microsoft.Extensions.DependencyInjection,这种方法一般不推荐
     _reflectionDemo = httpContextAccessor.HttpContext.RequestServices.GetService <IReflectionDemo>();
 }
 public EmployeeRepository()
 {
     Empctx = new SQLConnect();
 }
Exemple #28
0
 public PositionRepository(IEmployeeContext context)
 {
     this._context = context as EmployeeContext;
     this._mapper  = (IMapper)IoCHelper.GetResolveService(typeof(IMapper));
 }
 public EmployeesController(IEmployeeContext employeeContext)
 {
     _employeeContext = employeeContext;
 }
Exemple #30
0
 public EmployeeReadOnlyRepository(IEmployeeContext context)
     : base(context)
 {
 }
Exemple #31
0
 public PaycheckHandler(IPaycheckService paycheckService, IEmployeeContext employeeContext, IEmployeeValidator employeeValidator)
 {
     _paycheckService   = paycheckService;
     _employeeContext   = employeeContext;
     _employeeValidator = employeeValidator;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="employeeContext">The injected employee context</param>
 public EmployeeRepository(IEmployeeContext employeeContext)
 {
     _employeeContext = employeeContext ?? throw new ArgumentNullException(nameof(employeeContext));
 }
 public EmployeeViewModel(IEmployeeContext context)
 {
     this.context = context;
     Employees    = new ObservableCollection <Employee>();
 }
Exemple #34
0
 public EmployeeAPIController(IEmployeeContext employeeContext)
 {
     this._employeeContext = employeeContext;
 }
 public EmployeeController(IEmployeeContext context, IPaycheckHandler handler)
 {
     _context = context;
     _handler = handler;
 }