Exemplo n.º 1
0
        public ActionResult Company()
        {
            ViewData["webService"] = ConfigurationManager.AppSettings["webService"];

            string environment = ConfigurationManager.AppSettings["environment"];
            if (environment != "Dev")
            {
                PortalUser portalUser = new PortalUser();

                HttpRequest httpRequest = GetHttpRequestFromHttpResponseBase(Request);
                HttpResponse httpResponse = GetHttpResponseFromHttpResponseBase(Response);

                portalUser = GetPortalUser(PortletContextFactory.CreatePortletContext(httpRequest, httpResponse));

                if (portalUser != null)
                {
                    ViewData["user"] = portalUser.UserName;
                }
            }

            CompanyVideoHierarchy companyVideoHierarchy = new CompanyVideoHierarchy
            {
                SBUVideoHierarchies = GetSBUVideoHierarchiy(),
                AreaViewModels = GetAreaViewModels()
            };

            return View(companyVideoHierarchy);
        }
Exemplo n.º 2
0
        public void LogUser(Request request)
        {
            PortalUser portalUser = new PortalUser();

            HttpRequest httpRequest = GetHttpRequestFromHttpResponseBase(Request);
            HttpResponse httpResponse = GetHttpResponseFromHttpResponseBase(Response);

            portalUser = GetPortalUser(PortletContextFactory.CreatePortletContext(httpRequest, httpResponse));

            if (portalUser != null)
            {
                using (ASJDE context = new ASJDE())
                {
                    VideoLog videoLog = new VideoLog
                        {
                            VideoID = request.VideoID,
                            User = request.User,
                            TimeStamp = DateTime.Now
                        };

                    context.VideoLogs.Add(videoLog);
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
        public PortalUser GetPortalUser(IPortletContext thePortletContext)
        {
            PortalUser portalUser = new PortalUser();

               if (thePortletContext != null)
               {
               try
               {
                   IPortletRequest aPortletRequest = thePortletContext.GetRequest();

                   portalUser.User = thePortletContext.GetUser().GetUserID().ToString();
                   portalUser.Email = aPortletRequest.GetSettingValue(SettingType.UserInfo, "Email");
                   portalUser.UserName = aPortletRequest.GetSettingValue(SettingType.UserInfo, "FullName");
                   portalUser.Region = aPortletRequest.GetSettingValue(SettingType.UserInfo, "Region") != null ? aPortletRequest.GetSettingValue(SettingType.UserInfo, "Region").ToUpper() : "";
               }
               catch (Exception ex)
               {
                   portalUser.User = ConfigurationManager.AppSettings["adminPortalID"];
                   portalUser.Email = ConfigurationManager.AppSettings["adminEmail"];
                   portalUser.UserName = ConfigurationManager.AppSettings["adminName"];
                   portalUser.Region = ConfigurationManager.AppSettings["adminRegion"];
               }
               }

               return portalUser;
        }