Beispiel #1
0
        public ActionResult NhanHoSoThuyenChuyenNgoaiTinh(int mahoso)
        {
            int     permisstionId = 3;
            Account account       = (Account)Session[Utils.Constants.USER_SESSION];

            if (account == null)
            {
                return(Json(new ReturnResult(403, "access denied", null), JsonRequestBehavior.AllowGet));
            }
            List <UserPermission> userPermission = (List <UserPermission>)Session[Utils.Constants.USER_PERMISSION_SESSION];

            if (userPermission.Where(s => s.PermissionId == permisstionId).SingleOrDefault() == null)
            {
                return(Json(new ReturnResult(403, "access denied", null), JsonRequestBehavior.AllowGet));
            }
            using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
            {
                ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyenService.GetThuyenChuyensById(mahoso);
                if (thuyenChuyen == null)
                {
                    return(Json(new ReturnResult(400, "Không tìm thấy hồ sơ", null), JsonRequestBehavior.AllowGet));
                }
                if (thuyenChuyen.StatusId != null)
                {
                    return(Json(new ReturnResult(400, "Hồ sơ đã được tiếp nhận trước đó", null), JsonRequestBehavior.AllowGet));
                }
                _thuyenChuyenService.TiepNhanHoSo(thuyenChuyen, 1, account.Id);
                return(Json(new ReturnResult(200, "success", null), JsonRequestBehavior.AllowGet));
            }
        }
 public ThuyenChuyenNgoaiTinh CreateThuyenChuyen(ThuyenChuyenNgoaiTinh thuyenChuyen)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.CreatedAt = DateTime.Now;
         thuyenChuyen.TienTo    = "TCN";
         _db.ThuyenChuyenNgoaiTinhs.Add(thuyenChuyen);
         _db.SaveChanges();
         return(thuyenChuyen);
     }
 }
Beispiel #3
0
 public ActionResult CapNhatTrangThaiNgoaiTinh(int maHoSo, int trangThaiId, DateTime date)
 {
     using (var _thuyenChuyen = new ThuyenChuyenNgoaiTinhService())
     {
         ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyen.GetThuyenChuyensById(maHoSo);
         if (thuyenChuyen == null)
         {
             return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
         }
         _thuyenChuyen.CapNhatTrangThaiHoSo(thuyenChuyen, trangThaiId);
         return(Json(new ReturnResult(200, "success", null), JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult KiemTraMaHopLe(string madangki, string cmnd)
 {
     if (madangki.ToUpper().Contains("TCN"))
     {
         using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
         {
             ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyenService.CheckThuyenChuyenExistedByIdAndCMND(madangki, cmnd);
             if (thuyenChuyen == null)
             {
                 return(Json(new ReturnResult(400, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
             }
             else if (thuyenChuyen.StatusId != null && thuyenChuyen.StatusId != 5)
             {
                 return(Json(new ReturnResult(400, "Hồ sơ đã được tiếp nhân. Do đó không được cập nhật", null), JsonRequestBehavior.AllowGet));
             }
             var thuyenChuyenJson = JsonConvert.SerializeObject(thuyenChuyen,
                                                                Formatting.None,
                                                                new JsonSerializerSettings()
             {
                 ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
             });
             return(Json(new ReturnResult(200, "success", thuyenChuyenJson), JsonRequestBehavior.AllowGet));
         }
     }
     else if (madangki.ToUpper().Contains("TC"))
     {
         using (var _thuyenChuyenService = new ThuyenChuyenRepository())
         {
             ThuyenChuyen thuyenChuyen = _thuyenChuyenService.CheckThuyenChuyenExistedByIdAndCMND(madangki, cmnd);
             if (thuyenChuyen == null)
             {
                 return(Json(new ReturnResult(400, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
             }
             else if (thuyenChuyen.StatusId != null && thuyenChuyen.StatusId != 5)
             {
                 return(Json(new ReturnResult(400, "Hồ sơ đã được tiếp nhân. Do đó không được cập nhật", null), JsonRequestBehavior.AllowGet));
             }
             var thuyenChuyenJson = JsonConvert.SerializeObject(thuyenChuyen,
                                                                Formatting.None,
                                                                new JsonSerializerSettings()
             {
                 ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
             });
             return(Json(new ReturnResult(200, "success", thuyenChuyenJson), JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new ReturnResult(400, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult DangKiMoiPost(ThuyenChuyenNgoaiTinhDTO thuyenChuyenDTO)
 {
     if (ModelState.IsValid)
     {
         ThuyenChuyenNgoaiTinh thuyenChuyen = new ThuyenChuyenNgoaiTinh();
         Mapper.Map(thuyenChuyenDTO, thuyenChuyen);
         using (var _thuyenChuyenNgoaiTinhService = new ThuyenChuyenNgoaiTinhService())
         {
             ThuyenChuyenNgoaiTinh thuyenChuyenCreated = _thuyenChuyenNgoaiTinhService.CreateThuyenChuyen(thuyenChuyen);
             return(Json(new ReturnResult(200, "success", thuyenChuyen.Id), JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
 }
 public ActionResult KiemTraMaHopLe(string madangki, string cmnd)
 {
     using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
     {
         ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyenService.CheckThuyenChuyenExistedByIdAndCMND(madangki.Trim(), cmnd.Trim());
         if (thuyenChuyen == null)
         {
             return(Json(new ReturnResult(400, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
         }
         else if (thuyenChuyen.StatusId != null && thuyenChuyen.StatusId != 5)
         {
             return(Json(new ReturnResult(400, "Hồ sơ đã được tiếp nhân. Do đó không được cập nhật", null), JsonRequestBehavior.AllowGet));
         }
         return(Json(new ReturnResult(200, "success", null), JsonRequestBehavior.AllowGet));
     }
 }
 public ThuyenChuyenNgoaiTinh CapNhatThuyenChuyen(ThuyenChuyenNgoaiTinh thuyenChuyen)
 {
     using (var _db = new TCCBDB())
     {
         _db.Entry(thuyenChuyen).State = System.Data.Entity.EntityState.Modified;
         try
         {
             _db.SaveChanges();
         }
         catch (Exception)
         {
             return(null);
         }
         return(thuyenChuyen);
     }
 }
 public ThuyenChuyenNgoaiTinh CapNhatTrangThaiHoSo(ThuyenChuyenNgoaiTinh thuyenChuyen, int trangThaiId)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.StatusId         = trangThaiId;
         _db.Entry(thuyenChuyen).State = System.Data.Entity.EntityState.Modified;
         try
         {
             _db.SaveChanges();
         }
         catch (Exception)
         {
             return(null);
         }
         return(thuyenChuyen);
     }
 }
 public ThuyenChuyenNgoaiTinh TiepNhanHoSo(ThuyenChuyenNgoaiTinh thuyenChuyen, int trangThaiId, int accountId)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.StatusId         = trangThaiId;
         thuyenChuyen.NguoiTiepNhanId  = accountId;
         thuyenChuyen.NgayTiepNhan     = DateTime.Now;
         _db.Entry(thuyenChuyen).State = System.Data.Entity.EntityState.Modified;
         try
         {
             _db.SaveChanges();
         }
         catch (Exception)
         {
             return(null);
         }
         return(thuyenChuyen);
     }
 }
        public ActionResult CapNhatPost(ThuyenChuyenNgoaiTinhDTO thuyenChuyenDTO, int id)
        {
            if (ModelState.IsValid)
            {
                using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
                {
                    ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyenService.GetThuyenChuyensById(id);
                    Mapper.Map(thuyenChuyenDTO, thuyenChuyen);
                    thuyenChuyen.UpdateAt = DateTime.Now;
                    ThuyenChuyenNgoaiTinh thuyenChuyenUpdated = _thuyenChuyenService.CapNhatThuyenChuyen(thuyenChuyen);
                    if (thuyenChuyenUpdated == null)
                    {
                        return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
                    }
                    return(Json(new ReturnResult(200, "success", thuyenChuyenUpdated.Id), JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
        }
 public ThuyenChuyenNgoaiTinh CheckThuyenChuyenExistedByIdAndCMND(string id, string cmnd)
 {
     using (var _db = new TCCBDB())
     {
         ThuyenChuyenNgoaiTinh thuyenChuyen = _db.ThuyenChuyenNgoaiTinhs
                                              .Include("BangTotNghiep")
                                              .Include("StatusThuyenChuyen")
                                              .Include("ChuyenNganhDaoTao")
                                              .Include("HinhThucDaoTao")
                                              .Include("MonDuTuyen")
                                              .Include("School.Ward.District")
                                              .Include("XepLoaiHocLuc")
                                              .Include("Ward1.District.Province")
                                              .Include("Ward.District.Province")
                                              .Include("TrinhDoCaoNhat")
                                              .Include("StatusThuyenChuyen")
                                              .Where(s => s.TienTo + s.Id == id.Trim().ToUpper() && s.CMND.Trim() == cmnd.Trim())
                                              .SingleOrDefault();
         return(thuyenChuyen);
     }
 }
 public ThuyenChuyenNgoaiTinh GetThuyenChuyensByMaHoSo(string id)
 {
     using (var _db = new TCCBDB())
     {
         ThuyenChuyenNgoaiTinh thuyenChuyen = _db.ThuyenChuyenNgoaiTinhs
                                              .Include("BangTotNghiep")
                                              .Include("StatusThuyenChuyen")
                                              .Include("ChuyenNganhDaoTao")
                                              .Include("HinhThucDaoTao")
                                              .Include("MonDuTuyen")
                                              .Include("School.Ward.District")
                                              .Include("School.DVQL")
                                              .Include("XepLoaiHocLuc")
                                              .Include("Ward1.District.Province")
                                              .Include("Ward.District.Province")
                                              .Include("Province")
                                              .Include("TrinhDoCaoNhat")
                                              .Where(s => s.TienTo.Trim() + s.Id == id.Trim().ToUpper()).SingleOrDefault();
         return(thuyenChuyen);
     }
 }
Beispiel #13
0
        public ActionResult KiemTraMaHoSo(string mahoso)
        {
            int     permisstionId = 3;
            Account account       = (Account)Session[Utils.Constants.USER_SESSION];

            if (account == null)
            {
                return(Json(new ReturnResult(403, "access denied", null), JsonRequestBehavior.AllowGet));
            }
            List <UserPermission> userPermission = (List <UserPermission>)Session[Utils.Constants.USER_PERMISSION_SESSION];

            if (userPermission.Where(s => s.PermissionId == permisstionId).SingleOrDefault() == null)
            {
                return(Json(new ReturnResult(403, "access denied", null), JsonRequestBehavior.AllowGet));
            }
            if (mahoso.ToUpper().Contains("TCN"))
            {
                using (var _thuyenChuyenService = new ThuyenChuyenNgoaiTinhService())
                {
                    ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenChuyenService.GetThuyenChuyensByMaHoSo(mahoso.Trim());
                    if (thuyenChuyen == null)
                    {
                        return(Json(new ReturnResult(404, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
                    }
                    else if (thuyenChuyen.School.DVQLId != account.DvqlId)
                    {
                        return(Json(new ReturnResult(400, "Hồ sơ thuộc về " + thuyenChuyen.School.DVQL.TenDayDu, null), JsonRequestBehavior.AllowGet));
                    }
                    var thuyenChuyenJson = JsonConvert.SerializeObject(thuyenChuyen,
                                                                       Formatting.None,
                                                                       new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                    });
                    return(Json(new ReturnResult(200, "success", thuyenChuyenJson), JsonRequestBehavior.AllowGet));
                }
            }
            else if (mahoso.ToUpper().Contains("TC"))
            {
                using (var _thuyenChuyenService = new ThuyenChuyenRepository())
                {
                    ThuyenChuyen thuyenChuyen = _thuyenChuyenService.GetThuyenChuyensByMaHoSo(mahoso.Trim());
                    if (thuyenChuyen == null)
                    {
                        return(Json(new ReturnResult(404, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
                    }
                    else if (thuyenChuyen.School.DVQLId != account.DvqlId)
                    {
                        return(Json(new ReturnResult(400, "Hồ sơ thuộc về " + thuyenChuyen.School.DVQL.TenDayDu, null), JsonRequestBehavior.AllowGet));
                    }

                    var thuyenChuyenJson = JsonConvert.SerializeObject(thuyenChuyen,
                                                                       Formatting.None,
                                                                       new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                    });
                    return(Json(new ReturnResult(200, "success", thuyenChuyenJson), JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new ReturnResult(404, "Không tìm thấy", null), JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult CapNhatThuyenChuyen(string id, string cmnd)
        {
            using (var _thuyenchuyenService = new ThuyenChuyenNgoaiTinhService())
            {
                ThuyenChuyenNgoaiTinh thuyenChuyen = _thuyenchuyenService.CheckThuyenChuyenExistedByIdAndCMND(id.Trim(), cmnd.Trim());
                if (thuyenChuyen == null || (thuyenChuyen.StatusId != 5 && thuyenChuyen.StatusId != null))
                {
                    return(RedirectToRoute("thuyenchuyenkiemtramatruong"));
                }

                using (var _districtService = new DistrictRepository())
                {
                    ViewBag.DistrictsNoiSinh = _districtService.GetDistrictByProvinceId(thuyenChuyen.Ward.District.ProvinceId);
                    ViewBag.DistrictsHKTT    = _districtService.GetDistrictByProvinceId(thuyenChuyen.Ward.District.ProvinceId);
                    ViewBag.Districts        = _districtService.GetDistrictByProvinceId(79);
                }
                using (var _wardService = new WardRepository())
                {
                    ViewBag.WardsNoiSinh = _wardService.GetWardByDistrictId(thuyenChuyen.Ward.DistrictID);
                    ViewBag.WardsHKTT    = _wardService.GetWardByDistrictId(thuyenChuyen.Ward.DistrictID);
                }
                using (var _provinceService = new ProvinceRepository())
                {
                    ViewBag.Provinces = _provinceService.GetProvinceByCountryId(237);
                }
                using (var _CapTruongService = new CapTruongRepository())
                {
                    ViewBag.CapTruongs = _CapTruongService.GetCapTruongs();
                }
                using (var _monDuTuyen = new MonDuTuyenRepository())
                {
                    ViewBag.MonDays = _monDuTuyen.GetMonDuTuyens();
                }
                using (var _hinhThucDaoTao = new HinhThucDaoTaoRepository())
                {
                    ViewBag.HinhThucDaoTaos = _hinhThucDaoTao.GetHinhThucDaoTaos();
                }
                using (var _xepLoaiHocLuc = new XepLoaiHocLucRepository())
                {
                    ViewBag.XepLoaiHocLucs = _xepLoaiHocLuc.GetXepLoaiHocLucs();
                }
                using (var _chuyenNghanhDaoTao = new ChuyenNganhDaoTaoRepository())
                {
                    ViewBag.ChuyenNganhDaoTaos = _chuyenNghanhDaoTao.GetChuyenNganhDaoTaos();
                }
                using (var _bangTotNghiep = new BangTotNghiepRepository())
                {
                    ViewBag.BangTotNghieps = _bangTotNghiep.GetBangTotNghieps();
                }
                using (var _schoolService = new SchoolRepository())
                {
                    ViewBag.SchoolsCD = _schoolService.GetSchoolsByDistrictAndCapHoc(thuyenChuyen.School.Ward.DistrictID, thuyenChuyen.School.CapTruongId);
                }
                using (var _trinhdoDaoTao = new TrinhDoCaoNhatRepository())
                {
                    ViewBag.TrinhDoCaoNhats = _trinhdoDaoTao.GetTrinhDoCaoNhats();
                }
                ViewBag.ThuyenChuyen = thuyenChuyen;
                return(View());
            }
        }