Example #1
0
 public MovementService(TrackerDbContext context)
 {
     _context = context;
 }
Example #2
0
 public void InitializeTests()
 {
     this.db     = MockDbContext.GetContext();
     this.mapper = MockAutoMapper.GetMapper();
 }
Example #3
0
 public CreateLocationHandler(TrackerDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
Example #4
0
 public Tbl_TheoDoiController()
 {
     _context = new TrackerDbContext();
 }
Example #5
0
        public ActionResult List(string sortOrder, string searchString, bool?showArchive)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var context = new TrackerDbContext();
            var issues  = context.Issues
                          .Include(x => x.Status)
                          .Include(x => x.Notifier)
                          .Include(x => x.Agent)
                          .ToList();

            if (showArchive != true)
            {
                issues = issues.Where(x => x.ArchivedTimeStamp == null).ToList();
                ViewBag.showArchive = false;
            }
            else
            {
                ViewBag.showArchive = true;
            }

            ViewBag.TitleSortParm    = String.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
            ViewBag.AgentSortParm    = sortOrder == "agent" ? "agent_desc" : "agent";
            ViewBag.NotifierSortParm = sortOrder == "notifier" ? "notifier_desc" : "notifier";
            ViewBag.StatusSortParm   = sortOrder == "status" ? "status_desc" : "status";

            if (!String.IsNullOrEmpty(searchString))
            {
                issues = issues.Where(x => x.Title.ToLower().Contains(searchString.ToLower()) ||
                                      x.Agent.FullName.ToLower().Contains(searchString.ToLower()) ||
                                      x.Notifier.FullName.ToLower().Contains(searchString.ToLower()) ||
                                      x.Status.Name.ToLower().Contains(searchString.ToLower())
                                      ).ToList();
                ViewBag.IssueSearchString = searchString;
            }

            switch (sortOrder)
            {
            case "agent":
                issues = issues.OrderBy(x => x.Agent.Lastname).ToList();
                break;

            case "agent_desc":
                issues = issues.OrderByDescending(x => x.Agent.Lastname).ToList();
                break;

            case "notifier":
                issues = issues.OrderBy(x => x.Notifier.Lastname).ToList();
                break;

            case "notifier_desc":
                issues = issues.OrderByDescending(x => x.Notifier.Lastname).ToList();
                break;

            case "status":
                issues = issues.OrderBy(x => x.Status.Name).ToList();
                break;

            case "status_desc":
                issues = issues.OrderByDescending(x => x.Status.Name).ToList();
                break;

            case "title_desc":
                issues = issues.OrderByDescending(x => x.Title).ToList();
                break;

            default:
                issues = issues.OrderBy(x => x.Title).ToList();
                break;
            }
            return(View(issues));
        }
Example #6
0
 public LobList(TrackerDbContext db)
 {
     this.db = db;
 }
Example #7
0
        public ActionResult Details(int companyId, string sortOrder, string searchString, bool?showArchive)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            var     context = new TrackerDbContext();
            Company company = context.Companies
                              .Where(x => x.Id == companyId)
                              .Include(x => x.Employees)
                              .FirstOrDefault();

            company.Employees = company.Employees.ToList();

            if (showArchive != true)
            {
                company.Employees   = company.Employees.Where(x => x.ArchivedTimeStamp == null).ToList();
                ViewBag.showArchive = false;
            }
            else
            {
                ViewBag.showArchive = true;
            }

            ViewBag.CompanyId         = companyId;
            ViewBag.LastNameSortParm  = String.IsNullOrEmpty(sortOrder) ? "lname_desc" : "";
            ViewBag.FirstNameSortParm = sortOrder == "fname" ? "fname_desc" : "fname";
            ViewBag.CompanySortParm   = sortOrder == "company" ? "company_desc" : "company";

            if (!String.IsNullOrEmpty(searchString))
            {
                company.Employees = company.Employees.Where(x => x.FullName.ToLower().Contains(searchString.ToLower()) ||
                                                            x.Company.Name.ToLower().Contains(searchString.ToLower())
                                                            ).ToList();
                ViewBag.UserSearchString = searchString;
            }

            switch (sortOrder)
            {
            case "fname":
                company.Employees = company.Employees.OrderBy(x => x.FirstName).ToList();
                break;

            case "fname_desc":
                company.Employees = company.Employees.OrderByDescending(x => x.FirstName).ToList();
                break;

            case "company":
                company.Employees = company.Employees.OrderBy(x => x.Company.Name).ToList();
                break;

            case "company_desc":
                company.Employees = company.Employees.OrderByDescending(x => x.Company.Name).ToList();
                break;

            case "lname_desc":
                company.Employees = company.Employees.OrderByDescending(x => x.Lastname).ToList();
                break;

            default:
                company.Employees = company.Employees.OrderBy(x => x.Lastname).ToList();
                break;
            }


            return(View(company));
        }
Example #8
0
 public SettingsController(TrackerDbContext context, ChildrensService childrensService, UserManager <ApplicationUser> userManager)
 {
     _context          = context;
     _childrensService = childrensService;
     this.userManager  = userManager;
 }
Example #9
0
 public ExerciseTypesService(TrackerDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #10
0
 public Activity(TrackerDbContext db)
 {
     this.db = db;
 }
Example #11
0
 public Status(TrackerDbContext db)
 {
     this.db = db;
 }
Example #12
0
 public DivisionList(TrackerDbContext db)
 {
     this.db = db;
 }
Example #13
0
 public Mining(TrackerDbContext db)
 {
     this.db = db;
 }