Esempio n. 1
0
        public ActionResult TrangThaiHoSoNgoaiTinh(int id, int year)
        {
            int     permisstionId = 4;
            Account account       = (Account)Session[Utils.Constants.USER_SESSION];

            if (account == null)
            {
                return(RedirectToRoute("login"));
            }
            List <UserPermission> userPermission = (List <UserPermission>)Session[Utils.Constants.USER_PERMISSION_SESSION];

            if (userPermission.Where(s => s.PermissionId == permisstionId).SingleOrDefault() == null)
            {
                return(RedirectToRoute("login"));
            }

            else
            {
                using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
                {
                    ViewBag.ThuyenChuyens = _thuyenChuyenService.GetThuyenChuyenByStatusAndDvqlAndYear(id, account.DvqlId, year);
                }
            }
            using (var _statusThuyenChuyen = new TrangThaiHoSoService())
            {
                ViewBag.StatusThuyenChuyen = _statusThuyenChuyen.GetStatusThuyenChuyens();
            }
            ViewBag.StatusId = id;
            ViewBag.Year     = year;
            return(View());
        }
Esempio n. 2
0
        public async Task <ActionResult> DownloadThuyenChuyenNgoaiTinh(int statusId, int year)
        {
            Account account = (Account)Session[Utils.Constants.USER_SESSION];

            if (account == null)
            {
                return(RedirectToRoute("login"));
            }
            using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
            {
                List <ThuyenChuyenNgoaiTinh> thuyenChuyens = _thuyenChuyenService.GetThuyenChuyenByStatusAndDvqlAndYear(statusId, account.DvqlId, year);
                string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Utils/ds-thuyenchuyenngoaitinh.xlsx");
                using (var _statusThuyenChuyen = new TrangThaiHoSoService())
                {
                    StatusThuyenChuyen statusThuyenChuyen = _statusThuyenChuyen.GetStatusThuyenChuyensById(statusId);
                    await Utils.ExportExcel.GenerateXLSThuyenChuyenNgoaiTinh(thuyenChuyens, filePath, statusThuyenChuyen.Name);

                    return(File(filePath, "application/vnd.ms-excel", "ds-thuyenchuyenngoaitinh.xlsx"));
                }
            }
        }