示例#1
0
        // GET: Home
        public ActionResult Index()
        {
            // check if we have a PODashboardSummary object in the Session
            if (Session["poDashboardData"] == null)
            {
                // we don't, so let's create a new object, populate it and throw it into the session variable
                string qryString = "SELECT * FROM [vwGrantInfoSummary] WHERE [Status] IN ('New', 'In Progress', 'Pending') ORDER BY GrantId DESC";
                List <GrantInfoSummary> summaryData = _ctx.Database.SqlQuery <GrantInfoSummary>
                                                          (qryString).ToList();

                string      qryStringTotals = "SELECT * from vwGrantTotalSummary";
                GrantTotals totals          = _ctx.Database.SqlQuery <GrantTotals>
                                                  (qryStringTotals).ToList().FirstOrDefault();

                PODashboardSummary po = new PODashboardSummary
                {
                    GrantInfoSummary = summaryData,
                    GrantTotals      = totals
                };

                Session["poDashboardData"] = po;

                return(View("Dashboard", po));
            }
            else
            {
                // we have a PODashboardSummary object in the Session
                // so let's just get it and return the view with the data

                return(View("Dashboard", (PODashboardSummary)Session["poDashboardData"]));
            }
        }
示例#2
0
 private PODashboardSummary GetPODashboardData()
 {
     if (Session["poDashboardData"] == null)
     {
         Session["poDashboardData"] = new PODashboardSummary();
     }
     return((PODashboardSummary)Session["poDashboardData"]);
 }
示例#3
0
        // GET: GrantInfoSummaries
        public ActionResult Index()
        {
            string qryString = "SELECT * FROM [vwGrantInfoSummary] WHERE [Status] IN ('New', 'In Progress', 'Pending') ORDER BY GrantId DESC";
            List <GrantInfoSummary> summaryData = db.Database.SqlQuery <GrantInfoSummary>
                                                      (qryString).ToList();

            string      qryStringTotals = "SELECT * from vwGrantTotalSummary";
            GrantTotals totals          = db.Database.SqlQuery <GrantTotals>
                                              (qryStringTotals).ToList().FirstOrDefault();

            PODashboardSummary po = new PODashboardSummary
            {
                GrantInfoSummary = summaryData,
                GrantTotals      = totals
            };

            return(View("Index", po));
        }