public HomeController() { StripperContext Context = ContextHelper.GetContext(); UserRepo = new UserRepository(Context); CompanyRepo = new CompanyRepository(Context); }
/// <summary> /// Processes the file. /// </summary> /// <param name="file">An <see cref="System.IO.FileInfo"/> to process.</param> protected override void ProcessFile(System.IO.FileInfo file) { StripperBase stripper = null; switch (file.Extension.ToLower()) { case ".sln": stripper = this.CreateSolutionFileStripper(); break; case ".csproj": case ".vbproj": case ".wixproj": case ".wdproj": stripper = this.CreateProjectFileStripper(); break; default: return; } if (stripper != null) { StripperContext context = new StripperContext(); context.File = file; stripper.Context = context; stripper.StripBindings(); Console.WriteLine("{0} processed.", file.FullName); } }
public HomeController(StripperContext context, ICompanyRepository cRep) { //for testing UserRepo = new UserRepository(context); CompanyRepo = cRep; _isTesting = true; }
/// <summary> /// Processes the file. /// </summary> /// <param name="file">An <see cref="System.IO.FileInfo"/> to process.</param> protected override void ProcessFile(System.IO.FileInfo file) { StripperBase stripper = null; switch (file.Extension.ToLower()) { case ".sln": stripper = this.CreateSolutionFileStripper(); break; case ".csproj": case ".vbproj": case ".wixproj": case ".wdproj": stripper = this.CreateProjectFileStripper(); break; default: return; } if (stripper != null) { StripperContext context = new StripperContext(); context.File = file; stripper.Context = context; stripper.StripBindings(); Console.WriteLine("{0} processed.", file.FullName); } }
public CvController() { StripperContext context = ContextHelper.GetContext(); Repo = new CvRepository(context); }
[Authorize] //only for EHV administrators public ActionResult EhvPanel() { //retrieves relevant admin account from tempdata User u = (User)TempData["CurrentUser"]; //and places it back for further use TempData["CurrentUser"] = u; if (u == null) { u = new User { Role = UserRole.EHVAdmin } } ; //checks if user is allowed to view EHVpanel if (u.Role != UserRole.EHVAdmin) { if (u.Role == UserRole.CompanyAdmin) { //bring to Company panel return(RedirectToAction("CompanyPanel", "Home")); } //redirect to previous page if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.ToString())); } //else just return to the stripper return(RedirectToAction("Index", "Cv")); } //if not testing if (!_isTesting) { //checks based on a saved TempData bool if context and repositories need to be refreshed/recreated if (TempData["UpdateHappened"] != null) { if ((bool)TempData["UpdateHappened"]) { StripperContext context = new StripperContext(); UserRepo = new UserRepository(context); CompanyRepo = new CompanyRepository(context); } } } //retrieves all companies List <Company> companies = CompanyRepo.GetAll(); //retrieves all users List <User> users = UserRepo.GetAll(); //for each company, get all users and save them in company entity for usercount in view foreach (Company c in companies) { c.Users = UserRepo.GetAllByCompanyId(c.Id); } //removes anything to do with password for all users, since they are not needed and are a security concern foreach (var us in users) { us.Password = ""; us.Salt = ""; } //creates and fills Admin Panel View Model EHVAdminPanelViewModel model = new EHVAdminPanelViewModel() { Email = u.Emailaddress, Role = u.Role, Companies = companies, Users = users, UserReturnError = (string)TempData["UserReturnError"], CompanyReturnError = (string)TempData["CompanyReturnError"] }; TempData["vModel"] = model; return(View(model)); }
[Authorize] //only for Company administrators public ActionResult CompanyPanel() { //retrieves relevant admin account from tempdata User u = (User)TempData["CurrentUser"]; //and places it back for further use TempData["CurrentUser"] = u; if (_isTesting) { //for testing if (u == null) { //fills u with a random user with test values u = new User(1, "*****@*****.**", "password", "salt", UserRole.CompanyAdmin, new Company (1, "testName", "testLocation", "testSector", StripperPackage.B)); } } //checks if user is allowed to view Companypanel if (u.Role != UserRole.CompanyAdmin) { if (u.Role == UserRole.EHVAdmin) { //bring to EHV panel return(RedirectToAction("EhvPanel", "Home")); } //redirect to previous page if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.ToString())); } //else just return to the stripper return(RedirectToAction("Index", "Cv")); } //if not testing if (!_isTesting) { //checks based on a saved TempData bool if context and repositories need to be refreshed/recreated if (TempData["UpdateHappened"] != null) { if ((bool)TempData["UpdateHappened"]) { StripperContext context = new StripperContext(); UserRepo = new UserRepository(context); CompanyRepo = new CompanyRepository(context); } } } //retrieves all users of the company List <User> companyUsers = UserRepo.GetAllByCompanyId(u.UserCompany.Id); //removes anything to do with password for all users, since they are not needed and are a security concern if (companyUsers == null) { return(View()); } foreach (var us in companyUsers) { us.Password = ""; us.Salt = ""; } //creates and fills Admin Panel View Model CompanyAdminPanelViewModel model = new CompanyAdminPanelViewModel { Company = u.UserCompany, Email = u.Emailaddress, UserCount = companyUsers.Count, TotalAllowedUsers = u.UserCompany.GetPackageUserCount(), Role = u.Role }; model.Company.Users = companyUsers; TempData["vModel"] = model; return(View(model)); }
public CompanyController(StripperContext context) { //for testing CompanyRepo = new CompanyRepository(context); }
public CompanyController() { StripperContext context = ContextHelper.GetContext(); CompanyRepo = new CompanyRepository(context); }
public UserController(StripperContext context, IUserRepository rep) { //for testing CompanyRepo = new CompanyRepository(context); UserRepo = rep; }