Exemplo 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());
        }
Exemplo n.º 2
0
 public ActionResult CapNhatTrangThai(int maHoSo, int trangThaiId, DateTime date)
 {
     using (var _thuyenChuyen = new ThuyenChuyenRepository())
     {
         ThuyenChuyen thuyenChuyen = _thuyenChuyen.GetThuyenChuyensById(maHoSo);
         if (thuyenChuyen == null)
         {
             return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
         }
         using (var _trangthai = new TrangThaiHoSoService())
         {
             string trangthai = _trangthai.GetStatusThuyenChuyensById(trangThaiId).Name;
             _thuyenChuyen.CapNhatTrangThaiHoSo(thuyenChuyen, trangThaiId);
             return(Json(new ReturnResult(200, trangthai, null), JsonRequestBehavior.AllowGet));
         }
     }
 }
Exemplo n.º 3
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"));
                }
            }
        }