Esempio n. 1
0
 public LmsDashboardServiceTest()
 {
     _iDbService = Substitute.For<IDbService>();
     FakeDbService();
     _iLmsDashboardService=new LmsDashboardService();
     _iLmsDashboardService = new LmsDashboardService(_iDbService);
 }
Esempio n. 2
0
 public ChatBackup(CloudStorageAccount storageAccount)
 {
     var client = storageAccount.CreateCloudTableClient();
     _table = client.GetTableReference("Chat");
     _table.CreateIfNotExists();
     _iDbService = new DbService();
     _retryPolicy = _iDbService.GetRetryPolicy();
 }
Esempio n. 3
0
 public PostBackup(CloudStorageAccount storageAccount, string endpointUrl, string authorizationKey)
 {
     _iDbService = new DbService(endpointUrl,authorizationKey);
     CloudTableClient c = storageAccount.CreateCloudTableClient();
     _table = c.GetTableReference("Post");
     _table.CreateIfNotExists();
     _retryPolicy = _iDbService.GetRetryPolicy();
 }
Esempio n. 4
0
 public PostBackup(CloudStorageAccount storageAccount)
 {
     _iDbService = new DbService();
     CloudTableClient c = storageAccount.CreateCloudTableClient();
     _table = c.GetTableReference("Post");
     _table.CreateIfNotExists();
     _retryPolicy = RetryService.GetRetryPolicy();
 }
Esempio n. 5
0
 public Dichotomy(string endpointUrl, string authorizationKey)
 {
     _client = new DocumentClient(new Uri(endpointUrl), authorizationKey);
     _database =
         _client.CreateDatabaseQuery().Where(db => db.SelfLink == ConfigurationManager.AppSettings["DBSelfLink"])
             .AsEnumerable().FirstOrDefault();
     _iDbService = new DbService();
 }
Esempio n. 6
0
 public Dichotomy(string endpointUrl, string authorizationKey)
 {
     _client = new DocumentClient(new Uri(endpointUrl), authorizationKey);
     _database =
         _client.CreateDatabaseQuery().Where(db => db.Id == CloudConfigurationManager.GetSetting("Database"))
             .AsEnumerable().FirstOrDefault();
     _iDbService = new DbService();
 }
Esempio n. 7
0
 private void Init()
 {
     //Get DBservice
     _databaseSelfLink = _databaseSelfLink ?? ConfigurationManager.AppSettings["DBSelfLink"];
     _iDbService = _iDbService ?? new DbService();
     //Init DB and Firebase
     _client = _client ?? _iDbService.GetFirebaseClient();
 }
Esempio n. 8
0
 public ProcessMessage(DbService iDbService, QueueService iQueueService)
 {
     _documentClient = iDbService.GetDocumentClient();
     _client = iDbService.GetFirebaseClient();
     //_documentCollection = iDbService.GetDc("LMSCollection", "LMSRegistry");
     _documentCollection = null;
     _iDbService = iDbService;
     _queue = iQueueService.GetQueue("queue");
 }
Esempio n. 9
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        public static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();
            Log.Information("Build Number: {buildNumber}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotificationDaily"));
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();

            Console.WriteLine("Build Number: {0}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotifications"));
        }
Esempio n. 11
0
 private void Init()
 {
     _run = true;
     //Get DBservice
     _databaseSelfLink = _databaseSelfLink ?? CloudConfigurationManager.GetSetting("DBSelfLink");
     _iDbService = _iDbService ?? new DbService();
     //Init DB and Firebase
     _client = _client ?? _iDbService.GetFirebaseClient();
     //check resolver state
     lock (Object)
     {
         if (_n <= 0) return;
         _n--;
         Task.Run(() => CheckResolver());
     }
 }
Esempio n. 12
0
        public static async Task GetStartedDemo()
        {
            // Create a new instance of the DocumentClient.
            var client = Swap(2);
            var database = await GetDB(client, db);
            var documentCollection = await GetDC(client, database);
            _iDbService = new DbService();


            //await DeleteAll(client, database, documentCollection);
            await Resolver(documentCollection, client, database);
            //await GetData(client, documentCollection);
            //ReadData(client, documentCollection);
            //await WriteData(client, documentCollection);
            Console.ReadLine();
            /*await client.DeleteDatabaseAsync(database.SelfLink);
             client.Dispose();*/
        }
Esempio n. 13
0
        public static async Task GetStartedDemo()
        {
            // Create a new instance of the DocumentClient.
            DocumentClient client = new DocumentClient(new Uri(EndpointUrl), AuthorizationKey);

            var database = await GetDB(client);
            var documentCollection = await GetDC(client, database);

            //var response = await ExecuteWithRetries(5, () => client.CreateDocumentAsync("", new object()));
            //await DeleteAll(client, database, documentCollection);
            _iDbService = new DbService(EndpointUrl,AuthorizationKey);

            await sp2(documentCollection, client, database);
            //await GetData(client, documentCollection);
            //ReadData(client, documentCollection);
            //await WriteData(client, documentCollection);
            Console.ReadLine();
            /*await client.DeleteDatabaseAsync(database.SelfLink);
             client.Dispose();*/
        }
Esempio n. 14
0
        private void Init()
        {
            _run = true;
            //Get DBservice
            _endpointUrl = _endpointUrl ?? CloudConfigurationManager.GetSetting("DocumentDBUrl");
            _authorizationKey = _authorizationKey ?? CloudConfigurationManager.GetSetting("DocumentDBAuthorizationKey");
            _databaseSelfLink = _databaseSelfLink ?? CloudConfigurationManager.GetSetting("DBSelfLink");
            _iDbService = _iDbService ?? new DbService(_endpointUrl, _authorizationKey);

            //Init DB and Firebase
            _client = _client ?? _iDbService.GetFirebaseClient();

            //check resolver state
            lock (_object)
            {
                if (n <= 0) return;
                n--;
                Task.Run(() => CheckResolver());
            }
        }
Esempio n. 15
0
 //Constructor for service
 public LmsDashboardService()
 {
     _iDbService = new DbService();
 }
Esempio n. 16
0
 public ReportService(IMapper mapper, IDbService dbService)
     : base(mapper, dbService)
 {
 }
Esempio n. 17
0
        public static void ProcessEmails(IDbService dbService, bool immediate)
        {
            var sendEmail = CloudConfigurationManager.GetSetting("send-email");
            var testEmail = CloudConfigurationManager.GetSetting("send-test-emails");
            var errorCount = 0;
            var successCount = 0;

            var log = Log.ForContext("jobid", Guid.NewGuid());

            //Don't execute unless email is turned on
            if (!string.Equals(sendEmail, "Yes", StringComparison.InvariantCultureIgnoreCase))
            {
                Console.WriteLine("No emails sent because send-email is not set to 'Yes'");
                log.Information("No emails sent because send-email is not set to 'Yes'");
                return;
            }

            using (var connection = dbService.GetConnection())
            {
                List<dynamic> pending = connection.Query(@"
                    select emailqueue.id as id, [subject], [body], students.email as sEmail, registrations.email as rEmail
                    from emailqueue
                        inner join Students on students.Id = EmailQueue.Student_Id
                        LEFT OUTER JOIN Registrations on registrations.id = EmailQueue.RegistrationId
                    where Pending = 1 and [immediate] = @immediate", new { immediate }).ToList();

                if (pending.Any())
                {
                    log.Information("{count} pending emails found", pending.Count);
                }

                foreach (var email in pending)
                {
                    var emailTransmission = new Transmission
                    {
                        Content = new Content
                        {
                            From =
                                new Address
                                {
                                    Email = "*****@*****.**",
                                    Name = "UCD Commencement Notification"
                                },
                            Subject = email.subject ,
                            Html = email.body
                        }
                    };

                    if (!string.IsNullOrWhiteSpace(testEmail))
                    {
                        emailTransmission.Recipients.Add(new Recipient { Address = new Address { Email = testEmail } });
                    }
                    else
                    {
                        emailTransmission.Recipients.Add(new Recipient { Address = new Address { Email = email.sEmail } });
                        if (!string.IsNullOrWhiteSpace(email.rEmail))
                        {
                            emailTransmission.Recipients.Add(new Recipient { Address = new Address { Email = email.rEmail } });
                        }
                    }
                    var client = new Client(SparkPostApiKey);
                    DateTime? sentDateTime = null;
                    try
                    {
                        client.Transmissions.Send(emailTransmission).Wait();
                        sentDateTime = DateTime.UtcNow; //TODO: Pacific time it?
                        successCount++;
                    }
                    catch (Exception ex)
                    {
                        //TODO: Logging.
                        Console.WriteLine(string.Format("Exception Detected: {0}", ex.GetBaseException()));
                        // Log.Error(ex, "There was a problem emailing {email}", email.sEmail);
                        //I don't think we care if there are a few problems...
                        errorCount++;
                        log.Error(ex, ex.GetBaseException().ToString());
                    }

                    if (string.IsNullOrWhiteSpace(testEmail))
                    {
                        using (var ts = connection.BeginTransaction())
                        {
                            //Update the db
                            connection.Execute(@"
                            UPDATE EmailQueue
                            SET
                                 [Pending] = 0
                                ,[SentDateTime] = @sentDateTime
                            WHERE id = @id", new { sentDateTime, id = email.id }, ts);

                            ts.Commit();
                        }
                    }

                }

                Console.WriteLine(string.Format("Sent: {0} Errors: {1}", successCount, errorCount));
                log.Information("Sent: {successCount} Errors: {errorCount}", successCount, errorCount);

            }
        }
Esempio n. 18
0
 public AccessQueryService(IDbService dbService)
 {
     _dbService = dbService;
 }
Esempio n. 19
0
 public StudentController(IDbService service)
 {
     db = service;
 }
Esempio n. 20
0
 public EnrollmentController(IDbService dbService, StudentContext studentContext)
 {
     _dbService      = dbService;
     _studentContext = studentContext;
 }
Esempio n. 21
0
 public HomeController(IDbService dbServiceParam)
 {
     dbService = dbServiceParam;
 }
Esempio n. 22
0
 public UserController(IDbService service)
 {
     _service = service;
 }
Esempio n. 23
0
 public PushNotificationService(IConfiguration configuration, IDbService dbService)
 {
     _serverKey     = configuration.GetSection("FCM:ServerKey").Value;
     this.dbService = dbService;
 }
Esempio n. 24
0
 public RoomDac(IDbService service)
 {
     Collection = service.CollectionRoom;
 }
Esempio n. 25
0
 public SkillDomain(DbContext dbContext, IDbService dbService)
 {
     _dbContext = (CvManagementDbContext)dbContext;
     _dbService = dbService;
 }
Esempio n. 26
0
 public StudentsController(IDbService dbService, IStudentDbService studentDbService, IConfiguration configuration)
 {
     _dbService        = dbService;
     _studentDbService = studentDbService;
     Configuration     = configuration;
 }
 public ExamController(IDbService <Exam> service)
 {
     _service = service;
 }
Esempio n. 28
0
 public OAuthValidator(IDbService dbService)
 {
     _dbService = dbService;
 }
Esempio n. 29
0
 public AccountRepository(IDbService dbService, IMapperFactory mapperFactory, Expression <Func <User, bool> > filters)
     : base(dbService, mapperFactory)
 {
     _filters = filters;
 }
Esempio n. 30
0
 public StudentsController(IDbService idbService, IConfiguration configuration)
 {
     this.idbService    = idbService;
     this.configuration = configuration;
 }
Esempio n. 31
0
 public ReservationDac(IDbService service)
 {
     Collection = service.CollectionReservation;
 }
Esempio n. 32
0
 public EnrollmentController(IDbService dbService)
 {
     _dbService = dbService;
 }
Esempio n. 33
0
 public ZawodyController(IDbService service)
 {
     _service = service;
 }
Esempio n. 34
0
 public DoctorController(IDbService service)
 {
     this.service = service;
 }
Esempio n. 35
0
 public FRAAdapter(IHttpService httpService, IDbService dbService)
     : base(httpService, dbService)
 {
 }
 public AdultsController(IDbService service)
 {
     this.service = service;
     service.RunDbSetup();
     adultContext = new DataContext();
 }
 public MainViewModel(IDbService service)
 {
     _service = service;
     Initialize();
 }
Esempio n. 38
0
 public PlagiarismController(IDbService dbService, CompareService compareService)
 {
     _dbService      = dbService;
     _compareService = compareService;
 }
Esempio n. 39
0
 public EnrollmentsController(IDbService <Enrollment> dbService, IDbService <Study> studyDbService, IDbService <Student> studentdbService)
 {
     _dbService        = dbService;
     _studyDbService   = studyDbService;
     _studentdbService = studentdbService;
 }
Esempio n. 40
0
 public WarehouseController(IDbService DbService)
 {
     this.DbService = DbService;
 }
Esempio n. 41
0
 public void TestInitialize()
 {
     _sqlConnection =new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\Dev\2015\gvtrunk\gvtrunk\web_root\wsRethink\PCG.GOAL.WebService\App_Data\GoalServiceDb.mdf;Integrated Security=True");
     _dbService = new DbService(new SqlDataAccess(_sqlConnection));
     _adminController = new ServiceAdminController(_dbService);
 }
Esempio n. 42
0
 public PatientsController(IDbService service)
 {
     this.service = service;
 }
Esempio n. 43
0
 public SearchController(IRepositoryWithTypedId<People, string> peopleRepository, IDbService dbService)
 {
     _peopleRepository = peopleRepository;
     _dbService = dbService;
 }
Esempio n. 44
0
 public LoadBalance()
 {
     _iDbService = _iDbService ?? new DbService();
 }
Esempio n. 45
0
 //Constructor for Api
 public LmsDashboardService(IDbService iDbService)
 {
     _iDbService = iDbService;
 }
		internal BackupManager(IDbService dbService, IGitWrapper gitWrapper)
		{
			this.dbService = dbService;
			this.gitWrapper = gitWrapper;
		}
Esempio n. 47
0
 public LmsController(IDbService iDbService, ILmsDashboardService iLmsDashboardService)
 { 
     _iDbService = iDbService; 
     _iLmsDashboardService = iLmsDashboardService;
 }
Esempio n. 48
0
 private static void FakeDbService()
 {
     _iDbService = Substitute.For<IDbService>();
     _iDbService.Firebase.GetFirebaseToken("12", "aotuo", Arg.Any<string>()).Returns("token");
 }
Esempio n. 49
0
 public NoviRN3ViewModel(IDbService dbService, IRegionManager regionManager)
 {
     _dbService     = dbService;
     _regionManager = regionManager;
     FormirajListuStatusa();
 }
Esempio n. 50
0
 public AccountRepository(IDbService dbService, IMapperFactory mapperFactory)
     : base(dbService, mapperFactory)
 {
 }
 public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
 {
     DbService = ServiceLocator.Current.GetInstance<IDbService>();
     base.Initialize(name, config);
 }
Esempio n. 52
0
 public StopCommand(IDbService dbService) : base(dbService, EntryType.Stop)
 {
 }
Esempio n. 53
0
 public HistoryAjaxController(IQueryRepositoryFactory queryRepositoryFactory, IOrderService orderService, IDbService dbService)
 {
     _queryRepositoryFactory = queryRepositoryFactory;
     _orderService = orderService;
     _dbService = dbService;
 }
Esempio n. 54
0
 public StudentsController(IDbService service)
 {
     _dbService = service;
 }
Esempio n. 55
0
 public StudentsController(IDbService db)
 {
     _dbService = db;
 }
Esempio n. 56
0
 public ProjectCommand(IDbService dbService) : base(dbService, EntryType.Project)
 {
 }
Esempio n. 57
0
 public StatsController(IDbService dbService)
 {
     _dbService = dbService;
 }
Esempio n. 58
0
 public IActionResult PromoteSemester([FromBody] StudiesInfo studies, [FromServices] IDbService dbService)
 {
     return(dbService.promoteStudents(studies));
 }
Esempio n. 59
0
 public AssignmentController(IAssignmentService assignmentService, IDbService <Invoice> invoiceService, IDbService <AssignmentStatus> assignmentStatusService, IUnitOfWork uow, IDbService <Customer> customerService, IUploadFileService uploadFileService, IDbService <Adjustment> overpaymentService, IDbService <InvoiceAttachment> invoiceAttachmentService, IDbService <Attachment> attachmentService)
 {
     _assignmentService        = assignmentService;
     _invoiceService           = invoiceService;
     _assignmentStatusService  = assignmentStatusService;
     _customerService          = customerService;
     _overpaymentService       = overpaymentService;
     _invoiceAttachmentService = invoiceAttachmentService;
     _attachmentService        = attachmentService;
     _uploadFileService        = uploadFileService;
     _uow = uow;
 }
Esempio n. 60
0
 public SOStringService(IDbService dbService, IUserService userService, IConfiguration configuration)
 {
     _dbService     = dbService;
     _userService   = userService;
     _configuration = configuration;
 }