Exemplo n.º 1
0
        public void PopulateViewBag(int contractID)
        {
            //const string sessionKey = "CurrentUser";
            string userLogin = GetLogin();

            if (userLogin != null)
            {
                try
                {
                    User     currentUser = _pu.GetUser(userLogin);
                    string   roles       = _pu.GetUserRoles(userLogin);
                    Contract contract    = _context.GetContractByID(contractID);
                    ViewBag.Contract = contract;
                    if (contract == null)
                    {
                        ViewBag.ContractID = 0;
                    }
                    else
                    {
                        ViewBag.ContractID = contract.ContractID;
                    }
                    ViewBag.CurrentUser = currentUser;
                    ViewBag.Roles       = roles;
                }
                catch (Exception e)
                { //should be encumbrancelookupscontroller
                    _logger.LogError("LineItemGroupsController.PopulateViewBag Error:" + e.GetBaseException());
                    Log.Error("LineItemGroupsController.PopulateViewBag  Error:" + e.GetBaseException() + "\n" + e.StackTrace);
                }
            }
            else
            {
                RedirectToAction("Home");
            }
        }