/// <summary></summary>
 /// <param name="settings"></param>
 /// <param name="repo"></param>
 public TokenController(IOptions <Audience> settings, IRTokenRepository repo)
 {
     _client          = MH.GetClient();
     auth_db          = _client.GetDatabase("AuthDB");
     users_collection = auth_db.GetCollection <BsonDocument>("Users");
     this._settings   = settings;
     this._repo       = repo;
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 public TripController()
 {
     _client             = MH.GetClient();
     trip_db             = _client.GetDatabase("TripDB");
     tripinfo_collection = trip_db.GetCollection <BsonDocument>("TripInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     tripinfoCollection     = trip_db.GetCollection <TripInfo>("TripInfo");
 }
 /// <summary>
 ///
 /// </summary>
 public TyreController()
 {
     _client             = MH.GetClient();
     tyre_db             = _client.GetDatabase("TyreDB");
     tyreinfo_collection = tyre_db.GetCollection <BsonDocument>("TyreInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     tyreinfoCollection     = tyre_db.GetCollection <TyreInfo>("TyreInfo");
 }
 /// <summary>
 ///
 /// </summary>
 public OfficeController()
 {
     _client               = MH.GetClient();
     office_db             = _client.GetDatabase("OfficeDB");
     officeinfo_collection = office_db.GetCollection <BsonDocument>("OfficeInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     officeinfoCollection   = office_db.GetCollection <OfficeInfo>("OfficeInfo");
 }
 /// <summary>
 ///
 /// </summary>
 public DriverController()
 {
     _client               = MH.GetClient();
     driver_db             = _client.GetDatabase("DriverDB");
     driverinfo_collection = driver_db.GetCollection <BsonDocument>("DriverInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     driverinfoCollection   = driver_db.GetCollection <DriverInfo>("DriverInfo");
 }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 public VendorController()
 {
     _client               = MH.GetClient();
     vendor_db             = _client.GetDatabase("VendorDB");
     vendorinfo_collection = vendor_db.GetCollection <BsonDocument>("VendorInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     vendorinfoCollection   = vendor_db.GetCollection <VendorInfo>("VendorInfo");
 }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 public VehicleController()
 {
     _client                           = MH.GetClient();
     vehicle_db                        = _client.GetDatabase("VehicleDB");
     vehicleinfo_collection            = vehicle_db.GetCollection <BsonDocument>("VehicleInfo");
     vehiclemaintenanceinfo_collection = vehicle_db.GetCollection <BsonDocument>("VehicleMaintenanceInfo");
     log_db = _client.GetDatabase("LogDB");
     activitylog_collection           = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     vehicleinfoCollection            = vehicle_db.GetCollection <VehicleInfo>("VehicleInfo");
     vehiclemaintenanceinfoCollection = vehicle_db.GetCollection <VehicleMaintenanceInfo>("VehicleMaintenanceInfo");
 }
 /// <summary></summary>
 /// <param name="settings"></param>
 /// <param name="repo"></param>
 public AuthController(IOptions <Audience> settings, IRTokenRepository repo)
 {
     _client                = MH.GetClient();
     auth_db                = _client.GetDatabase("AuthDB");
     users_collection       = auth_db.GetCollection <BsonDocument>("Users");
     usersCollection        = auth_db.GetCollection <RegisterModel>("Users");
     log_db                 = _client.GetDatabase("LogDB");
     activitylog_collection = log_db.GetCollection <ActivityLoggerModel>("ActivityLog");
     this._settings         = settings;
     this._repo             = repo;
 }
        /// <summary>Create log for server side error</summary>
        /// <param name="className"></param>
        /// <param name="methodName"></param>
        /// <param name="errorDescription"></param>
        public static void CreateLog(string className, string methodName, string errorDescription)
        {
            ServerSideLoggerModel logger =
                new ServerSideLoggerModel
            {
                ClassName   = className,
                MethodName  = methodName,
                Error       = errorDescription,
                DateAndTime = DateTime.UtcNow
            };

            MH.GetClient().GetDatabase("LogDB").GetCollection <ServerSideLoggerModel>("ServerLog").InsertOneAsync(logger);
        }
Esempio n. 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="env"></param>
        public Startup(IHostingEnvironment env)
        {
            _client          = MH.GetClient();
            role_db          = _client.GetDatabase("RoleDB");
            roles_collection = role_db.GetCollection <BsonDocument>("Roles");
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            if (env.IsEnvironment("Development"))
            {
                builder.AddApplicationInsightsSettings(developerMode: true);
            }
            builder.AddEnvironmentVariables();
            Configuration = builder.Build();
        }
Esempio n. 11
0
 /// <summary></summary>
 public RTokenRepository()
 {
     _client  = MH.GetClient();
     token_db = _client.GetDatabase("TokenDB");
 }