コード例 #1
0
 public CompanyController(ApplicationUserManager applicationUserManager,
                          IUserCompanyService userCompanyService,
                          IAddressService addressService)
 {
     _userCompanyService     = userCompanyService;
     _addressService         = addressService;
     _applicationUserManager = applicationUserManager;
 }
コード例 #2
0
 public AdministrationController(ApplicationUserManager applicationUserManager,
                                 IUserCompanyService userCompanyService,
                                 IEmployeeService employeeService)
 {
     _applicationUserManager = applicationUserManager;
     _userCompanyService     = userCompanyService;
     _employeeService        = employeeService;
 }
コード例 #3
0
        /// <summary>
        /// Constructor to inject Country Service
        /// </summary>
        /// <param name="CountryService">Country Service Instance</param>

        public AccountController(ICountryService countryService, ISettingService settingService, IBranchService branchService, IFinancialYearService financialYearService, ICompanyService companyService, IUserCompanyService userCompanyService)
        {
            _countryService       = countryService;
            _branchService        = branchService;
            _settingService       = settingService;
            _financialYearService = financialYearService;
            _companyService       = companyService;
            _userCompanyService   = userCompanyService;
        }
コード例 #4
0
ファイル: CompanyController.cs プロジェクト: olehspidey/B2B
 public CompanyController(IMapper mapper,
                          IUserCompanyService userCompanyService,
                          UserManager <User> userManager,
                          IKeyWordService keyWordService)
 {
     _mapper             = mapper;
     _userCompanyService = userCompanyService;
     _userManager        = userManager;
     _keyWordService     = keyWordService;
 }
コード例 #5
0
 public CalendarController(ILeaveService leaveService,
                           IOSHTrainingService oshTrainingService,
                           IMedicalReportService medicalReportService,
                           ICustomEventService customEventService,
                           IUserCompanyService companyService)
 {
     _leaveService         = leaveService;
     _medicalReportService = medicalReportService;
     _oshTrainingService   = oshTrainingService;
     _customEventService   = customEventService;
     _companyService       = companyService;
 }
コード例 #6
0
ファイル: ManageController.cs プロジェクト: EwiPraca/ewipraca
 public ManageController(ApplicationUserManager applicationUserManager,
                         IUserCompanyService userCompanyService,
                         ISettingService settingService,
                         IUserFileService userFileService,
                         ISharedLinkService sharedFileService,
                         AddressService addressService)
 {
     _applicationUserManager = applicationUserManager;
     _userCompanyService     = userCompanyService;
     _settingService         = settingService;
     _addressService         = addressService;
     _userFileService        = userFileService;
     _sharedFileService      = sharedFileService;
 }
コード例 #7
0
 public EmployeeController(IEmployeeService employeeService,
                           IUserCompanyService userCompanyService,
                           IAddressService addressService,
                           IEwiImporter companyEmployeeImporter,
                           IEwiExporter companyEmployeeExporter,
                           IImportEmployeeProcessor employeeProcessor,
                           IPositionDictionaryService positionDictionaryService,
                           ApplicationUserManager userManager,
                           IJobPartDictionaryService jobPartDictionaryService,
                           IEwiFileService fileService)
 {
     _employeeService           = employeeService;
     _userCompanyService        = userCompanyService;
     _addressService            = addressService;
     _companyEmployeeImporter   = companyEmployeeImporter;
     _companyEmployeeExporter   = companyEmployeeExporter;
     _employeeProcessor         = employeeProcessor;
     _positionDictionaryService = positionDictionaryService;
     _jobPartDictionaryService  = jobPartDictionaryService;
     _userManager = userManager;
     _fileService = fileService;
 }
コード例 #8
0
 public SecondController(IUserMenuService userMenuService, IUserCompanyService userCompanyService, ISearch search)
 {
     _iUserMenuService   = userMenuService;
     _userCompanyService = userCompanyService;
     _search             = search;
 }
コード例 #9
0
        public static void Show()
        {
            {
                //using (JDDbContext dbContext = new JDDbContext())
                //{
                //    //既然分层封装,就不再跨层访问
                //    User user = dbContext.Users.Find(1);
                //}

                //{
                //    //1 通过Service来完成对数据库的访问
                //    IUserService iUserService = new UserService();
                //    iUserService.Add();
                //}
            }

            {
                //2 访问Company  访问Commodity
                //每个service都提供增删改查基本方法? 来个父类继承一下
                //接口也继承一下
                //然后把常规API放入接口和实现
            }

            {
                //Base接口的定义解析
                //Join晚点再说
            }

            {
                //DbContext dbContext = new JDDbContext();
                //using (IUserService iUserService = new UserService(dbContext))
                //{
                //    User user = iUserService.Find<User>(123);
                //    //....
                //}
                //using (ICompanyService iCompanyService = new CompanyService(new JDDbContext()))
                //{
                //    Company company = iCompanyService.Find<Company>(123);
                //    //....
                //}
                ////1 每张表都来一个Service?
                ////需要join怎么办? 还有一个操作删除公司+用户   更新公司+用户
                ////这是业务逻辑,不应该在上端写的,应该在service
                //using (IUserService iUserService = new UserService(new JDDbContext()))
                //using (ICompanyService iCompanyService = new CompanyService(new JDDbContext()))
                //{
                //    var result = from u in iUserService.Set<User>()
                //                 join c in iCompanyService.Set<Company>() on u.CompanyId equals c.Id
                //                 where u.Id > 100
                //                 select u;//这是错的 不同的上下文

                //}
                ////2 单表单Service很多时候无法满足业务的需求,业务经常是跨表的
                ////所以在封装Service时,需要划分边界,完成组合。一个Service完成一个有机整体的全部操作
                //using (IUserCompanyService iUserCompanyService = new UserCompanyService(new JDDbContext()))
                //{
                //    User user = iUserCompanyService.Find<User>(123);
                //    Company company = iUserCompanyService.Find<Company>(123);

                //    iUserCompanyService.UpdateLastLogin(user);
                //    iUserCompanyService.RemoveCompanyAndUser(company);
                //}
                ////难就难在怎么划分边界?!  根据项目的实际情况,
                ////1 主外键关系一般在一个Service
                ////2 Mapping式一般也可以放在一起
                ////3 单表单Service不算错比如日志
                ////频繁互动的  可以考虑合并一下

                ////上端难免还是要多个Service(多个context)共同操作,不要Join!事务UnitOfWork---TranscationScope
                //UnitOfWork.Invoke(() =>
                //{
                //    using (IUserCompanyService iUserCompanyService = new UserCompanyService(new JDDbContext()))
                //    {
                //        //增删改
                //    }
                //});
            }

            {
                //IOC:去掉细节依赖,降低耦合,增强扩展性
                //ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                //fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "CfgFiles\\Unity.Config");//找配置文件的路径
                //Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
                //UnityConfigurationSection section = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName);
                //IUnityContainer container = new UnityContainer();
                //section.Configure(container, "ruanmouContainer");

                IUnityContainer container = ContainerFactory.GetContainer();
                using (IUserCompanyService iUserCompanyService = container.Resolve <IUserCompanyService>())
                {
                    User    user    = iUserCompanyService.Find <User>(12);
                    Company company = iUserCompanyService.Find <Company>(23);
                }
            }
        }
コード例 #10
0
 public UsersCompanyController(IUserCompanyService service)
 {
     UserCompanyService = service;
 }
コード例 #11
0
 public CompanyFacade(IUnitOfWorkProvider unitOfWorkProvider, ICompanyService companyService, IUserCompanyService userService) : base(unitOfWorkProvider)
 {
     this.companyService = companyService;
     this.userService    = userService;
 }