/// <summary> /// Initiates the object and its dependencies. /// </summary> public UserManagementService(UserDAO userDAO, AnonymousUserDAO anonymousUserDAO, DataStoreLoggingService dsLoggingService, FlatFileLoggingService ffLoggingService, MaskingService maskingService) { _userDAO = userDAO; _anonymousUserDAO = anonymousUserDAO; _dsLoggingService = dsLoggingService; _ffLoggingService = ffLoggingService; _maskingService = maskingService; }
public async static Task Main() { // MapDAO mdao = new MapDAO(Constants.MapSQLConnection); // LogDAO ldao = new LogDAO(Constants.NOSQLConnection); // StoreDAO sdao = new StoreDAO(Constants.SQLConnection); // AnonymousUserDAO adao = new AnonymousUserDAO(Constants.SQLConnection); // UploadDAO updao = new UploadDAO(Constants.SQLConnection); // UserDAO udao = new UserDAO(Constants.SQLConnection); // MaskingService mservice = new MaskingService(mdao); // DataStoreLoggingService dsls = new DataStoreLoggingService(ldao, mservice); // FlatFileLoggingService ffls = new FlatFileLoggingService(mservice); // LoggingManager lmanager = new LoggingManager(ffls, dsls); // GoogleImageAnalysisService gias = new GoogleImageAnalysisService(); // StoreService sservice = new StoreService(sdao); // UploadService uservice = new UploadService(updao); // UserManagementService umanage = new UserManagementService(udao, adao, dsls, ffls, mservice); // UploadManager manager = new UploadManager(lmanager, gias, sservice, uservice, umanage); // Bitmap bmp = new Bitmap(@"C:\Users\Eli\Desktop\Test\CVS\IMG_20200420_185009.jpg"); // byte[] byteArray = File.ReadAllBytes(@"C:\Users\Eli\Desktop\Test\CVS\IMG_20200420_185009.jpg"); // DIRECTIONS: comment out the admin check in this method to create the admin //await umanage.CreateUserAsync(false, new UserRecord("System", "testname", "*****@*****.**", "9498675309", "password", 0, Constants.AdminUserType, "salt", Constants.NoValueLong, "090909", 0, 0, 0, 0, 0)).ConfigureAwait(false); //============================================================================ //await gias.AnalyzeAsync(Image.FromFile(@"C:\Users\Eli\Desktop\Test\CVS\IMG_20200420_185009.jpg"), Constants.ExogredientCategories).ConfigureAwait(false); //UploadPost post = new UploadPost(byteArray, "packaged/bottled products", "thesmokinggun42", "172.88.196.101", DateTime.Now, "Nutter Butter", "deez nutz", 5, 4.20, "item"); var userdao = new UserDAO(Constants.SQLConnection); var anonUserdao = new AnonymousUserDAO(Constants.SQLConnection); LogDAO _logDAO = new LogDAO(Constants.NOSQLConnection); MapDAO _mapDAO = new MapDAO(Constants.MapSQLConnection); MaskingService _maskingService = new MaskingService(_mapDAO); DataStoreLoggingService _dsLoggingService = new DataStoreLoggingService(_logDAO, _maskingService); FlatFileLoggingService _ffLoggingService = new FlatFileLoggingService(_maskingService); var usrmngser = new UserManagementService(userdao, anonUserdao, _dsLoggingService, _ffLoggingService, _maskingService); usrmngser.CreateUserAsync(false, new UserRecord("System", "sys", Constants.SystemAdminEmailAddress, "5625555555", "123123", 0, "Admin", "12345678", 0, "0", 0, 0, 0, 0, 0)); }
public async Task <IActionResult> SearchIngredientAtStoreAsync(string ingredientName, int storeID, int pagination, string username, string ipAddress) { // New up DAL UploadDAO uploadDAO = new UploadDAO(Constants.SQLConnection); var mapDao = new MapDAO(Constants.MapSQLConnection); var logDao = new LogDAO(Constants.SQLConnection); var userDao = new UserDAO(Constants.SQLConnection); var anonymousUserDao = new AnonymousUserDAO(Constants.SQLConnection); // New up Service var uploadService = new UploadService(uploadDAO); var maskingService = new MaskingService(mapDao); var ffLoggingService = new FlatFileLoggingService(maskingService); var dsLoggingService = new DataStoreLoggingService(logDao, maskingService); var userManagementService = new UserManagementService(userDao, anonymousUserDao, dsLoggingService, ffLoggingService, maskingService); // New up Managers var loggingManager = new LoggingManager(ffLoggingService, dsLoggingService); var ingredientManager = new IngredientManager(uploadService, loggingManager, userManagementService); return(Ok(await ingredientManager.GetUploadsByIngredientNameandStoreId(ingredientName, storeID, pagination, Constants.InitialFailureCount, username, ipAddress).ConfigureAwait(false))); }
public async Task <bool> DownvoteIngredient(int uploadId, string username, string ipAddress) { // New up DAL UploadDAO uploadDAO = new UploadDAO(Constants.SQLConnection); var mapDao = new MapDAO(Constants.MapSQLConnection); var logDao = new LogDAO(Constants.SQLConnection); var userDao = new UserDAO(Constants.SQLConnection); var anonymousUserDao = new AnonymousUserDAO(Constants.SQLConnection); // New up Service var uploadService = new UploadService(uploadDAO); var maskingService = new MaskingService(mapDao); var ffLoggingService = new FlatFileLoggingService(maskingService); var dsLoggingService = new DataStoreLoggingService(logDao, maskingService); var userManagementService = new UserManagementService(userDao, anonymousUserDao, dsLoggingService, ffLoggingService, maskingService); // New up Managers var loggingManager = new LoggingManager(ffLoggingService, dsLoggingService); var ingredientManager = new IngredientManager(uploadService, loggingManager, userManagementService); return(await ingredientManager.EditDownvotesonUpload(Constants.PositiveVote, uploadId, Constants.InitialFailureCount, username, ipAddress)); }
public async Task <IActionResult> GetIngredientViewPaginationSize(string ingredientName, int storeId, string username, string ipAddress) { // New up DAL UploadDAO uploadDAO = new UploadDAO(Constants.SQLConnection); var mapDao = new MapDAO(Constants.MapSQLConnection); var logDao = new LogDAO(Constants.SQLConnection); var userDao = new UserDAO(Constants.SQLConnection); var anonymousUserDao = new AnonymousUserDAO(Constants.SQLConnection); // New up Service var uploadService = new UploadService(uploadDAO); var maskingService = new MaskingService(mapDao); var ffLoggingService = new FlatFileLoggingService(maskingService); var dsLoggingService = new DataStoreLoggingService(logDao, maskingService); var userManagementService = new UserManagementService(userDao, anonymousUserDao, dsLoggingService, ffLoggingService, maskingService); // New up Managers var loggingManager = new LoggingManager(ffLoggingService, dsLoggingService); var ingredientManager = new IngredientManager(uploadService, loggingManager, userManagementService); try { // Return status code of 200 as well as the content. return(Ok(await ingredientManager.GetIngredientViewPaginationSize(ingredientName, storeId, Constants.InitialFailureCount, username, ipAddress).ConfigureAwait(false))); } catch (ArgumentException ae) { // Return an 404 error when the resource does not exists. return(NotFound(ae.Message)); } catch { // Return generic server error for all other exceptions. return(StatusCode(StatusCodes.Status500InternalServerError)); } }