public StatusThuyenChuyen GetStatusThuyenChuyensById(int id)
 {
     using (var _db = new TCCBDB())
     {
         StatusThuyenChuyen statusThuyenChuyens = _db.StatusThuyenChuyens.Where(s => s.Id == id).SingleOrDefault();
         return(statusThuyenChuyens);
     }
 }
Exemplo 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"));
                }
            }
        }