Ejemplo n.º 1
0
        public EmptyResult ReloadPage(UserSite _site, bool _redirectToHome = false)
        {
            // M.Orlando: When user is on Compliance page (http://localhost:49179/Corporate/Home/Index),
            // this is where code POSTS back to the server when the user selects different site.

            var menuService = new JCR.Reports.Services.MenuService();

            menuService.SaveArg(AppSession.UserID.GetValueOrDefault(), "SiteID", _site.SiteID.ToString());
            //menuService.SaveArg(AppSession.UserID.GetValueOrDefault(), "SiteName", _site.SiteFullName.ToString());
            //menuService.RefreshUserMenuState(AppSession.UserID.GetValueOrDefault());

            if (_redirectToHome)
            {
                return(new EmptyResult());
            }


            var commonService = new CommonService();

            AppSession.SelectedSiteId   = _site.SiteID;
            AppSession.SelectedSiteName = _site.SiteFullName;
            AppSession.IsCorporateSite  = commonService.CheckCorporateAccess(AppSession.SelectedSiteId);
            AppSession.HasTracersAccess = _site.IsTracersAccess == 1 ? true : false;
            CMSService.UpdateCMSSessionValue();

            SearchInputService reportService = new SearchInputService();

            var lstPrograms = AppSession.Sites.Where(m => m.SiteID == AppSession.SelectedSiteId).FirstOrDefault().Programs;

            //Set the default program when the site is changed
            reportService.SetProgramPreference(lstPrograms);



            return(new EmptyResult());
        }
Ejemplo n.º 2
0
        public ActionResult SearchReports(string id, int pageId = 0)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    return(RedirectToAction("Index", "Transfer"));
                }
                else
                {
                    // Mark Orlando 12/5/2017. Needed to support TEN. While user is in reports, as they click on different pages,
                    // the client passes pageId to controller. Controller must store pageId in AppSession. This is required
                    // because AppSession.LinkType is now read-only and derived from pageId.
                    if (pageId > 0)
                    {
                        AppSession.PageID = pageId;
                    }
                }

                AppSession.ReportType = "AMPReports";
                ClearReportParameters();

                SearchViewModel searchlist       = new SearchViewModel();
                CommonService   cs               = new CommonService();
                List <int>      siteList         = AppSession.Sites.Select(s => s.SiteID).ToList();
                string          siteListcsv      = String.Join(",", siteList.Select(x => x.ToString()).ToArray());
                bool            hasCorporateSite = cs.CheckCorporateAccess(AppSession.SelectedSiteId);


                if (hasCorporateSite)
                {
                    searchlist.ERReportList = cs.SelectReporListByProductID((int)WebConstants.ProductID.AMP, true);
                }
                else
                {
                    searchlist.ERReportList = cs.SelectReporListByProductID((int)WebConstants.ProductID.AMP, true).Where(x => x.ERReportDisplayGroupID != 3).ToList();
                }

                searchlist.CreatedByUsers = cs.GetERCreatedByUsers((int)WebConstants.ProductID.AMP);
                // searchlist.ScheduleTypes = cs.GetScheduleTypes();
                searchlist.ERMyReportList = cs.SelectERMyReporList((int)WebConstants.ProductID.AMP);


                return(View(searchlist));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "CorporatePriorityFinding",
                    MethodName    = "SearchReports",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }