public HealthcareProvidersController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <HealthcareProvidersController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #2
0
 public StandardServicesController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <StandardServicesController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #3
0
 public ShopifyEventsEmailer(IEmailer emailer, IDbSettingsReader settings, IPlansReader planHelper, ILogger <ShopifyEventsEmailer> logger)
 {
     _Emailer    = emailer;
     _Settings   = settings;
     _Logger     = logger;
     _PlanHelper = planHelper;
 }
Beispiel #4
0
 public ChildActivityCorrespondence(string templateType,
                                    string runtimeEnvironment,
                                    string correspondenceFilePath,
                                    IEmailer emailMgr = null)
     : base(templateType, cCorrespondence.enumTemplateDeliveryMedium.Email, cCorrespondence.enumTemplateContentType.HTML, runtimeEnvironment, correspondenceFilePath, emailMgr)
 {
 }
Beispiel #5
0
 public InsuranceProvidersController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <InsuranceProvidersController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
 public IPUsersController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <IPUsersController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthController"/> class.
 /// </summary>
 /// <param name="configuration">The application configuration.</param>
 /// <param name="memoryCache">The application memory cache.</param>
 /// <param name="emailer">The instance of <see cref="IEmailer"/> used to suppress or send emails.</param>
 public AuthController(IConfiguration configuration, IMemoryCache memoryCache, IEmailer emailer, IUserAccessor userAccessor)
 {
     Configuration = configuration;
     MemoryCache   = memoryCache;
     Emailer       = emailer;
     UserAccessor  = userAccessor;
 }
Beispiel #8
0
 public ReferAFriendService(ICustomerDirectory directory, IReferralPolicy policy,
     IEmailer emailer)
 {
     this.directory = directory;
     this.policy = policy;
     this.emailer = emailer;
 }
Beispiel #9
0
        //private IQueueClient _queueClient;

        public JokeData(CatalystDbContext context, IEmailer emailer, IJokeRecipientData recipientData)
        {
            _recipientData = recipientData;
            _emailer       = emailer;
            //_queueClient = queueClient;
            _context = context;
        }
Beispiel #10
0
 public Notifier(ITemplateManager templateManager, ITemplateSettings templateSettings, IEmailer emailer, IEmailAddressSettings emailAddressSettings)
 {
     this.templateManager = templateManager;
     this.templateSettings = templateSettings;
     this.emailer = emailer;
     this.emailAddressSettings = emailAddressSettings;
 }
Beispiel #11
0
 public RoomController(IClientRepo clientRepo, IRoomRepo roomRepo, IMapper mapper, IEmailer emailer)
 {
     _clientRepo = clientRepo;
     _roomRepo   = roomRepo;
     _mapper     = mapper;
     _emailer    = emailer;
 }
Beispiel #12
0
        public FDesktop(IEmailer emailer, ImageSaver imageSaver, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, AutoUpdaterUI autoUpdaterUI, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, PdfSaver pdfSaver, IErrorOutput errorOutput)
        {
            this.emailer                = emailer;
            this.imageSaver             = imageSaver;
            this.stringWrapper          = stringWrapper;
            this.appConfigManager       = appConfigManager;
            this.recoveryManager        = recoveryManager;
            this.scannedImageImporter   = scannedImageImporter;
            this.autoUpdaterUI          = autoUpdaterUI;
            this.ocrDependencyManager   = ocrDependencyManager;
            this.profileManager         = profileManager;
            this.scanPerformer          = scanPerformer;
            this.scannedImagePrinter    = scannedImagePrinter;
            this.changeTracker          = changeTracker;
            this.emailSettingsContainer = emailSettingsContainer;
            this.fileNamePlaceholders   = fileNamePlaceholders;
            this.imageSettingsContainer = imageSettingsContainer;
            this.pdfSettingsContainer   = pdfSettingsContainer;
            this.pdfSaver               = pdfSaver;
            this.errorOutput            = errorOutput;
            InitializeComponent();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            Shown       += FDesktop_Shown;
            FormClosing += FDesktop_FormClosing;
            Closed      += FDesktop_Closed;
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            ILogger  logger = Factory.CreateLogger();
            IEmailer email  = Factory.CreateEmail();

            IPerson owner = Factory.CreatePerson();

            {
                owner.FirstName    = "Silviu";
                owner.LastName     = "Olariu";
                owner.EmailAddress = "*****@*****.**";
                owner.PhoneNumber  = "222-222";
            };

            IChore chore = Factory.CreateChore();

            {
                chore.ChoreName = "Take out the trash";
                chore.Owner     = owner;
            };

            chore.PerformedWork(3);
            chore.PerformedWork(1.5);
            chore.CompleteChore();

            Console.ReadLine();
        }
 public AccountController(IEmailComposer emailComposer, IEmailer emailer, IDiObjectMapper mapper, IApplicationLogService applicationLogService)
 {
     _emailComposer         = emailComposer;
     _emailer               = emailer;
     _mapper                = mapper;
     _applicationLogService = applicationLogService;
 }
Beispiel #15
0
 public ClaimDiagnosesController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <ClaimDiagnosesController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #16
0
 public MedicalPersonnelController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <MedicalPersonnelController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiExceptionFilter"/> class.
 /// </summary>
 /// <param name="logger">The application event logger.</param>
 /// <param name="emailer">The sender or suppressor of emails.</param>
 /// <param name="userAccessor">Accesses the current user info.</param>
 /// <param name="webHostEnvironment">The web hosting environment.</param>
 public ApiExceptionFilter(ILogger <ApiExceptionFilter> logger, IEmailer emailer, IUserAccessor userAccessor, IWebHostEnvironment webHostEnvironment)
 {
     Logger             = logger;
     Emailer            = emailer;
     UserAccessor       = userAccessor;
     WebHostEnvironment = webHostEnvironment;
 }
 public ProvincesController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <ProvincesController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #19
0
        public FDesktop(IEmailer emailer, ImageSaver imageSaver, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, AutoUpdaterUI autoUpdaterUI, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, PdfSaver pdfSaver, IErrorOutput errorOutput)
        {
            this.emailer = emailer;
            this.imageSaver = imageSaver;
            this.stringWrapper = stringWrapper;
            this.appConfigManager = appConfigManager;
            this.recoveryManager = recoveryManager;
            this.scannedImageImporter = scannedImageImporter;
            this.autoUpdaterUI = autoUpdaterUI;
            this.ocrDependencyManager = ocrDependencyManager;
            this.profileManager = profileManager;
            this.scanPerformer = scanPerformer;
            this.scannedImagePrinter = scannedImagePrinter;
            this.changeTracker = changeTracker;
            this.emailSettingsContainer = emailSettingsContainer;
            this.fileNamePlaceholders = fileNamePlaceholders;
            this.imageSettingsContainer = imageSettingsContainer;
            this.pdfSettingsContainer = pdfSettingsContainer;
            this.pdfSaver = pdfSaver;
            this.errorOutput = errorOutput;
            InitializeComponent();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            Shown += FDesktop_Shown;
            FormClosing += FDesktop_FormClosing;
            Closed += FDesktop_Closed;
        }
Beispiel #20
0
        public static Invoice Generate(GenerateInvoiceRequest request, IEmailer emailer)
        {
            var invoice = new Invoice();
            var now     = DateTime.Now;

            invoice.Id            = Guid.NewGuid();
            invoice.CreatedBy     = request.GeneratedBy;
            invoice.CreatedOn     = now;
            invoice.InvoiceNumber = request.InvoiceNumber;
            invoice.Customer      = request.Customer;
            invoice.PeriodFrom    = request.PeriodFrom.Value;
            invoice.PeriodTo      = request.PeriodTo.Value;
            invoice.InvoiceDate   = now;

            var relevantBookings = request
                                   .Customer
                                   .Bookings
                                   .Where(booking =>
                                          booking.EndDate >= request.PeriodFrom &&
                                          booking.EndDate <= request.PeriodTo)
                                   .ToList();

            invoice.Total = relevantBookings.Sum(booking => booking.Total);
            invoice.SendEmail(emailer);
            return(invoice);
        }
Beispiel #21
0
 public StudentsController(
     IStudentsRepository studentsRepository,
     IEmailer emailer)
 {
     this.studentsRepository = studentsRepository;
     _emailer = emailer;
 }
Beispiel #22
0
 public DistrictsController(IMapper mapper, IUnitOfWork unitOfWork, ILogger <DistrictsController> logger, IEmailer emailer)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _logger     = logger;
     _emailer    = emailer;
 }
Beispiel #23
0
        public void TravelNotificationService_Constructor_NullEmailer_Test()
        {
            IEmailer emailer = null;
            IEmailTemplatesRepository templatesRepository = new EmailTemplatesInFileRepository(new TextMerger());

            var service = new BaseNotificationService(emailer, templatesRepository);
        }
 public StudentsController(
     IStudentsRepository studentsRepository, 
     IEmailer emailer)
 {
     this.studentsRepository = studentsRepository;
     _emailer = emailer;
 }
 public ReferAFriendService(ICustomerDirectory directory, IReferralPolicy policy,
                            IEmailer emailer)
 {
     this.directory = directory;
     this.policy    = policy;
     this.emailer   = emailer;
 }
Beispiel #26
0
 public TrackingEmailer(IEmailer emailer, TraffkTenantModelDbContext rdb, ITraffkTenantFinder tenantFinder, ICommunicationBlastFinder blastFinder)
 {
     Inner        = emailer;
     Rdb          = rdb;
     TenantFinder = tenantFinder;
     BlastFinder  = blastFinder;
     TenantId     = tenantFinder.GetTenantIdAsync().ExecuteSynchronously();
 }
        //int i,j;

        public ScheduleController()
        {
            con         = new ConnectionClass();
            SMSObj      = new TwilioSMS();
            VoiceObj    = new TwilioVoice();
            WhatsappObj = new TwilioWhatsApp();
            EmailObj    = new Emailer();
        }
 public HomeController(IPostRepository postRepository, 
                       IEmailer messagingService,
                       IViewMapper viewMapper)
     : base(postRepository, viewMapper)
 {
     _viewMapper = viewMapper;
     MessagingService = messagingService;
 }
Beispiel #29
0
 public HomeController(IPostRepository postRepository,
                       IEmailer messagingService,
                       IViewMapper viewMapper)
     : base(postRepository, viewMapper)
 {
     _viewMapper      = viewMapper;
     MessagingService = messagingService;
 }
Beispiel #30
0
 public RegisterViewModelFactory(ILogger <RegisterViewModelFactory> logger, Db db, IEmailer emailer, LinkGenerator link, IHttpContextAccessor context)
 {
     _logger  = logger;
     _db      = db;
     _emailer = emailer;
     _link    = link;
     _context = context;
 }
Beispiel #31
0
 public SignupController(
     IEmailer emailer,
     IPassword password,
     IDatabase database)
 {
     _emailer = emailer;
     _password = password;
     _database = database;
 }
Beispiel #32
0
        public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IEmailer emailer)
        {
            
            UserManager = userManager;
            SignInManager = signInManager;
            this.emailer = emailer;


        }
        /// <summary>
        /// Creates a new instance of TravelNotificationService
        /// </summary>
        /// <param name="emailer">service that sends the emails</param>
        /// <param name="emailTemplatesRepository">templates repository</param>
        /// <param name="employeeRepository">employees repository</param>
        public TravelNotificationService(IEmailer emailer, IEmailTemplatesRepository emailTemplatesRepository, IEmployeeRepository employeeRepository) : base(emailer, emailTemplatesRepository)
        {
            if (employeeRepository == null)
            {
                throw new ArgumentNullException("employeeRepository");
            }

            _employeeRepository = employeeRepository;
        }
 public StudentsController(IStudentsRepository studentsRepository, IEducationsRepository  educationsRepository,
     ICompetencyHeadersRepository competencyHeadersRepository, IEmailer emailer, ICompetenciesRepository competenciesRepository)
 {
     this._studentsRepository = studentsRepository;
     this._educationsRepository = educationsRepository;
     this._competencyHeadersRepository = competencyHeadersRepository;
     this._emailer = emailer;
     this._competenciesRepository = competenciesRepository;
 }
 public InvoiceController(
     IGenerateViewModelMapper generateViewModelMapper,
     IInvoiceRepository invoiceRepository,
     IEmailer emailer)
 {
     _generateViewModelMapper = generateViewModelMapper;
     _invoiceRepository       = invoiceRepository;
     _emailer = emailer;
 }
        public UserController(IUnitOfWork unitOfWork, ICryptography cryptography,
                              ITokenProcessor tokenProcessor, TokenConfiguration tokenConfiguration, IRandomGenerator randomGenerator, IEmailer emailer) : base(unitOfWork)
        {
            _cryptography    = cryptography;
            _tokenProcessor  = tokenProcessor;
            _randomGenerator = randomGenerator;
            _emailer         = emailer;

            _tokenConfiguration = tokenConfiguration;
        }
Beispiel #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventController"/> class.
 /// </summary>
 /// <param name="logger">The application event logger.</param>
 /// <param name="eventService">The instance of <see cref="IEventService"/> used to create and update Events.</param>
 /// <param name="eventRepositoryWrite">The instance of <see cref="IRepositoryWrite{Event}"/> used for Event persistence write operations.</param>
 /// <param name="eventRepositoryRead">The instance of <see cref="IRepositoryRead{Event}"/> used for Event persistence read operations.</param>
 /// <param name="emailer">The emailer what sends the emails.</param>
 public EventController(ILogger <EventController> logger, IEventService eventService, IRepositoryWrite <Event> eventRepositoryWrite, IRepositoryRead <Event> eventRepositoryRead, IEmailer emailer, IMapper mapper, IUserAccessor userAccessor, IProvideDateTime dateTimeProvider)
 {
     Logger = logger;
     EventRepositoryWrite = eventRepositoryWrite;
     EventRepositoryRead  = eventRepositoryRead;
     EventService         = eventService;
     Emailer          = emailer;
     Mapper           = mapper;
     UserAccessor     = userAccessor;
     DateTimeProvider = dateTimeProvider;
 }
Beispiel #38
0
 public AdminController(
     IEmailer emailer,
     IPlanFactory planFactory,
     IPassword password,
     IProductFactory productFactory)
 {
     _emailer = emailer;
     _planFactory = planFactory;
     _password = password;
     _productFactory = productFactory;
 }
 public ForgotPasswordRequestedEventHandler(
     UserManager <ApplicationUser> userManager,
     IOptions <IdentityServerUserInteractionConfig> managementOptions,
     IEmailTemplate emailTemplate,
     IEmailer emailer)
 {
     _userManager        = userManager;
     _interactionOptions = managementOptions.Value;
     _emailTemplate      = emailTemplate;
     _emailer            = emailer;
 }
Beispiel #40
0
 public AutomatedScanning(AutomatedScanningOptions options, IProfileManager profileManager, IScanPerformer scanPerformer, IErrorOutput errorOutput, IEmailer emailer, IScannedImageImporter scannedImageImporter, IUserConfigManager userConfigManager, PdfSettingsContainer pdfSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, IOperationFactory operationFactory)
 {
     this.options = options;
     this.profileManager = profileManager;
     this.scanPerformer = scanPerformer;
     this.errorOutput = errorOutput;
     this.emailer = emailer;
     this.scannedImageImporter = scannedImageImporter;
     this.userConfigManager = userConfigManager;
     this.pdfSettingsContainer = pdfSettingsContainer;
     this.fileNamePlaceholders = fileNamePlaceholders;
     this.imageSettingsContainer = imageSettingsContainer;
     this.operationFactory = operationFactory;
 }
Beispiel #41
0
        public FDesktop(IEmailer emailer, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, StillImage stillImage, IOperationFactory operationFactory, IUserConfigManager userConfigManager, KeyboardShortcutManager ksm, ThumbnailRenderer thumbnailRenderer, DialogHelper dialogHelper)
        {
            this.emailer = emailer;
            this.stringWrapper = stringWrapper;
            this.appConfigManager = appConfigManager;
            this.recoveryManager = recoveryManager;
            this.scannedImageImporter = scannedImageImporter;
            this.ocrDependencyManager = ocrDependencyManager;
            this.profileManager = profileManager;
            this.scanPerformer = scanPerformer;
            this.scannedImagePrinter = scannedImagePrinter;
            this.changeTracker = changeTracker;
            this.emailSettingsContainer = emailSettingsContainer;
            this.fileNamePlaceholders = fileNamePlaceholders;
            this.imageSettingsContainer = imageSettingsContainer;
            this.pdfSettingsContainer = pdfSettingsContainer;
            this.stillImage = stillImage;
            this.operationFactory = operationFactory;
            this.userConfigManager = userConfigManager;
            this.ksm = ksm;
            this.thumbnailRenderer = thumbnailRenderer;
            this.dialogHelper = dialogHelper;
            InitializeComponent();

            Shown += FDesktop_Shown;
            FormClosing += FDesktop_FormClosing;
            Closed += FDesktop_Closed;
        }
		public RegistrationController(IAuthenticator authenticator, IRepository repository, IEmailer<RegistrationConfirmation> confirmationEmailer)
		{
			_authenticator = authenticator;
			_repository = repository;
			_confirmationEmailer = confirmationEmailer;
		}
Beispiel #43
0
 public HomeController(IDocumentStore store, IEmailer emailer)
     : base(store)
 {
     _emailer = emailer;
 }
Beispiel #44
0
        public void When_a_user_signs_up_with_a_referral_from_a_friend()
        {
            // test as much of the implementation as possible
            directory = new CustomerDirectory(new InMemoryDatabase());
            var policy = new ReferralPolicy();

            // cannot test emailing implementation - easier to stub
            emailer = MockRepository.GenerateStub<IEmailer>();

            service = new ReferAFriendService(directory, policy, emailer);

            service.ReferAFriend(referrerId, friendsDetails);
        }
 public HomeController(IEmailer emailer)
 {
     _emailer = emailer;
 }
Beispiel #46
0
 public MessageHandler(IEmailer emailer, ILogger logger)
 {
     this.emailer = emailer;
     this.logger = logger;
 }
 public ContactController(IDataRepository repository, IEmailer emailer)
     : base(repository)
 {
     _emailer = emailer;
     _email = PageConfigurations.Single().EmailAddress;
 }
Beispiel #48
0
 public AccountController(IEmailer emailer)
 {
     this.emailer = emailer;
 }
 // Injecting dependencies as constructor argumnets - Pure DI
 public ReportingService(ICustomerData customerData, IReportBuilder reportBuilder, IEmailer emailer)
 {
     CustomerData = customerData;
     ReportBuilder = reportBuilder;
     Emailer = emailer;
 }
        public CommonModule(IPdfTemplateHelper pdfTemplateHelper, IEmailer emailer,
            IPdfBarcodesGenerator pdfBarcodesGenerator) : base("/api")
		{
		    _pdfTemplateHelper = pdfTemplateHelper;
            _emailer = emailer;
            _pdfBarcodesGenerator = pdfBarcodesGenerator;
            //	BARCODE FUNCTIONS
			//	Returns a list of airports
			Get["/getAirports"] = _ =>
			{
				var airportList = CustomerSite.ToList().Where(x => x.IsAirport).ToList().OrderBy(x => x.Name);
				return Response.AsJson(airportList.ToList());
			};
			//	Returns a list of airports that have been formatted for a select input
			Get["/getAirportList"] = _ =>
			{
				var airports = CustomerSite.ToList().Where(x => x.IsAirport).ToList();
				List<SelectList> airportList = new List<SelectList>();

				foreach(var airport in airports)
				{
					airportList.Add(new SelectList(){
						id = airport.RecordID,
						text = airport.Name.Trim()
					});
				}

				return Response.AsJson(airportList.OrderBy(x => x.text).ToList());
			};
            
            //	Returns all available pdf templates
		    Get["/getPdfTemplates"] = _ => Response.AsJson(_pdfTemplateHelper.GetTemplates());

            //	Returna a list of Airlines
            Get["/getAirlines"] = _ =>
			{
				var airlineList = AirlineDBO.ToList().OrderBy(x => x.Name);
				return Response.AsJson(airlineList.ToList());
			};
			//	Returns a list of Airlines that have been formatted for a select input
			Get["/getAirlineList"] = _ =>
			{
				var airlines = AirlineDBO.ToList();
				List<SelectList> airlineList = new List<SelectList>();

				foreach(var airline in airlines)
				{
					airlineList.Add(new SelectList()
					{
						id = airline.RecordID,
						text = airline.Name.Trim()
					});
				}

				return Response.AsJson(airlineList.OrderBy(x => x.text).ToList());
			};
            //  Returns a list of barcodes
            Post["/getBarcodes/{type}"] = _ =>
            {
				BarcodeWhere where = this.Bind<BarcodeWhere>();
				DateTime start = new DateTime();
				DateTime end = new DateTime();
				bool validStart = DateTime.TryParse(where.StartDate, out start);
				bool validEnd = DateTime.TryParse(where.EndDate, out end);
				//	If no dates were provided, this gets all.
				if(!validStart && !validEnd)
				{
					var barcodeList = BarcodeCreation.ToListDTO();
					return Response.AsJson(barcodeList.OrderByDescending(x => x.CreatedDateTime).ToList());
				}
				//	If one of the dates isn't valid, this returns.
				else if(!validStart || !validEnd)
				{
					return HttpStatusCode.BadRequest;
				}
				//	Otherwise this returns the filtered results
				else
				{
					var barcodeList = BarcodeCreation.ToListDTO(start, end);
					return Response.AsJson(barcodeList.OrderByDescending(x => x.CreatedDateTime).ToList());
				}
            };
			//	Returns all the details of a barcode - BarcodeCreation, FastTrackBarcode, FastTrackBarcode.Actions
			Get["/getBarcode/{type}/{recordID}"] = _ =>
			{
				Guid recordID;
				bool validGuid = Guid.TryParse(_.recordID, out recordID);
				//	If an invalid Guid was provided, return bad request
				if (!validGuid)
				{
					return HttpStatusCode.BadRequest;
				}
				var barcode = BarcodeCreation.Load(recordID);
				return Response.AsJson(barcode);
			};
			//	Returns a list of barcode actions
			Get["/getBarcodeActions/{type}/{recordID}"] = _ =>
			{
				Guid recordGUID;
				bool validGuid = Guid.TryParse(_.recordID, out recordGUID);
				if (!validGuid)
				{
					return HttpStatusCode.BadRequest;
				}
				var fastTrackActions = FastTrackBarcode.Actions(recordGUID);
				return Response.AsJson(fastTrackActions);
			};
			//	For creating a barcode
			Post["/createBarcode/{type}/{format}"] = _ =>
			{
				string type = _.type;
				string format = _.format;
				//	If departure airport, copy to guid field and then replace with iata
			    IBarcodeGenerator barcodeGenerator = null;
			    FastTrackOptions barcodeOptions = new FastTrackOptions
			    {
			        Quantity = 1
			    };

                Guid temp = new Guid();
                //	Generate barcode
                switch (type)
				{
					case "fasttrack":
				        barcodeGenerator =
				            new AddbarcodeCreationRecordToDb(new SaveFastTrackBarcodeRecordToDb(new BarcodeGenerator()));

                        barcodeOptions = this.Bind<FastTrackOptions>();

                        //	If airline, copy to guid field and then replace with iata, unless it is ---
                        if (!string.IsNullOrWhiteSpace(barcodeOptions.Airline) && barcodeOptions.Airline.Trim() != "---")
						{
							if(Guid.TryParse(barcodeOptions.Airline, out temp))
							{
								Airline airline = Airline.Load(temp);
								//	If no airline was found, empty airline fields
								if(airline == null)
								{
									barcodeOptions.Airline = "---";
									barcodeOptions.AirlineGuid = null;
								}
								//	Otherwise update fields
								else
								{
									barcodeOptions.Airline = airline.AirlineIATA;
									barcodeOptions.AirlineGuid = temp;
								}
							}
						}
						//	If departure airport, copy to guid field and then replace with iata
						if (!string.IsNullOrWhiteSpace(barcodeOptions.DepartureAirport))
						{
							if(Guid.TryParse(barcodeOptions.DepartureAirport, out temp))
							{
								CustomerSite site = CustomerSite.Load(temp);
								//	If no airport was found, that means it doesn't exist, so empties departure fields
								if(site == null)
								{
									barcodeOptions.DepartureAirport = null;
									barcodeOptions.DepartureAirportGuid = null;
								}
								//	Otherwise update fields
								else
								{
									barcodeOptions.DepartureAirportGuid = temp;
									barcodeOptions.DepartureAirport = site.AirportIATADesignation;
								}
							}
						}
						//	If destination airport, copy to guid field and then replace with iata
						if (!string.IsNullOrWhiteSpace(barcodeOptions.DestinationAirport))
						{
							if (Guid.TryParse(barcodeOptions.DestinationAirport, out temp))
							{
								//	If the same as departure, just copy name
								if(barcodeOptions.DepartureAirport == barcodeOptions.DestinationAirport)
								{
									barcodeOptions.DestinationAirport = barcodeOptions.DepartureAirport;
									barcodeOptions.DestinationAirportGuid = barcodeOptions.DepartureAirportGuid;
								}
								//	Otherwise load airport details
								else
								{
									CustomerSite site = CustomerSite.Load(temp);
									//	If no airport was found, that means it doesn't exist, so empties departure fields
									if (site == null)
									{
										barcodeOptions.DestinationAirport = null;
										barcodeOptions.DestinationAirportGuid = null;
									}
									//	Otherwise update fields
									else
									{
										barcodeOptions.DestinationAirportGuid = temp;
										barcodeOptions.DestinationAirport = site.AirportIATADesignation;
									}
								}
							}
						}
						break;
					case "test":
                        barcodeGenerator = new TestBarcodeGenerator();
						break;
					default:
						return HttpStatusCode.BadRequest;
				}
				switch (format)
				{
					case "image":
						List<string> returnText = new List<string>();
                        IBarcodeFileGenerator imageGenerator = new BarcodeImageFileGenerator(barcodeGenerator);

                        for (var i = 0; i < barcodeOptions.Quantity; i++)
				        {
				            returnText.Add(Convert.ToBase64String(imageGenerator.GenerateFile(barcodeOptions).ToArray()));
				        }

						return Response.AsJson(returnText);
					//break;
					case "email":
				        var result = new EmailFastTrackBarcodes(_emailer).EmailBarcodeFile(barcodeOptions,
				            new BarcodePdfFileGenerator(barcodeGenerator, _pdfBarcodesGenerator));

				        return result ? HttpStatusCode.Accepted : HttpStatusCode.BadRequest;
					case "pdf":
				        var stream =
				            new BarcodePdfFileGenerator(barcodeGenerator, _pdfBarcodesGenerator).GenerateFile(barcodeOptions);
                        var streamClone = new MemoryStream(stream.ToArray());
                        Response response = new Response();
				        response.Headers.Add("Content-Disposition",
				            "attachment; filename=GeneratedBarcode" + DateTime.Now.ToString("dd MMM yyyy HH mm") + ".pdf");

						response.Headers.Add("responseType", "arraybuffer");
						response.Contents = responseStream =>
						{
                            streamClone.CopyTo(responseStream);
						};
						return response;
				}
				//	Return BadRequest if not returned already
				return HttpStatusCode.BadRequest;
			};
			//	Exports all the barcodes
			Post["/exportBarcodes/{type}"] = _ =>
			{
				List<string> barcodeGuids = this.BindTo(new List<string>());
				//	If no guids were posted, export all
				if (barcodeGuids.Count() == 0)
				{
					return CSVExporter.ExportBarcodes();
				}
				//	Otherwise export select few
				else
				{
					return CSVExporter.ExportBarcodes(barcodeGuids);
				}
			};
			//	logs the user in using sems data object
			Post["/login/{type}"] = _ =>
			{
				//bind to object model
				var loginParams = this.Bind<Login>();
				//decrypt username
				loginParams.Username = Decrypt.DecryptString(loginParams.Username, _.type + "key");
				//pass sems data obejct user method the username
				var user = User.LoadUser(loginParams.Username);
				//if no user, return 401
				if (user == null)
				{
					Console.WriteLine("No User");
					return HttpStatusCode.Unauthorized;
				}
				//decrypt password
				loginParams.Password = Decrypt.DecryptString(loginParams.Password, _.type + "key");
				//if incorrect password, return 401
				if (user.Password != loginParams.Password)
				{
					Console.WriteLine("Wrong Password");
					return HttpStatusCode.Unauthorized;
				}
				var token = user.RecordID;
				//login but dont redirect, this is handled front end by angular
				return this.LoginWithoutRedirect(token);
			};
			//	logs the user in using sems data object
			Post["/login"] = _ =>
            {
                //bind to object model
                var loginParams = this.Bind<Login>();
				//pass sems data obejct user method the username
				var user = MachSecure.SEMS.DataObjects.User.LoadUser(loginParams.Username);
                //if no user, return 401
                if (user == null)
				{
					Console.WriteLine("Wrong Username");
					return HttpStatusCode.Unauthorized;
				}
                //if incorrect password, return 401
                if (user.Password != loginParams.Password)
				{
					Console.WriteLine("Wrong Password");
					return HttpStatusCode.Unauthorized;
				}
				var token = user.RecordID;
                //login but dont redirect, this is handled front end by angular
                return this.LoginWithoutRedirect(token);
            };
			//	log the user out and redirect to home
            Get["/logout"] = _ => this.LogoutAndRedirect("../#/");
			//	Gets the current logged in user
            Get["/user"] = _ =>
            {
                var user = Context.CurrentUser;
                return Response.AsJson(user);
            };
			//	Tests connection
            Get["/test"] = _ =>
            {
                List<string> s = new List<string>();
				//SMTP.SendEmail("*****@*****.**", "Test Email", "This is a test e-mail");

				for (int i = 0; i < 1000000; i++)
                {
                    s.Add("test");
                }

                return Response.AsJson(s);
            };
		//	/BARCODE ACTIONS
		//	ROSTER IMPORT FUNCTIONS
			//	Returns contents of a csv file
			Post["/readCSV"] = _ =>
			{
				ReadCsvOptions options = this.Bind<ReadCsvOptions>();
				ReturnResult result = new ReturnResult();
				var files = Request.Files;
				//	If no file, return
				if(files.Count() == 0)
				{
					result.Success = false;
					result.Error = "No file found";
					result.ErrorDescription = "No CSV file was uploaded";
					result.Result = null;
					return Response.AsJson(result);
				}
				List<CsvObject> csvs = new List<CsvObject>();
				foreach (var file in files)
				{
					string extension = Path.GetExtension(file.Name);
					//	If not a csv file, return
					if(extension != ".csv")
					{
						result.Success = false;
						result.Error = "Invalid file";
						result.ErrorDescription = file.Name + " is not a csv file";
						result.Result = null;
						return Response.AsJson(result);
					}
					StreamReader csvReader = new StreamReader(file.Value);
					CsvObject csv = new CsvObject();
					List<string[]> rows = new List<string[]>();
					int index = 0;
					bool escape = false;
					while (!csvReader.EndOfStream && escape != true)
					{
						string line = csvReader.ReadLine();
						string[] values = line.Split(',');
						//	If headers, place into headers string[]
						if (index == 0)
						{
							csv.Headers = values;
						}
						else
						{
							rows.Add(values);
						}
						index++;
						//	If there is a limit, and this exceeds it, this sets escape to true
						if (options.Limit != null && options.Limit > 0 && index > options.Limit)
						{
							escape = true;
						}
					}
					csv.Rows = rows;
					csvs.Add(csv);
				}
				//	To get this far, it was successful, so it returns so
				result.Success = true;
				result.Error = null;
				result.ErrorDescription = null;
				result.Result = csvs;
				return Response.AsJson(result);
			};
		//	/ROSTER IMPORT FUNCTIONS
		}
 public UsersController(IUsersRepository usersRepository, ICompetencyHeadersRepository competencyHeadersRepository, IEmailer emailer)
 {
     this.usersRepository = usersRepository;
     this.competencyHeadersRepository = competencyHeadersRepository; 
     _emailer = emailer;
 }
 public EmailFastTrackBarcodes(IEmailer emailer)
 {
     _emailer = emailer;
 }
Beispiel #53
0
        public FDesktop(IEmailer emailer, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, AutoUpdaterUI autoUpdaterUI, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, StillImage stillImage, IOperationFactory operationFactory, IUserConfigManager userConfigManager, IScannedImageFactory scannedImageFactory)
        {
            this.emailer = emailer;
            this.stringWrapper = stringWrapper;
            this.appConfigManager = appConfigManager;
            this.recoveryManager = recoveryManager;
            this.scannedImageImporter = scannedImageImporter;
            this.autoUpdaterUI = autoUpdaterUI;
            this.ocrDependencyManager = ocrDependencyManager;
            this.profileManager = profileManager;
            this.scanPerformer = scanPerformer;
            this.scannedImagePrinter = scannedImagePrinter;
            this.changeTracker = changeTracker;
            this.emailSettingsContainer = emailSettingsContainer;
            this.fileNamePlaceholders = fileNamePlaceholders;
            this.imageSettingsContainer = imageSettingsContainer;
            this.pdfSettingsContainer = pdfSettingsContainer;
            this.stillImage = stillImage;
            this.operationFactory = operationFactory;
            this.userConfigManager = userConfigManager;
            this.scannedImageFactory = scannedImageFactory;
            InitializeComponent();

            Shown += FDesktop_Shown;
            FormClosing += FDesktop_FormClosing;
            Closed += FDesktop_Closed;
        }
 public AccountService(IUnitOfWork unitOfWork, IAuth auth, ICacheService cacheService, UserManager<User> userManager, IEmailer emailer)
     : base(unitOfWork, auth, cacheService)
 {
     UserManager = userManager;
     Emailer = emailer;
 }