Beispiel #1
0
 public HoSoHopLe CreateHoSoHopLe(HoSoHopLe hoSoHopLe)
 {
     hoSoHopLe.MaVong2 = GetMaxSoHoHopLeByCurrentYear() + 1;
     _db.HoSoHopLes.Add(hoSoHopLe);
     _db.SaveChanges();
     return(hoSoHopLe);
 }
Beispiel #2
0
        public ActionResult SubmitCapNhatDuyet(int Id, RegistrationInterviewDTO registrationInterviewDTO, string ghiChuCanBoSung, int trangthaiId, string lyDoTuChoi)
        {
            int     permisstionId = 7;
            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 (ModelState.IsValid)
            {
                RegistrationInterview registrationInterview = registrationInterviewRepository.GetRegistrationInterviewById(Id);
                registrationInterview.NgayRaXoat = DateTime.Now;
                if (trangthaiId == 2)
                {
                    registrationInterview.GhiChu = ghiChuCanBoSung + " (vào lúc " + DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy") + ")";
                }
                else if (trangthaiId == 3)
                {
                    registrationInterview.LyDoTuChoi = lyDoTuChoi + " (vào lúc " + DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy") + ")";
                }
                registrationInterview.NguoiRaSoat = account.Id;
                registrationInterview.TrangThaiHosoTuyenDungId = trangthaiId;
                Mapper.Map(registrationInterviewDTO, registrationInterview);
                if (registrationInterviewDTO.IsNienChe == false)
                {
                    registrationInterview.DiemLuanVan = null;
                }
                RegistrationInterview registrationInterviewAfterUpdated = registrationInterviewRepository.CapNhatRegistrationInterview(registrationInterview);
                if (registrationInterviewAfterUpdated == null)
                {
                    return(Json(new ReturnResult(400, "failed", null)));
                }
                if (trangthaiId == 1)
                {
                    HoSoHopLe hoSoHopLe = new HoSoHopLe();
                    hoSoHopLe.CreatedAt = DateTime.Now;
                    hoSoHopLe.TienTo    = account.Code.Trim() + DateTime.Now.Year % 100 + "_";
                    hoSoHopLe.HoSoId    = registrationInterview.Id;
                    HoSoHopLe hoSoHopCreated = hoSoHopLeRepository.CreateHoSoHopLe(hoSoHopLe);
                    return(Json(new ReturnResult(200, "Tiếp nhận mã hồ sơ " + registrationInterview.TienTo + registrationInterview.Id + "thành công với mã vòng 2: " + hoSoHopLe.TienTo + hoSoHopLe.MaVong2, registrationInterviewAfterUpdated.Id)));
                }
                else if (trangthaiId == 2)
                {
                    return(Json(new ReturnResult(200, "Ghi nhận cần bổ sung mã hồ sơ " + registrationInterview.TienTo + registrationInterview.Id + "thành công", registrationInterviewAfterUpdated.Id)));
                }
                else if (trangthaiId == 3)
                {
                    return(Json(new ReturnResult(200, "Từ chối mã hồ sơ " + registrationInterview.TienTo + registrationInterview.Id + " thành công", registrationInterviewAfterUpdated.Id)));
                }
            }
            return(Json(new ReturnResult(400, "failed", null)));
        }
Beispiel #3
0
        public ActionResult KiemTraMaDuyetHopLe(string id)
        {
            int     permisstionId = 7;
            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));
            }
            RegistrationInterview registrationInterview = registrationInterviewRepository.GetRegistrationInterviewByTienToId(id);

            if (registrationInterview == null)
            {
                return(Json(new ReturnResult(404, "Không tìm thấy ứng viên với mã " + id, null), JsonRequestBehavior.AllowGet));
            }
            else if (registrationInterview.UpdatedAt == null)
            {
                return(Json(new ReturnResult(404, "Hồ sơ với mã " + id + " chưa hoàn tất cập nhật", null), JsonRequestBehavior.AllowGet));
            }
            else if (registrationInterview.TrangThaiHosoTuyenDungId == 3)
            {
                return(Json(new ReturnResult(400, "Hồ sơ " + id.ToUpper() + " bị từ chối bởi " + registrationInterview.Account1.LastName + " " + registrationInterview.Account1.FirstName + ". Lý do:  " + registrationInterview.LyDoTuChoi, null), JsonRequestBehavior.AllowGet));
            }
            else if (registrationInterview.TrangThaiHosoTuyenDungId == 1)
            {
                HoSoHopLe hoSoHopLe = hoSoHopLeRepository.GetHoSoHopLeByHoSoId(registrationInterview.Id);
                return(Json(new ReturnResult(400, "Hồ sơ mã " + id.ToUpper() + " đã được tiếp nhận bởi " + registrationInterview.Account1.LastName + " " + registrationInterview.FirstName + " với mã vòng 2: " + hoSoHopLe.TienTo + hoSoHopLe.MaVong2, null), JsonRequestBehavior.AllowGet));
            }
            return(Json(new ReturnResult(200, "success", registrationInterview.Id), JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public HoSoHopLe GetHoSoHopLeByHoSoId(int id)
        {
            HoSoHopLe hoSoHopLe = _db.HoSoHopLes.Where(s => s.HoSoId == id).FirstOrDefault();

            return(hoSoHopLe);
        }