예제 #1
0
 public HomeController(ILogger <HomeController> logger, IUserService userService, ICompanyService companyService, ICompanyUserService companyuserService)
 {
     _logger                   = logger;
     this._IUserService        = userService;
     this._ICompanyService     = companyService;
     this._ICompanyUserService = companyuserService;
 }
예제 #2
0
 public StationController(IStationService stationService, IStationGroupService stationGroupService, ICompanyUserService companyUserService, IStationUserService stationUserService)
 {
     this.stationService      = stationService;
     this.stationGroupService = stationGroupService;
     this.companyUserService  = companyUserService;
     this.stationUserService  = stationUserService;
 }
예제 #3
0
 public CompanyController(INotifier notifier,
                          IMapper mapper,
                          ICompanyService companyService,
                          ICompanyUserService appUser) : base(appUser, notifier)
 {
     _mapper         = mapper;
     _companyService = companyService;
 }
예제 #4
0
 public ExpenseReportDetailController(INotifier notifier,
                                      IMapper mapper,
                                      IExpenseReportDetailRepository expenseReportDetailRepository,
                                      IExpenseReportDetailService expenseReportDetailService,
                                      IImageFileService imageFileService,
                                      IConfiguration configuration,
                                      ICompanyUserService appUser) : base(appUser, notifier)
 {
     _mapper = mapper;
     _expenseReportDetailRepository = expenseReportDetailRepository;
     _expenseReportDetailService    = expenseReportDetailService;
     _imageFileService = imageFileService;
     _configuration    = configuration;
 }
예제 #5
0
 public AuthController(INotifier notifier,
                       SignInManager <CompanyUser> signInManager,
                       UserManager <CompanyUser> userManager,
                       IOptions <AppSettings> appSettings,
                       ICompanyUserService appUser,
                       IMediatorHandler mediatorHandler,
                       IEmailSender emailSender,
                       ISendEndpointProvider bus) : base(appUser, notifier)
 {
     _signInManager   = signInManager;
     _userManager     = userManager;
     _appSettings     = appSettings.Value;
     _mediatorHandler = mediatorHandler;
     _emailSender     = emailSender;
     _bus             = bus;
 }
 public ExpenseReportController(INotifier notifier,
                                IMapper mapper,
                                IExpenseReportRepository expenseRepository,
                                IExpenseReportService expenseService,
                                IImageFileService imageFileService,
                                IConfiguration configuration,
                                ICompanyUserService appUser,
                                IAuthorizationService authorizationService) : base(appUser, notifier)
 {
     _mapper = mapper;
     _expenseReportRepository = expenseRepository;
     _expenseReportService    = expenseService;
     _imageFileService        = imageFileService;
     _configuration           = configuration;
     _authorizationService    = authorizationService;
 }
예제 #7
0
        public UserList()
        {
            // Get required services
            this.userService     = DependencyResolver.Kernel.Get <IUserService>();
            this.companyService  = DependencyResolver.Kernel.Get <ICompanyService>();
            this.compUserService = DependencyResolver.Kernel.Get <ICompanyUserService>();

            // Initialize form components
            InitializeComponent();

            this.DataContext = this;


            Thread displayThread = new Thread(() => SyncData());

            displayThread.IsBackground = true;
            displayThread.Start();
        }
예제 #8
0
 public CompanyUserController(SignInManager <CustomIdentityUser> signInManager,
                              UserManager <CustomIdentityUser> userManager,
                              IUnitOfWork unitOfWork,
                              ICompanyUserService companyUserService,
                              ICompanyService companyService,
                              IHttpContextAccessor httpContextAccessor,
                              ICompanyUserRoleMappingService companyUserRoleMappingService,
                              IApplicationUserService applicationUserService,
                              ICompanyAgentMappingService companyAgentMappingService)
 {
     this.signInManager                 = signInManager;
     this.userManager                   = userManager;
     this.unitOfWork                    = unitOfWork;
     this.companyUserService            = companyUserService;
     this.companyService                = companyService;
     this.httpContextAccessor           = httpContextAccessor;
     this.companyUserRoleMappingService = companyUserRoleMappingService;
     this.applicationUserService        = applicationUserService;
     this.companyAgentMappingService    = companyAgentMappingService;
 }
예제 #9
0
 public DemandController(IUnitOfWork unitOfWork,
                         IDemandService demandService,
                         SignInManager <CustomIdentityUser> signInManager,
                         UserManager <CustomIdentityUser> userManager,
                         IOrderOfUrgencyService urgencyService,
                         IApplicationUserService applicationUserService,
                         IHttpContextAccessor httpContextAccessor,
                         ICompanyUserService companyUserService,
                         ICompanyAgentMappingService companyAgentMappingService,
                         ICompanyService companyService)
 {
     this.signInManager              = signInManager;
     this.userManager                = userManager;
     this.unitOfWork                 = unitOfWork;
     this.demandService              = demandService;
     this.urgencyService             = urgencyService;
     this.applicationUserService     = applicationUserService;
     this.httpContextAccessor        = httpContextAccessor;
     this.companyUserService         = companyUserService;
     this.companyAgentMappingService = companyAgentMappingService;
     this.companyService             = companyService;
 }
예제 #10
0
        public LoginWindow()
        {
            companyService        = DependencyResolver.Kernel.Get <ICompanyService>();
            authenticationService = DependencyResolver.Kernel.Get <IAuthenticationService>();
            userService           = DependencyResolver.Kernel.Get <IUserService>();
            compUserService       = DependencyResolver.Kernel.Get <ICompanyUserService>();

            InitializeComponent();

            this.DataContext = this;

            notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: Application.Current.MainWindow,
                    corner: Corner.TopRight,
                    offsetX: 10,
                    offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(3));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            SQLiteInitializer.Initalize(false);

            new CompanySQLiteRepository().Sync(companyService);
            new UserSQLiteRepository().Sync(userService);
            new CompanyUserSQLiteRepository().Sync(compUserService);

            // Set company combobox
            List <CompanyViewModel> companiesFromDb = new List <CompanyViewModel>();

            try
            {
                companiesFromDb.Add(new CompanyViewModel()
                {
                    CompanyName = "Odaberite firmu", CompanyCode = "0"
                });
                CompanyListResponse response = companyService.GetCompanies();
                if (response.Success && response.Companies != null && response.Companies.Count > 0)
                {
                    companiesFromDb.AddRange(response.Companies.OrderBy(x => x.CompanyName));
                }
            }
            catch (Exception ex)
            {
                CompanyListResponse response = new CompanySQLiteRepository().GetCompanies(null);//companyService.GetCompanies();
                if (response.Success && response.Companies != null && response.Companies.Count > 0)
                {
                    companiesFromDb.AddRange(response.Companies.OrderBy(x => x.CompanyName));
                }
            }

            CompaniesFromDB = new ObservableCollection <CompanyViewModel>(companiesFromDb ?? new List <CompanyViewModel>());
            CurrentCompany  = CompaniesFromDB.FirstOrDefault();
            // Set focus
            txtUsername.Focus();

            InitializeUpdater();
        }
예제 #11
0
 public MainController(ICompanyUserService appUser,
                       INotifier notifier)
 {
     AppUser   = appUser;
     _notifier = notifier;
 }
 public CompanyUserController(ICompanyUserService companyService)
 {
     this._companyUserService = companyService;
 }
예제 #13
0
 public CompanyUserController(IServiceProvider provider)
 {
     userService = provider.GetRequiredService <ICompanyUserService>();
 }
 public CompanyController(ICompanyUserService companyUserService)
 {
     _companyUserService = companyUserService;
 }
예제 #15
0
        public void Sync(ICompanyUserService userService, Action <int, int> callback = null)
        {
            try
            {
                SyncCompanyUserRequest request = new SyncCompanyUserRequest();
                request.LastUpdatedAt = GetLastUpdatedAt();

                int toSync      = 0;
                int syncedItems = 0;

                CompanyUserListResponse response = userService.Sync(request);
                if (response.Success)
                {
                    toSync = response?.CompanyUsers?.Count ?? 0;
                    List <CompanyUserViewModel> companyUsersFromDB = response.CompanyUsers;

                    using (SqliteConnection db = new SqliteConnection(SQLiteHelper.SqLiteTableName))
                    {
                        db.Open();
                        using (var transaction = db.BeginTransaction())
                        {
                            SqliteCommand deleteCommand = db.CreateCommand();
                            deleteCommand.CommandText = "DELETE FROM CompanyUsers WHERE Identifier = @Identifier";

                            SqliteCommand insertCommand = db.CreateCommand();
                            insertCommand.CommandText = SqlCommandInsertPart;

                            foreach (var companyUser in companyUsersFromDB)
                            {
                                deleteCommand.Parameters.AddWithValue("@Identifier", companyUser.Identifier);
                                deleteCommand.ExecuteNonQuery();
                                deleteCommand.Parameters.Clear();

                                if (companyUser.IsActive)
                                {
                                    companyUser.IsSynced = true;

                                    insertCommand = AddCreateParameters(insertCommand, companyUser);
                                    insertCommand.ExecuteNonQuery();
                                    insertCommand.Parameters.Clear();

                                    syncedItems++;
                                    callback?.Invoke(syncedItems, toSync);
                                }
                            }

                            transaction.Commit();
                        }
                        db.Close();
                    }
                }
                else
                {
                    throw new Exception(response.Message);
                }
            }
            catch (Exception ex)
            {
                MainWindow.ErrorMessage = ex.Message;
            }
        }
예제 #16
0
 public ExpenseAuthorizationHandler(ICompanyUserService companyUserService)
 {
     _companyUserService = companyUserService;
 }
예제 #17
0
 public TestController(INotifier notifier, IConfiguration configuration,
                       ICompanyUserService appUser) : base(appUser, notifier)
 {
     MyProperty = configuration.GetConnectionString("DefaultConnection");
 }