示例#1
0
        public ActionResult TaoMoiUngVien(string cmnd, string hoVaTen)
        {
            int     permisstionId = 6;
            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 = new RegistrationInterview();

            string[] arrListStr = hoVaTen.Trim().Split(' ');//tách trong chuỗi str trên khi gặp ký tự ' '
            registrationInterview.FirstName = arrListStr[arrListStr.Length - 1].Trim();
            string candidateLastName = "";

            for (int i = 0; i < arrListStr.Length - 1; i++)
            {
                candidateLastName = candidateLastName + arrListStr[i] + " ";
            }
            registrationInterview.LastName       = candidateLastName.Trim();
            registrationInterview.IdentifyCard   = cmnd.Trim();
            registrationInterview.NguoiTaoHoaDon = account.Id;
            registrationInterview.DOB            = DateTime.Now;
            registrationInterview.CreatedAt      = DateTime.Now;
            registrationInterview.IsActive       = true;
            registrationInterview.HKTTWardId     = 26740;
            registrationInterview.NOHNWardId     = 26740;
            registrationInterview.CMNDNgayCap    = DateTime.Now;
            //create default working status because in 2019 we do not need this propertise field. So I set this thing to 1.
            registrationInterview.LamViecTrongNganhId = 1;
            registrationInterview.TienTo                   = "TD";
            registrationInterview.TrinhDoVanHoa            = "Tốt nghiệp THPT";
            registrationInterview.DoiTuongUuTien           = 1;
            registrationInterview.TruongHopDacBietId       = 1;
            registrationInterview.DanTocId                 = 1;
            registrationInterview.TrinhDoNgoaiNguKhacId    = 1;
            registrationInterview.ChungChiNghiepVuSuPhamId = 1;
            registrationInterviewRepository.TaoMoiUngVien(registrationInterview);
            return(Json(new ReturnResult(200, "success", registrationInterview.Id)));
        }