public DestructionController() { _db = new DistilDBContext(); _dl = new DataLayer(_db); _purchase = new PurchaseWorkflow(_db, _dl); _production = new ProductionWorkflow(_db, _dl); }
public ReportingController() { _db = new DistilDBContext(); _dl = new DataLayer(_db); _productionR = new ProductionReport(_db, _dl); _processingR = new ProcessingReport(_db, _dl); _storageR = new StorageReport(_db, _dl); _reportRepository = new ReportRepository(_db, _dl); }
/// <summary> /// Checks if user doesn't exist, if so, creates a new ApplicationUser /// </summary> public static async Task CheckCreateUser(DistilDBContext _db, Logger _logger, ApplicationUserManager UserManager, ApplicationUser user, string password, uint distillerId) { var existingUser = await UserManager.FindByNameAsync(user.UserName); if (existingUser == null) { var userCreationSucceeded = false; try { var result = await UserManager.CreateAsync(user, password); if (result.Succeeded) { userCreationSucceeded = true; } else { throw new Exception(string.Concat(result.Errors)); } } catch (Exception ex) { _logger.Error("Failed to create default admin user: {0}", ex.ToString()); } // Insert into AspNetUserToDistiller only after successfully creating a user if (userCreationSucceeded) { // Find newly created user var newUser = await UserManager.FindByNameAsync(user.UserName); try { _db.AspNetUserToDistiller.Add(new AspNetUserToDistiller { DistillerID = Convert.ToInt32(distillerId), UserId = newUser.Id }); _db.SaveChanges(); } catch (Exception ex) { // Something is wrong with the connection to the db, log and attempt to revert user creation _logger.Error("Failed to insert into AspNetUserToDistiller table: \n\t{0}", ex.ToString()); await UserManager.DeleteAsync(newUser); } } } }
public DeveloperController() { _db = new DistilDBContext(); _dl = new DataLayer(_db); }
public ReportRepository(DistilDBContext context, DataLayer dl) { _context = context; _dl = dl; }
public DictionaryWorkflow(DistilDBContext db, DataLayer dl) { _db = db; _dl = dl; }
public DictionaryController() { _db = new DistilDBContext(); _dl = new DataLayer(_db); _dictionary = new DictionaryWorkflow(_db, _dl); }
public PurchaseController() { _db = new DistilDBContext(); _dl = new DataLayer(_db); _purchase = new PurchaseWorkflow(_db, _dl); }
public PurchaseWorkflow(DistilDBContext db, DataLayer dl) { _db = db; _dl = dl; }
public AccountController() { _db = new DistilDBContext(); }