예제 #1
0
        // GET: Load
        public ActionResult Index()
        {
            var Loadboard = new LoadboardViewModel();

            Loadboard.StatusSelector = SelectListHelper.Generic(LoadBusiness.GetLoadStatuses(_user));

            //retrieve save searches
            Loadboard.SavedSearches = _user.SavedSearches.Where(i => i.Category == Globals.SearchCategories.Loadboard).ToList();

            //retrieve save loadboard settings
            var LoadboardSettings = _user.Settings.FirstOrDefault(i => i.SettingName == "Loadboard");

            if (LoadboardSettings != null)
            {
                Loadboard.Settings = LoadboardSettings.SettingValue;
            }


            using (var OfficeBusiness = new OfficeBusiness(_applicationServicesSetup, _user))
            {
                Loadboard.OfficeGroups = OfficeBusiness.GetUserGroupsByOffice(_user.OfficeId, new[] { Globals.Related.OfficeGroup.Members });

                //if just an agent, only show the groups you are apart of.
                if (_user.IsAgent() && !_user.IsEmployee())
                {
                    Loadboard.OfficeGroups = Loadboard.OfficeGroups.Where(i => i.Members.Select(u => u.Id == _user.Id).Any()).ToList();
                }
            }

            return(View(Loadboard));
        }
예제 #2
0
 public LoadController()
 {
     if (_user == null)
     {
         _user = GetSystemUser();
     }
     _loadBusiness = new LoadBusiness(_applicationServicesSetup, _user);
 }