/// <summary>
        /// Báo cáo theo tháng
        /// </summary>
        /// <param name="areaId"></param>
        /// <param name="Date"></param>
        /// <param name="deviceId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public async Task <ActionResult> MonthLy(int?areaId = null, string Date = "", int?deviceId = null, string type = "RP0", int?groupId = null)
        {
            ViewBag.Title         = "";
            ViewBag.MessageStatus = TempData["MessageStatus"];
            ViewBag.Message       = TempData["Message"];
            int    CurrentUserId = WebMatrix.WebData.WebSecurity.CurrentUserId;
            string userName      = User.Identity.Name;

            groupId = userProfileService.userProfileResponsitory.Single(CurrentUserId).Group_Id;
            ViewBag.listTypeReport = reportTypeService.reportTypeRepository.GetAll().ToList();
            if (!deviceId.HasValue)
            {
                deviceId = sitesService.GetByAreaId(areaId).FirstOrDefault().DeviceId;
            }
            if (userName == "administrator")
            {
                ViewBag.listSite   = sitesService.sitesResponsitory.GetAll().ToList();
                ViewBag.listArea   = areasService.areaResponsitory.GetAll().ToList();
                ViewBag.listGroups = groupService.groupResponsitory.GetAll().ToList();
            }
            else
            {
                ViewBag.listArea   = areasService.GetAreasByGroupId(groupId).ToList();
                ViewBag.listSite   = sitesService.GetBygroupId(groupId).ToList();
                ViewBag.listGroups = groupService.GetGroups(groupId).ToList();
            }
            ReportMonthlyModel model = new ReportMonthlyModel();

            model = await cacheBO.GetReportByMonth(deviceId.Value, type, Date);

            DateTime date = DateTime.Today;

            if (Date != "")
            {
                try
                {
                    date = Convert.ToDateTime(Date);
                }
                catch { }
            }
            ReportMonthlyViewModel viewModel = new ReportMonthlyViewModel
            {
                Date     = date,
                DeviceId = deviceId,
                data     = model,
                AreaId   = areaId,
            };

            return(View(viewModel));
        }
 public ActionResult GetSite(int idArea)
 {
     List<Site> sites = sitesService.GetByAreaId(idArea).ToList();
     return PartialView("_ListSitePartialView", sites);
 }