示例#1
0
        public ActionResult NhanHoSoThuyenChuyen(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 ThuyenChuyenRepository())
            {
                ThuyenChuyen 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 ThuyenChuyen CreateThuyenChuyen(ThuyenChuyen thuyenChuyen)
 {
     thuyenChuyen.CreatedAt = DateTime.Now;
     _db.ThuyenChuyens.Add(thuyenChuyen);
     _db.SaveChanges();
     return(thuyenChuyen);
 }
        public ThuyenChuyen CapNhatThuyenChuyen(ThuyenChuyen thuyenChuyen)
        {
            using (var _db = new TCCBDB())
            {
                thuyenChuyen.BangTotNghiep      = null;
                thuyenChuyen.ChuyenNganhDaoTao  = null;
                thuyenChuyen.HinhThucDaoTao     = null;
                thuyenChuyen.MonDuTuyen         = null;
                thuyenChuyen.School             = null;
                thuyenChuyen.School1            = null;
                thuyenChuyen.StatusThuyenChuyen = null;
                thuyenChuyen.TrinhDoCaoNhat     = null;
                thuyenChuyen.Ward          = null;
                thuyenChuyen.Ward1         = null;
                thuyenChuyen.XepLoaiHocLuc = null;

                _db.Entry(thuyenChuyen).State = EntityState.Modified;
                try
                {
                    _db.SaveChanges();
                }
                catch (Exception)
                {
                    return(null);
                }
                return(thuyenChuyen);
            }
        }
 public ThuyenChuyen CreateThuyenChuyen(ThuyenChuyen thuyenChuyen)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.CreatedAt = DateTime.Now;
         thuyenChuyen.TienTo    = "TC";
         _db.ThuyenChuyens.Add(thuyenChuyen);
         _db.SaveChanges();
         return(thuyenChuyen);
     }
 }
 public ThuyenChuyen CapNhatThuyenChuyen(ThuyenChuyen thuyenChuyen)
 {
     _db.Entry(thuyenChuyen).State = System.Data.Entity.EntityState.Modified;
     try
     {
         _db.SaveChanges();
     }
     catch (Exception)
     {
         return(null);
     }
     return(thuyenChuyen);
 }
 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(ThuyenChuyenDTO thuyenChuyenDTO)
 {
     if (ModelState.IsValid)
     {
         ThuyenChuyen thuyenChuyen = new ThuyenChuyen();
         Mapper.Map(thuyenChuyenDTO, thuyenChuyen);
         using (var _thuyenChuyenService = new ThuyenChuyenRepository())
         {
             ThuyenChuyen thuyenChuyenCreated = _thuyenChuyenService.CreateThuyenChuyen(thuyenChuyen);
             return(Json(new ReturnResult(200, "success", thuyenChuyen.Id), JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new ReturnResult(400, "failed", null), JsonRequestBehavior.AllowGet));
 }
 public ThuyenChuyen CapNhatTrangThaiHoSo(ThuyenChuyen thuyenChuyen, int trangThaiId)
 {
     thuyenChuyen.StatusId         = trangThaiId;
     _db.Entry(thuyenChuyen).State = System.Data.Entity.EntityState.Modified;
     try
     {
         _db.SaveChanges();
     }
     catch (Exception)
     {
         return(null);
     }
     return(thuyenChuyen);
 }
示例#9
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));
         }
     }
 }
 public ThuyenChuyen CapNhatTrangThaiHoSo(ThuyenChuyen thuyenChuyen, int trangThaiId)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.StatusThuyenChuyen = null;
         thuyenChuyen.StatusId           = trangThaiId;
         _db.Entry(thuyenChuyen).State   = EntityState.Modified;
         try
         {
             _db.SaveChanges();
         }
         catch (Exception)
         {
             return(null);
         }
         return(thuyenChuyen);
     }
 }
        public ActionResult CapNhatPost(ThuyenChuyenDTO thuyenChuyenDTO, int id)
        {
            if (ModelState.IsValid)
            {
                using (var _thuyenChuyenService = new ThuyenChuyenRepository())
                {
                    ThuyenChuyen thuyenChuyen = _thuyenChuyenService.GetThuyenChuyensById(id);
                    Mapper.Map(thuyenChuyenDTO, thuyenChuyen);
                    ThuyenChuyen 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 ThuyenChuyen GetThuyenChuyensById(int id)
        {
            ThuyenChuyen thuyenChuyen = _db.ThuyenChuyens
                                        .Include("BangTotNghiep")
                                        .Include("StatusThuyenChuyen")
                                        .Include("ChuyenNganhDaoTao")
                                        .Include("HinhThucDaoTao")
                                        .Include("MonDuTuyen")
                                        .Include("School.Ward.District")
                                        .Include("School.DVQL")
                                        .Include("School1.Ward.District")
                                        .Include("XepLoaiHocLuc")
                                        .Include("Ward1.District.Province")
                                        .Include("Ward.District.Province")
                                        .Include("TrinhDoCaoNhat")
                                        .Where(s => s.Id == id).SingleOrDefault();

            return(thuyenChuyen);
        }
        public ThuyenChuyen checkThuyenChuyenExistedByIdAndCMND(int id, string cmnd)
        {
            ThuyenChuyen thuyenChuyen = _db.ThuyenChuyens
                                        .Include("BangTotNghiep")
                                        .Include("StatusThuyenChuyen")
                                        .Include("ChuyenNganhDaoTao")
                                        .Include("HinhThucDaoTao")
                                        .Include("MonDuTuyen")
                                        .Include("School.Ward.District")
                                        .Include("School1.Ward.District")
                                        .Include("XepLoaiHocLuc")
                                        .Include("Ward1.District.Province")
                                        .Include("Ward.District.Province")
                                        .Include("TrinhDoCaoNhat")
                                        .Where(s => s.Id == id && s.CMND.Trim() == cmnd.Trim())
                                        .SingleOrDefault();

            return(thuyenChuyen);
        }
 public ThuyenChuyen TiepNhanHoSo(ThuyenChuyen thuyenChuyen, int trangThaiId, int accountId)
 {
     using (var _db = new TCCBDB())
     {
         thuyenChuyen.StatusId         = trangThaiId;
         thuyenChuyen.NguoiTiepNhanId  = accountId;
         thuyenChuyen.NgayTiepNhan     = DateTime.Now;
         _db.Entry(thuyenChuyen).State = EntityState.Modified;
         try
         {
             _db.SaveChanges();
         }
         catch (Exception)
         {
             return(null);
         }
         return(thuyenChuyen);
     }
 }
 public ThuyenChuyen GetThuyenChuyensByMaHoSo(string id)
 {
     using (var _db = new TCCBDB())
     {
         ThuyenChuyen thuyenChuyen = _db.ThuyenChuyens
                                     .Include("BangTotNghiep")
                                     .Include("StatusThuyenChuyen")
                                     .Include("ChuyenNganhDaoTao")
                                     .Include("HinhThucDaoTao")
                                     .Include("MonDuTuyen")
                                     .Include("School.Ward.District")
                                     .Include("School.DVQL")
                                     .Include("School1.Ward.District")
                                     .Include("XepLoaiHocLuc")
                                     .Include("Ward1.District.Province")
                                     .Include("Ward.District.Province")
                                     .Include("TrinhDoCaoNhat")
                                     .Where(s => s.TienTo.Trim() + s.Id == id.ToUpper().Trim()).SingleOrDefault();
         return(thuyenChuyen);
     }
 }
        public ActionResult CapNhatThuyenChuyen(string id, string cmnd)
        {
            using (var _thuyenchuyenService = new ThuyenChuyenRepository())
            {
                ThuyenChuyen thuyenChuyen = _thuyenchuyenService.CheckThuyenChuyenExistedByIdAndCMND(id, cmnd);
                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.Ward1.District.ProvinceId);
                    ViewBag.Districts        = _districtService.GetDistrictByProvinceId(79);
                }
                using (var _wardService = new WardRepository())
                {
                    ViewBag.WardsNoiSinh = _wardService.GetWardByDistrictId(thuyenChuyen.Ward.DistrictID);
                    ViewBag.WardsHKTT    = _wardService.GetWardByDistrictId(thuyenChuyen.Ward1.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.SchoolsDCT = _schoolService.GetSchoolsByDistrictAndCapHoc(thuyenChuyen.School.Ward.DistrictID, thuyenChuyen.School.CapTruongId);
                    ViewBag.SchoolsCD  = _schoolService.GetSchoolsByDistrictAndCapHoc(thuyenChuyen.School1.Ward.DistrictID, thuyenChuyen.School1.CapTruongId);
                }
                using (var _trinhdoDaoTao = new TrinhDoCaoNhatRepository())
                {
                    ViewBag.TrinhDoCaoNhats = _trinhdoDaoTao.GetTrinhDoCaoNhats();
                }
                ViewBag.ThuyenChuyen = thuyenChuyen;
                return(View());
            }
        }
示例#17
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));
            }
        }