Beispiel #1
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)));
        }
        public ActionResult PostCapNhat(RegistrationInterviewDTO registrationInterviewDTO)
        {
            RegistrationInterview registrationInterview = registrationInterviewRepository.UpdateRegistrationInterview(registrationInterviewDTO);

            if (registrationInterview == null)
            {
                return(Json(new ResponseResult(403, "Something went wrong when updated", null)));
            }
            return(Json(new ResponseResult(200, "success", null)));
        }
Beispiel #3
0
        public ActionResult IsvalidRegistration(RegistrationInterviewDTO registrationInterviewDTO)
        {
            Account usersession = (Account)Session[CommonConstants.USER_SESSION];

            if (usersession == null || usersession.RoleId != 4 && usersession.RoleId != 2)
            {
                Session.RemoveAll();
                return(RedirectToRoute("login", null));
            }
            registrationInterviewDTO.ReviewedBy = usersession.Id;
            RegistrationInterview registrationInterview = registrationInterviewRepository.UpdateRegistrationInterview(registrationInterviewDTO);

            if (registrationInterview == null)
            {
                return(Json(new ResponseResult(403, "Something went wrong when updated", null)));
            }
            return(Json(new ResponseResult(200, "success", null)));
        }
 public ActionResult SubmitCapNhat(int Id, RegistrationInterviewDTO registrationInterviewDTO)
 {
     if (ModelState.IsValid)
     {
         RegistrationInterview registrationInterview = registrationInterviewRepository.GetRegistrationInterviewById(Id);
         registrationInterview.UpdatedAt = DateTime.Now;
         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)));
         }
         return(Json(new ReturnResult(200, "success", registrationInterviewAfterUpdated.Id)));
     }
     return(Json(new ReturnResult(400, "failed", null)));
 }
        public ActionResult PostCapNhat(RegistrationInterviewDTO registrationInterviewDTO)
        {
            //if (!ModelState.IsValid)
            //{
            //    return Json(new ResponseResult(403, ModelState.Values.SelectMany(s => s.Errors).Select(s => s.ErrorMessage).ToString(), null));
            //}
            RegistrationInterview registrationInterview = registrationInterviewRepository.UpdateRegistrationInterview(registrationInterviewDTO);

            if (registrationInterview == null)
            {
                return(Json(new ResponseResult(403, "Something went wrong when updated", null)));
            }
            var registrationInterviewJson = JsonConvert.SerializeObject(registrationInterview,
                                                                        Formatting.None,
                                                                        new JsonSerializerSettings()
            {
                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
            });

            return(Json(new ResponseResult(200, "success", registrationInterviewJson)));
        }
Beispiel #6
0
        public RegistrationInterview UpdateRegistrationInterviewApprovedBy(RegistrationInterviewDTO registrationInterviewDTO)
        {
            RegistrationInterview registrationInterview = GetRegistrationInterviewById(registrationInterviewDTO.Id);

            registrationInterview.ReviewedBy         = registrationInterviewDTO.ReviewedBy;
            registrationInterview.CandidateFirstName = registrationInterviewDTO.CandidateFirstName;
            registrationInterview.CandidateLastName  = registrationInterviewDTO.CandidateLastName;
            registrationInterview.UpdatedAt          = DateTime.Now;
            registrationInterview.DOB                  = registrationInterviewDTO.DOB;
            registrationInterview.PhoneNumber          = registrationInterviewDTO.PhoneNumber;
            registrationInterview.SubjectToInterviewId = registrationInterview.SubjectToInterviewId;
            if (registrationInterviewDTO.CreatedAtManagementUnitId == 26)
            {
                registrationInterview.Aspirations01DistrictId     = registrationInterviewDTO.Aspirations01DistrictId;
                registrationInterview.Aspirations02DistrictId     = registrationInterviewDTO.Aspirations02DistrictId;
                registrationInterview.Aspirations03DistrictId     = registrationInterviewDTO.Aspirations03DistrictId;
                registrationInterview.SchoolDegreeIdExpectedTeach = 5;
            }
            else
            {
                registrationInterview.SchoolDegreeIdExpectedTeach = registrationInterviewDTO.SchoolDegreeIdExpectedTeach;
            }

            registrationInterview.Email = registrationInterviewDTO.Email;
            registrationInterview.ForeignLanguageDegreeId = registrationInterviewDTO.ForeignLanguageDegreeId;

            registrationInterview.IsMale = registrationInterviewDTO.IsMale;
            registrationInterview.DegreeClassificationId = registrationInterviewDTO.DegreeClassificationId;
            registrationInterview.GraduatedAtYear        = registrationInterviewDTO.GraduatedAtYear;


            CurrentLivingAddress currentLivingAddress = _db.CurrentLivingAddresses.Where(s => s.Id == registrationInterview.CurrentLivingAddressId).SingleOrDefault();

            currentLivingAddress.WardId      = registrationInterviewDTO.CurrentLivingAddressId;
            currentLivingAddress.HouseNumber = registrationInterviewDTO.CurrentLivingAddressHouseNumber;
            HouseHold houseHold = _db.HouseHolds.Where(s => s.Id == registrationInterview.HouseHoldId).SingleOrDefault();

            houseHold.WardId      = registrationInterviewDTO.HouseHoldId;
            houseHold.HouseNumber = registrationInterviewDTO.HouseHoldHouseNumber;

            registrationInterview.StatusWorkingInEducationId = registrationInterviewDTO.StatusWorkingInEducationId;
            registrationInterview.GraduationClassficationId  = registrationInterviewDTO.GraduationClassficationId;
            registrationInterview.SpecializedTranningId      = registrationInterviewDTO.SpecializedTranningId;
            registrationInterview.IsNienChe = registrationInterviewDTO.IsNienChe;
            registrationInterview.GPA       = registrationInterviewDTO.GPA;
            if (registrationInterviewDTO.IsNienChe == true)
            {
                registrationInterview.CaptionProjectPoint = registrationInterviewDTO.CaptionProjectPoint;
            }
            registrationInterview.TrainningCatergoryId    = registrationInterviewDTO.TrainningCatergoryId;
            registrationInterview.HighestLevelEducationId = registrationInterviewDTO.HighestLevelEducationId;
            if (registrationInterviewDTO.TrainningCatergoryId == 1 || registrationInterviewDTO.TrainningCatergoryId == 3 || registrationInterviewDTO.TrainningCatergoryId == 5)
            {
                registrationInterview.IsHadNghiepVuSupham = true;
            }
            registrationInterview.InfomationTechnologyDegreeId = registrationInterviewDTO.InfomationTechnologyDegreeId;

            registrationInterview.UniversityLocation = registrationInterviewDTO.UniversityLocation;
            registrationInterview.NamVaoNghanh       = registrationInterviewDTO.NamVaoNghanh;
            registrationInterview.MaNgach            = registrationInterviewDTO.MaNgach;
            registrationInterview.MocNangLuongLansau = registrationInterviewDTO.MocNangLuongLansau;
            registrationInterview.HeSoLuong          = registrationInterviewDTO.HeSoLuong;
            _db.Entry(registrationInterview).State   = EntityState.Modified;
            _db.Entry(currentLivingAddress).State    = EntityState.Modified;
            _db.Entry(houseHold).State = EntityState.Modified;
            try
            {
                _db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(registrationInterview = null);
            }

            return(GetRegistrationInterviewByIdWithDetail(registrationInterview.Id));
        }