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 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))); }