Example #1
0
 /// <summary>
 /// Action to display dashboard page.
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     try
     {
         objDashboard = objCommonRepository.GetCount();
         return View(objDashboard);
     }
     catch (Exception ex)
     {
         CommonRepository.LogError("DashboardController", "Index", ex.ToString());
         Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]");
         Session[Helpers.CommonConstants.MessageType] = "2";
         return View();
     }
 }
Example #2
0
        /// <summary>
        /// Function to Get Count of Entities
        /// </summary>
        /// <returns></returns>
        public Dashboard.Dashboard GetCount()
        {
            try
            {
                string sQuery = "select count(*) as TotalAdmin from GHC_AdminUsers";
                sQuery += " Select count(*) as TotalUser from GHC_Users";

                DataSet ds = DBMethods.GetInfoSet(sQuery);
                if (ds != null && ds.Tables.Count > 0)
                {
                    //Count of Admin Users
                    objDashboard.nTCAdminUser = Methods.doInt(ds.Tables[0].Rows[0]["TotalAdmin"]);
                    //Count of Users
                    objDashboard.nTCUsers = Methods.doInt(ds.Tables[1].Rows[0]["TotalUser"]);
                }

                //Count of Reports
                objDashboard.nTCReports = Methods.doInt(0);
                //Count of Forms
                objDashboard.nTCForms = Methods.doInt(0);

            }
            catch (Exception ex)
            {
                objDashboard = null;
                CommonRepository.LogError(RepositoryName, "GetCount", ex.ToString());
            }
            return objDashboard;
        }